use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class LangLinksClientTest method getExpectedResults.
private List<PageTitle> getExpectedResults() {
List<PageTitle> result = new ArrayList<>();
result.add(new PageTitle("Sciëntologie", WikiSite.forLanguageCode("af")));
result.add(new PageTitle("سينتولوجيا", WikiSite.forLanguageCode("ar")));
result.add(new PageTitle("سيينتولوجيا", WikiSite.forLanguageCode("arz")));
return result;
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class ReadingListDbHelperTest method testAddPageToListForPageAddition.
@Test
public void testAddPageToListForPageAddition() {
PageTitle page = new PageTitle("1", WikipediaApp.getInstance().getWikiSite());
ReadingList list = readingListDbHelper.createList("Test4", "TestDesc");
ReadingList list2 = readingListDbHelper.createList("Test5", "TestDesc");
readingListDbHelper.addPageToList(list, page, false);
readingListDbHelper.addPageToList(list2, page, false);
List<ReadingListPage> pages = new ArrayList<>();
pages.add(new ReadingListPage(page));
List<ReadingList> lists = readingListDbHelper.getListsFromPageOccurrences(pages);
readingListDbHelper.deleteList(list);
readingListDbHelper.deleteList(list2);
readingListDbHelper.markPagesForDeletion(list, pages);
readingListDbHelper.markPagesForDeletion(list2, pages);
Assert.assertFalse(lists.contains(list));
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class ReadingListDbHelperTest method testAddIfNotExistsForRetrievingPages.
@Test
public void testAddIfNotExistsForRetrievingPages() {
ReadingList list = readingListDbHelper.createList("Test8", "TestDesc");
PageTitle page = new PageTitle("1", WikipediaApp.getInstance().getWikiSite());
PageTitle page2 = new PageTitle("2", WikipediaApp.getInstance().getWikiSite());
PageTitle page3 = new PageTitle("3", WikipediaApp.getInstance().getWikiSite());
readingListDbHelper.addPageToList(list, page, false);
List<PageTitle> pages = new ArrayList<>();
pages.add(page);
pages.add(page2);
pages.add(page3);
int numAdded = readingListDbHelper.addPagesToListIfNotExist(list, pages);
readingListDbHelper.deleteList(list);
List<ReadingListPage> readingListPages = new ArrayList<>();
for (PageTitle page1 : pages) {
readingListPages.add(new ReadingListPage(page1));
}
readingListDbHelper.markPagesForDeletion(list, readingListPages);
Assert.assertTrue(numAdded == 2);
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class ReadingListDbHelperTest method testGetAllPagesToBeSavedForRetrievingPages.
public void testGetAllPagesToBeSavedForRetrievingPages() {
PageTitle page = new PageTitle("1", WikipediaApp.getInstance().getWikiSite());
ReadingListPage readingListPage = new ReadingListPage(page);
readingListPage.status(ReadingListPage.STATUS_QUEUE_FOR_SAVE);
List<ReadingListPage> pagesListToBeAdded = new ArrayList<>();
pagesListToBeAdded.add(readingListPage);
ReadingList list = readingListDbHelper.createList("Test6", "TestDesc");
readingListDbHelper.addPagesToList(list, pagesListToBeAdded, false);
List<ReadingListPage> pagesList = readingListDbHelper.getAllPagesToBeSaved();
readingListDbHelper.deleteList(list);
List<ReadingListPage> pages = new ArrayList<>();
pages.add(readingListPage);
readingListDbHelper.markPagesForDeletion(list, pages);
Assert.assertTrue(pagesList.size() != 0);
}
use of org.wikipedia.page.PageTitle in project apps-android-wikipedia by wikimedia.
the class ReadingListDbHelperTest method testGetAllPageOccurrencesForRetrievingPages.
@Test
public void testGetAllPageOccurrencesForRetrievingPages() {
ReadingList list = readingListDbHelper.createList("Test11", "TestDesc");
ReadingList list2 = readingListDbHelper.createList("Test12", "TestDesc");
PageTitle page = new PageTitle("6", WikipediaApp.getInstance().getWikiSite());
readingListDbHelper.addPageToList(list, page, false);
readingListDbHelper.addPageToList(list2, page, false);
int numOfPages = readingListDbHelper.getAllPageOccurrences(page).size();
readingListDbHelper.deleteList(list);
readingListDbHelper.deleteList(list2);
List<ReadingListPage> pages = new ArrayList<>();
pages.add(new ReadingListPage(page));
readingListDbHelper.markPagesForDeletion(list, pages);
readingListDbHelper.markPagesForDeletion(list2, pages);
Assert.assertTrue(numOfPages != 0);
}
Aggregations