diff options
author | Daisuke Miyakawa <dmiyakawa@google.com> | 2011-08-25 14:14:10 -0700 |
---|---|---|
committer | Daisuke Miyakawa <dmiyakawa@google.com> | 2011-08-25 14:20:51 -0700 |
commit | cf55cbe8932f620484a3634d13ecc116c32fdc99 (patch) | |
tree | 9f643bf944182010568b9d6d08c49f967e22a589 /tests | |
parent | 518eb86edafbd4d8cd69a9452461baddc2a4aaae (diff) | |
download | packages_providers_ContactsProvider-cf55cbe8932f620484a3634d13ecc116c32fdc99.zip packages_providers_ContactsProvider-cf55cbe8932f620484a3634d13ecc116c32fdc99.tar.gz packages_providers_ContactsProvider-cf55cbe8932f620484a3634d13ecc116c32fdc99.tar.bz2 |
Group rows with a same phone number and a contact id.
Bug: 5201809
Change-Id: Ie21abb12736715358dd33bc690269f51ae1e0944
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/providers/contacts/ContactsProvider2Test.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java index e14e21c..fd4e188 100644 --- a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java +++ b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java @@ -891,6 +891,32 @@ public class ContactsProvider2Test extends BaseContactsProvider2Test { assertSelection(Phone.CONTENT_URI, values, Data._ID, phoneId); } + public void testPhonesWithMergedContacts() { + long rawContactId1 = createRawContact(); + insertPhoneNumber(rawContactId1, "123456789", true); + + long rawContactId2 = createRawContact(); + insertPhoneNumber(rawContactId2, "123456789", true); + + ContentValues values1 = new ContentValues(); + values1.put(Contacts.DISPLAY_NAME, "123456789"); + values1.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE); + values1.put(Phone.NUMBER, "123456789"); + + // Two results should come, since they are separate entries anyway. + assertStoredValues(Phone.CONTENT_URI, new ContentValues[] {values1, values1}); + + setAggregationException(AggregationExceptions.TYPE_KEEP_TOGETHER, + rawContactId1, rawContactId2); + + assertAggregated(rawContactId1, rawContactId2, "123456789"); + + // Just one result should come, since + // - those two numbers have the same phone number + // - those two contacts are aggregated + assertStoredValues(Phone.CONTENT_URI, values1); + } + public void testPhonesFilterQuery() { long rawContactId1 = createRawContactWithName("Hot", "Tamale", ACCOUNT_1); insertPhoneNumber(rawContactId1, "1-800-466-4411"); |