diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2014-02-11 20:28:04 +0100 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2014-02-11 20:28:04 +0100 |
commit | fa1789b7dc1997cf933c7cfa3edb891cbd9cedf6 (patch) | |
tree | cf9cc6d3517c7baf081cbd387214f1477e4bd3d1 /src/instrumentationTest/de/test/antennapod | |
parent | 5cabac4691ddccd0028d2f2bfe419070cd9e3489 (diff) | |
download | AntennaPod-fa1789b7dc1997cf933c7cfa3edb891cbd9cedf6.zip |
Make sort order in feed list case-insensitive. closes issue #339
Diffstat (limited to 'src/instrumentationTest/de/test/antennapod')
-rw-r--r-- | src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java b/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java index 594950b62..a214e55bc 100644 --- a/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java +++ b/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java @@ -7,9 +7,13 @@ import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.storage.DBReader; import de.danoeh.antennapod.storage.PodDBAdapter; -import static instrumentationTest.de.test.antennapod.storage.DBTestUtils.*; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Random; + +import static instrumentationTest.de.test.antennapod.storage.DBTestUtils.saveFeedlist; /** * Test class for DBReader @@ -66,7 +70,6 @@ public class DBReaderTest extends InstrumentationTestCase { } - public void testGetFeedList() { final Context context = getInstrumentation().getTargetContext(); List<Feed> feeds = saveFeedlist(context, 10, 0, false); @@ -78,6 +81,36 @@ public class DBReaderTest extends InstrumentationTestCase { } } + public void testGetFeedListSortOrder() { + final Context context = getInstrumentation().getTargetContext(); + PodDBAdapter adapter = new PodDBAdapter(context); + adapter.open(); + + Feed feed1 = new Feed(0, new Date(), "A", "link", "d", null, null, null, "rss", "A", null, "", "", true); + Feed feed2 = new Feed(0, new Date(), "b", "link", "d", null, null, null, "rss", "b", null, "", "", true); + Feed feed3 = new Feed(0, new Date(), "C", "link", "d", null, null, null, "rss", "C", null, "", "", true); + Feed feed4 = new Feed(0, new Date(), "d", "link", "d", null, null, null, "rss", "d", null, "", "", true); + adapter.setCompleteFeed(feed1); + adapter.setCompleteFeed(feed2); + adapter.setCompleteFeed(feed3); + adapter.setCompleteFeed(feed4); + assertTrue(feed1.getId() != 0); + assertTrue(feed2.getId() != 0); + assertTrue(feed3.getId() != 0); + assertTrue(feed4.getId() != 0); + + adapter.close(); + + List<Feed> saved = DBReader.getFeedList(context); + assertNotNull(saved); + assertEquals("Wrong size: ", 4, saved.size()); + + assertEquals("Wrong id of feed 1: ", feed1.getId(), saved.get(0).getId()); + assertEquals("Wrong id of feed 2: ", feed2.getId(), saved.get(1).getId()); + assertEquals("Wrong id of feed 3: ", feed3.getId(), saved.get(2).getId()); + assertEquals("Wrong id of feed 4: ", feed4.getId(), saved.get(3).getId()); + } + public void testFeedListDownloadUrls() { final Context context = getInstrumentation().getTargetContext(); List<Feed> feeds = saveFeedlist(context, 10, 0, false); @@ -301,7 +334,7 @@ public class DBReaderTest extends InstrumentationTestCase { adapter.open(); for (int i = 0; i < playedItems; i++) { FeedMedia m = feed.getItems().get(i).getMedia(); - m.setPlaybackCompletionDate(new Date(i+1)); + m.setPlaybackCompletionDate(new Date(i + 1)); adapter.setFeedMediaPlaybackCompletionDate(m); ids[ids.length - 1 - i] = m.getItem().getId(); } |