Search in sources :

Example 46 with PageTitle

use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.

the class ParcelableTest method testHistoryEntry.

@Test
public void testHistoryEntry() throws Throwable {
    WikiSite wiki = WikiSite.forLanguageCode("en");
    PageTitle title = new PageTitle("Talk", "India", wiki);
    HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_EXTERNAL_LINK);
    TestParcelUtil.test(historyEntry);
}
Also used : PageTitle(org.wikipedia.page.PageTitle) HistoryEntry(org.wikipedia.history.HistoryEntry) WikiSite(org.wikipedia.dataclient.WikiSite) Test(org.junit.Test)

Example 47 with PageTitle

use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.

the class ParcelableTest method testPageTitleTalk.

@Test
public void testPageTitleTalk() throws Throwable {
    WikiSite wiki = WikiSite.forLanguageCode("en");
    PageTitle origTitle = new PageTitle("Talk", "India", wiki);
    TestParcelUtil.test(origTitle);
}
Also used : PageTitle(org.wikipedia.page.PageTitle) WikiSite(org.wikipedia.dataclient.WikiSite) Test(org.junit.Test)

Example 48 with PageTitle

use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.

the class ParcelableTest method testPageTitle.

@Test
public void testPageTitle() throws Throwable {
    PageTitle title = new PageTitle(null, "Test", WikiSite.forLanguageCode("en"));
    TestParcelUtil.test(title);
}
Also used : PageTitle(org.wikipedia.page.PageTitle) Test(org.junit.Test)

Example 49 with PageTitle

use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.

the class BatchUtilTest method testMwApiBatches.

@Test
@SuppressWarnings("checkstyle:magicnumber")
public void testMwApiBatches() throws Throwable {
    final TestLatch latch = new TestLatch();
    BatchUtil.makeBatches(titles, new BatchUtil.Handler<Integer>() {

        private List<Integer> sizes = new ArrayList<>();

        private int count;

        @Override
        public void handleBatch(@NonNull List<PageTitle> batchTitles, int total, BatchUtil.Callback<Integer> cb) {
            sizes.add(batchTitles.size());
            count += batchTitles.size();
            if (count == TOTAL) {
                assertThat(sizes.get(0), is(50));
                assertThat(sizes.get(1), is(50));
                assertThat(sizes.get(2), is(20));
                latch.countDown();
            }
        }
    }, null);
    latch.await();
}
Also used : TestLatch(org.wikipedia.testlib.TestLatch) ArrayList(java.util.ArrayList) PageTitle(org.wikipedia.page.PageTitle) Test(org.junit.Test)

Example 50 with PageTitle

use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.

the class FeaturedArticleCard method historyEntry.

@NonNull
public HistoryEntry historyEntry(int source) {
    PageTitle title = new PageTitle(articleTitle(), wikiSite());
    if (image() != null) {
        title.setThumbUrl(image().toString());
    }
    title.setDescription(articleSubtitle());
    return new HistoryEntry(title, source);
}
Also used : PageTitle(org.wikipedia.page.PageTitle) HistoryEntry(org.wikipedia.history.HistoryEntry) NonNull(android.support.annotation.NonNull)

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