use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class WikiSiteTest method testTitleForInternalLink.
@Test
public void testTitleForInternalLink() {
WikiSite wiki = WikiSite.forLanguageCode("en");
assertThat(new PageTitle("Main Page", wiki), is(wiki.titleForInternalLink("")));
assertThat(new PageTitle("Main Page", wiki), is(wiki.titleForInternalLink("/wiki/")));
assertThat(new PageTitle("wiki", wiki), is(wiki.titleForInternalLink("wiki")));
assertThat(new PageTitle("wiki", wiki), is(wiki.titleForInternalLink("/wiki/wiki")));
assertThat(new PageTitle("wiki/wiki", wiki), is(wiki.titleForInternalLink("/wiki/wiki/wiki")));
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class DescriptionEditClientTest method testIsEditAllowedNoWikiBaseItem.
@Test
public void testIsEditAllowedNoWikiBaseItem() {
WikiSite wiki = WikiSite.forLanguageCode("ru");
PageProperties props = mock(PageProperties.class);
when(props.getWikiBaseItem()).thenReturn(null);
Page page = new Page(new PageTitle("Test", wiki, null, null, props), Collections.<Section>emptyList(), props);
assertThat(DescriptionEditClient.isEditAllowed(page), is(false));
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class DescriptionEditClientTest method testIsEditAllowedSuccess.
@Test
public void testIsEditAllowedSuccess() {
WikiSite wiki = WikiSite.forLanguageCode("ru");
PageProperties props = mock(PageProperties.class);
when(props.getWikiBaseItem()).thenReturn("Q123");
when(props.canEdit()).thenReturn(true);
Page page = new Page(new PageTitle("Test", wiki, null, null, props), Collections.<Section>emptyList(), props);
assertThat(DescriptionEditClient.isEditAllowed(page), is(true));
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class LangLinksActivityTest method testAddChineseEntriesForSimplifiedChinese.
@Test
public void testAddChineseEntriesForSimplifiedChinese() throws Throwable {
PageTitle title = new PageTitle(null, "洋基体育场 (1923年)", WikiSite.forLanguageCode("zh-hans"));
List<PageTitle> list = getBaseLanguageEntries();
LangLinksActivity.addChineseEntriesIfNeeded(title, list);
assertThat(list, is(getExpectedZhHansResults()));
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class LangLinksActivityTest method getExpectedZhHansResults.
private List<PageTitle> getExpectedZhHansResults() {
List<PageTitle> result = getBaseLanguageEntries();
result.add(new PageTitle("洋基体育场 (1923年)", WikiSite.forLanguageCode("zh-hant")));
return result;
}
Aggregations