Make sort order in feed list case-insensitive. closes issue #339
This commit is contained in:
parent
5cabac4691
commit
fa1789b7dc
@ -711,7 +711,7 @@ public class PodDBAdapter {
|
|||||||
*/
|
*/
|
||||||
public final Cursor getAllFeedsCursor() {
|
public final Cursor getAllFeedsCursor() {
|
||||||
Cursor c = db.query(TABLE_NAME_FEEDS, FEED_SEL_STD, null, null, null, null,
|
Cursor c = db.query(TABLE_NAME_FEEDS, FEED_SEL_STD, null, null, null, null,
|
||||||
KEY_TITLE + " ASC");
|
KEY_TITLE + " COLLATE NOCASE ASC");
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,9 +7,13 @@ import de.danoeh.antennapod.feed.FeedItem;
|
|||||||
import de.danoeh.antennapod.feed.FeedMedia;
|
import de.danoeh.antennapod.feed.FeedMedia;
|
||||||
import de.danoeh.antennapod.storage.DBReader;
|
import de.danoeh.antennapod.storage.DBReader;
|
||||||
import de.danoeh.antennapod.storage.PodDBAdapter;
|
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
|
* Test class for DBReader
|
||||||
@ -66,7 +70,6 @@ public class DBReaderTest extends InstrumentationTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void testGetFeedList() {
|
public void testGetFeedList() {
|
||||||
final Context context = getInstrumentation().getTargetContext();
|
final Context context = getInstrumentation().getTargetContext();
|
||||||
List<Feed> feeds = saveFeedlist(context, 10, 0, false);
|
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() {
|
public void testFeedListDownloadUrls() {
|
||||||
final Context context = getInstrumentation().getTargetContext();
|
final Context context = getInstrumentation().getTargetContext();
|
||||||
List<Feed> feeds = saveFeedlist(context, 10, 0, false);
|
List<Feed> feeds = saveFeedlist(context, 10, 0, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user