Search in sources :

Example 16 with PageTitle

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;
}
Also used : PageTitle(org.wikipedia.page.PageTitle) ArrayList(java.util.ArrayList)

Example 17 with PageTitle

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()));
}
Also used : PageTitle(org.wikipedia.page.PageTitle) Test(org.junit.Test)

Example 18 with PageTitle

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;
}
Also used : PageTitle(org.wikipedia.page.PageTitle)

Example 19 with PageTitle

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()));
}
Also used : PageTitle(org.wikipedia.page.PageTitle) Test(org.junit.Test)

Example 20 with PageTitle

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);
}
Also used : PageTitle(org.wikipedia.page.PageTitle) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

PageTitle (org.wikipedia.page.PageTitle)60 Test (org.junit.Test)20 ArrayList (java.util.ArrayList)15 WikiSite (org.wikipedia.dataclient.WikiSite)11 HistoryEntry (org.wikipedia.history.HistoryEntry)11 NonNull (android.support.annotation.NonNull)6 OnClick (butterknife.OnClick)5 ReadingListPage (org.wikipedia.readinglist.database.ReadingListPage)5 IOException (java.io.IOException)4 Date (java.util.Date)4 WikipediaApp (org.wikipedia.WikipediaApp)3 PageBackStackItem (org.wikipedia.page.PageBackStackItem)3 Tab (org.wikipedia.page.tabs.Tab)3 ProgressDialog (android.app.ProgressDialog)2 Intent (android.content.Intent)2 AssetManager (android.content.res.AssetManager)2 Configuration (android.content.res.Configuration)2 Resources (android.content.res.Resources)2 Bundle (android.os.Bundle)2 DisplayMetrics (android.util.DisplayMetrics)2