diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2014-06-08 13:57:32 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2014-06-08 13:57:32 +0200 |
commit | d9a610fb61028845349d98c4e1574778a7cfc05e (patch) | |
tree | 0103ceec7eef54c940ad80d12f90c5c975dda602 /src/instrumentationTest/de/test/antennapod | |
parent | c3e0ac9e74ef012c08eef0348604c2fdefca8074 (diff) | |
download | AntennaPod-d9a610fb61028845349d98c4e1574778a7cfc05e.zip |
Show queue size and number of unread items in navdrawer. closes #453
Diffstat (limited to 'src/instrumentationTest/de/test/antennapod')
-rw-r--r-- | src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java b/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java index cb854b88d..c42c7a0cc 100644 --- a/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java +++ b/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java @@ -365,4 +365,44 @@ public class DBReaderTest extends InstrumentationTestCase { assertEquals("Wrong entry at index " + i, feeds.get(i).getId(), statistics.get(i).getFeedID()); } } + + public void testGetNavDrawerDataQueueEmptyNoUnreadItems() { + final Context context = getInstrumentation().getTargetContext(); + final int NUM_FEEDS = 10; + final int NUM_ITEMS = 10; + List<Feed> feeds = DBTestUtils.saveFeedlist(context, NUM_FEEDS, NUM_ITEMS, true); + DBReader.NavDrawerData navDrawerData = DBReader.getNavDrawerData(context); + assertEquals(NUM_FEEDS, navDrawerData.feeds.size()); + assertEquals(0, navDrawerData.numUnreadItems); + assertEquals(0, navDrawerData.queueSize); + } + + public void testGetNavDrawerDataQueueNotEmptyWithUnreadItems() { + final Context context = getInstrumentation().getTargetContext(); + final int NUM_FEEDS = 10; + final int NUM_ITEMS = 10; + final int NUM_QUEUE = 1; + final int NUM_UNREAD = 2; + List<Feed> feeds = DBTestUtils.saveFeedlist(context, NUM_FEEDS, NUM_ITEMS, true); + PodDBAdapter adapter = new PodDBAdapter(context); + adapter.open(); + for (int i = 0; i < NUM_UNREAD; i++) { + FeedItem item = feeds.get(0).getItems().get(i); + item.setRead(false); + adapter.setSingleFeedItem(item); + } + List<FeedItem> queue = new ArrayList<FeedItem>(); + for (int i = 0; i < NUM_QUEUE; i++) { + FeedItem item = feeds.get(1).getItems().get(i); + queue.add(item); + } + adapter.setQueue(queue); + + adapter.close(); + + DBReader.NavDrawerData navDrawerData = DBReader.getNavDrawerData(context); + assertEquals(NUM_FEEDS, navDrawerData.feeds.size()); + assertEquals(NUM_UNREAD, navDrawerData.numUnreadItems); + assertEquals(NUM_QUEUE, navDrawerData.queueSize); + } } |