diff options
-rw-r--r-- | src/de/danoeh/antennapod/storage/PodDBAdapter.java | 2 | ||||
-rw-r--r-- | src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/de/danoeh/antennapod/storage/PodDBAdapter.java b/src/de/danoeh/antennapod/storage/PodDBAdapter.java index 738ccbf50..b44883744 100644 --- a/src/de/danoeh/antennapod/storage/PodDBAdapter.java +++ b/src/de/danoeh/antennapod/storage/PodDBAdapter.java @@ -1199,7 +1199,7 @@ public class PodDBAdapter { " COUNT(CASE WHEN position>0 THEN 1 END) AS in_progress," + " COUNT(CASE WHEN downloaded=1 THEN 1 END) AS episodes_downloaded " + " FROM FeedItems LEFT JOIN FeedMedia ON FeedItems.id=FeedMedia.feeditem GROUP BY FeedItems.feed)" + - " ON Feeds.id = feed ORDER BY Feeds.title;"; + " ON Feeds.id = feed ORDER BY Feeds.title COLLATE NOCASE ASC;"; public Cursor getFeedStatisticsCursor() { return db.rawQuery(FEED_STATISTICS_QUERY, null); diff --git a/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java b/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java index 78fe3b701..b03d83d25 100644 --- a/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java +++ b/src/instrumentationTest/de/test/antennapod/storage/DBReaderTest.java @@ -6,6 +6,7 @@ import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.storage.DBReader; +import de.danoeh.antennapod.storage.FeedItemStatistics; import de.danoeh.antennapod.storage.PodDBAdapter; import de.danoeh.antennapod.util.flattr.FlattrStatus; import static instrumentationTest.de.test.antennapod.storage.DBTestUtils.*; @@ -351,4 +352,17 @@ public class DBReaderTest extends InstrumentationTestCase { assertEquals("Wrong sort order: ", item.getId(), ids[i]); } } + + public void testGetFeedStatisticsCheckOrder() { + 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, false); + List<FeedItemStatistics> statistics = DBReader.getFeedStatisticsList(context); + assertNotNull(statistics); + assertEquals(feeds.size(), statistics.size()); + for (int i = 0; i < NUM_FEEDS; i++) { + assertEquals("Wrong entry at index " + i, feeds.get(i).getId(), statistics.get(i).getFeedID()); + } + } } |