mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-06-22 14:50:24 -04:00
Be more explicit about searching categories with free form text.
This commit is contained in:
@@ -38,6 +38,33 @@ public class CategoryProviderTest extends FDroidProviderTest {
|
||||
// use a separate table in the future, these should still pass.
|
||||
// ========================================================================
|
||||
|
||||
@Test
|
||||
public void queryFreeTextAndCategories() {
|
||||
insertAppWithCategory("com.dog", "Dog", "Animal");
|
||||
insertAppWithCategory("com.cat", "Cat", "Animal");
|
||||
insertAppWithCategory("com.crow", "Crow", "Animal,Bird");
|
||||
insertAppWithCategory("com.chicken", "Chicken", "Animal,Bird,Food");
|
||||
insertAppWithCategory("com.dog-statue", "Dog Statue", "Animal,Mineral");
|
||||
insertAppWithCategory("com.rock", "Rock", "Mineral");
|
||||
insertAppWithCategory("com.banana", "Banana", "Food");
|
||||
insertAppWithCategory("com.dog-food", "Dog Food", "Food");
|
||||
|
||||
assertPackagesInUri(AppProvider.getSearchUri("dog", "Animal"), new String[] {
|
||||
"com.dog",
|
||||
"com.dog-statue",
|
||||
});
|
||||
|
||||
assertPackagesInUri(AppProvider.getSearchUri("dog", "Food"), new String[] {
|
||||
"com.dog-food",
|
||||
});
|
||||
|
||||
assertPackagesInUri(AppProvider.getSearchUri("dog", null), new String[] {
|
||||
"com.dog",
|
||||
"com.dog-statue",
|
||||
"com.dog-food",
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryAppsInCategories() {
|
||||
insertAppWithCategory("com.dog", "Dog", "Animal");
|
||||
|
||||
@@ -84,10 +84,15 @@ public class ProviderUriTests {
|
||||
ShadowContentResolver.registerProvider(AppProvider.getAuthority(), new AppProvider());
|
||||
String[] projection = new String[] {Schema.AppMetadataTable.Cols._ID};
|
||||
assertValidUri(resolver, AppProvider.getContentUri(), "content://org.fdroid.fdroid.data.AppProvider", projection);
|
||||
assertValidUri(resolver, AppProvider.getSearchUri("'searching!'"), "content://org.fdroid.fdroid.data.AppProvider/search/'searching!'", projection);
|
||||
assertValidUri(resolver, AppProvider.getSearchUri("/"), "content://org.fdroid.fdroid.data.AppProvider/search/%2F", projection);
|
||||
assertValidUri(resolver, AppProvider.getSearchUri(""), "content://org.fdroid.fdroid.data.AppProvider", projection);
|
||||
assertValidUri(resolver, AppProvider.getSearchUri(null), "content://org.fdroid.fdroid.data.AppProvider", projection);
|
||||
assertValidUri(resolver, AppProvider.getSearchUri("'searching!'", null), "content://org.fdroid.fdroid.data.AppProvider/search/'searching!'", projection);
|
||||
assertValidUri(resolver, AppProvider.getSearchUri("'searching!'", "Games"), "content://org.fdroid.fdroid.data.AppProvider/search/'searching!'/Games", projection);
|
||||
assertValidUri(resolver, AppProvider.getSearchUri("/", null), "content://org.fdroid.fdroid.data.AppProvider/search/%2F", projection);
|
||||
assertValidUri(resolver, AppProvider.getSearchUri("/", "Games"), "content://org.fdroid.fdroid.data.AppProvider/search/%2F/Games", projection);
|
||||
assertValidUri(resolver, AppProvider.getSearchUri("", null), "content://org.fdroid.fdroid.data.AppProvider", projection);
|
||||
assertValidUri(resolver, AppProvider.getCategoryUri("Games"), "content://org.fdroid.fdroid.data.AppProvider/category/Games", projection);
|
||||
assertValidUri(resolver, AppProvider.getSearchUri("", "Games"), "content://org.fdroid.fdroid.data.AppProvider/category/Games", projection);
|
||||
assertValidUri(resolver, AppProvider.getSearchUri((String) null, null), "content://org.fdroid.fdroid.data.AppProvider", projection);
|
||||
assertValidUri(resolver, AppProvider.getSearchUri((String) null, "Games"), "content://org.fdroid.fdroid.data.AppProvider/category/Games", projection);
|
||||
assertValidUri(resolver, AppProvider.getInstalledUri(), "content://org.fdroid.fdroid.data.AppProvider/installed", projection);
|
||||
assertValidUri(resolver, AppProvider.getCanUpdateUri(), "content://org.fdroid.fdroid.data.AppProvider/canUpdate", projection);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user