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);
}
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);
}
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);
}
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();
}
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);
}
Aggregations