use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class LangLinksActivityTest method getBaseLanguageEntries.
private List<PageTitle> getBaseLanguageEntries() {
List<PageTitle> result = new ArrayList<>();
result.add(new PageTitle("Yankee Stadium (1923)", WikiSite.forLanguageCode("en")));
result.add(new PageTitle("ヤンキー・スタジアム (1923年)", WikiSite.forLanguageCode("ja")));
result.add(new PageTitle("양키 스타디움 (1923년)", WikiSite.forLanguageCode("ko")));
result.add(new PageTitle("Yankee Stadium (1923)", WikiSite.forLanguageCode("sv")));
return result;
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class LangLinksActivityTest method testAddChineseEntriesForTraditionalChinese.
@Test
public void testAddChineseEntriesForTraditionalChinese() throws Throwable {
PageTitle title = new PageTitle(null, "洋基體育場 (1923年)", WikiSite.forLanguageCode("zh-hant"));
List<PageTitle> list = getBaseLanguageEntries();
LangLinksActivity.addChineseEntriesIfNeeded(title, list);
assertThat(list, is(getExpectedZhHantResults()));
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class LangLinksActivityTest method getExpectedGeneralResults.
private List<PageTitle> getExpectedGeneralResults() {
List<PageTitle> result = getBaseLanguageEntries();
result.add(new PageTitle("洋基体育场 (1923年)", WikiSite.forLanguageCode("zh-hans")));
// TODO: change to correct variant, an API issue
result.add(new PageTitle("洋基体育场 (1923年)", WikiSite.forLanguageCode("zh-hant")));
return result;
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class LangLinksActivityTest method testSkipAddChineseEntries.
@Test
public void testSkipAddChineseEntries() throws Throwable {
PageTitle title = new PageTitle(null, "Yankee Stadium (1923)", WikiSite.forLanguageCode("da"));
List<PageTitle> list = getBaseLanguageEntriesWithZhVariants();
LangLinksActivity.addChineseEntriesIfNeeded(title, list);
assertThat(list, is(getExpectedGeneralResults()));
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class ReadingListDbHelperTest method testFindPageForRetrievingPage.
@Test
public void testFindPageForRetrievingPage() {
ReadingList list = readingListDbHelper.createList("Test9", "TestDesc");
ReadingList list2 = readingListDbHelper.createList("Test10", "TestDesc");
PageTitle page = new PageTitle("1", WikipediaApp.getInstance().getWikiSite());
PageTitle page2 = new PageTitle("2", WikipediaApp.getInstance().getWikiSite());
readingListDbHelper.addPageToList(list, page, false);
readingListDbHelper.addPageToList(list2, page2, false);
ReadingListPage readingListPage = readingListDbHelper.findPageInAnyList(page);
readingListDbHelper.deleteList(list);
readingListDbHelper.deleteList(list2);
List<ReadingListPage> pages = new ArrayList<>();
pages.add(new ReadingListPage(page));
readingListDbHelper.markPagesForDeletion(list, pages);
pages.clear();
pages.add(new ReadingListPage(page2));
readingListDbHelper.markPagesForDeletion(list2, pages);
Assert.assertTrue(readingListPage != null);
}
Aggregations