diff options
author | Makoto Onuki <omakoto@google.com> | 2012-06-15 15:52:47 -0700 |
---|---|---|
committer | Makoto Onuki <omakoto@google.com> | 2012-06-15 15:56:27 -0700 |
commit | 4c3a04572ead6ad9f0cfc20a34db3252fdb31201 (patch) | |
tree | 9de92177afc9874daa3ffcb761de83de1ae78775 /tests | |
parent | f70a7ec9de84f09f5fc71e656f8419af5a925940 (diff) | |
download | packages_providers_ContactsProvider-4c3a04572ead6ad9f0cfc20a34db3252fdb31201.zip packages_providers_ContactsProvider-4c3a04572ead6ad9f0cfc20a34db3252fdb31201.tar.gz packages_providers_ContactsProvider-4c3a04572ead6ad9f0cfc20a34db3252fdb31201.tar.bz2 |
Support new query parameters introduced in Iaab5c38a
The new query parameters controls which field hone.CONTENT_FILTER_URI should
search.
Bug 6662259
Change-Id: I6f4cb4439dc4414cb96cf6a9fc66d0758ddf9faa
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/providers/contacts/ContactsProvider2Test.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java index aa34b1a..5706925 100644 --- a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java +++ b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java @@ -1172,6 +1172,41 @@ public class ContactsProvider2Test extends BaseContactsProvider2Test { assertStoredValues(filterUri6, new ContentValues[] {values1, values2, values3} ); } + public void testPhonesFilterSearchParams() { + final long rid1 = createRawContactWithName("Dad", null); + insertPhoneNumber(rid1, "123-456-7890"); + + final long rid2 = createRawContactWithName("Mam", null); + insertPhoneNumber(rid2, "323-123-4567"); + + // By default, "dad" will match both the display name and the phone number. + // Because "dad" is "323" after the dialpad conversion, it'll match "Mam" too. + assertStoredValues( + Phone.CONTENT_FILTER_URI.buildUpon().appendPath("dad").build(), + cv(Phone.DISPLAY_NAME, "Dad", Phone.NUMBER, "123-456-7890"), + cv(Phone.DISPLAY_NAME, "Mam", Phone.NUMBER, "323-123-4567") + ); + assertStoredValues( + Phone.CONTENT_FILTER_URI.buildUpon().appendPath("dad") + .appendQueryParameter(Phone.SEARCH_PHONE_NUMBER_KEY, "0") + .build(), + cv(Phone.DISPLAY_NAME, "Dad", Phone.NUMBER, "123-456-7890") + ); + + assertStoredValues( + Phone.CONTENT_FILTER_URI.buildUpon().appendPath("dad") + .appendQueryParameter(Phone.SEARCH_DISPLAY_NAME_KEY, "0") + .build(), + cv(Phone.DISPLAY_NAME, "Mam", Phone.NUMBER, "323-123-4567") + ); + assertStoredValues( + Phone.CONTENT_FILTER_URI.buildUpon().appendPath("dad") + .appendQueryParameter(Phone.SEARCH_DISPLAY_NAME_KEY, "0") + .appendQueryParameter(Phone.SEARCH_PHONE_NUMBER_KEY, "0") + .build() + ); + } + public void testPhoneLookup() { ContentValues values = new ContentValues(); values.put(RawContacts.CUSTOM_RINGTONE, "d"); |