diff options
author | Dmitri Plotnikov <dplotnikov@google.com> | 2009-10-05 14:51:49 -0700 |
---|---|---|
committer | Dmitri Plotnikov <dplotnikov@google.com> | 2009-10-05 14:51:55 -0700 |
commit | dd0e0f44fe403ff201d46d5534f7f1148e5ad729 (patch) | |
tree | 3a568cf70479288873cc4caead181a539259264b /tests | |
parent | f8b937f62fb80445bf59b2e504d765bcab746557 (diff) | |
download | ContactsProvider-dd0e0f44fe403ff201d46d5534f7f1148e5ad729.tar.gz |
[Issue 2160728] Fixing full name update when parts of structured name are deleted
Change-Id: I3a206a4cfb09be590bf96476d128791129263742
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 5873f207..295e7235 100644 --- a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java +++ b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java @@ -643,6 +643,32 @@ public class ContactsProvider2Test extends BaseContactsProvider2Test { assertStoredValue(uri, Contacts.DISPLAY_NAME, "James Sullivan"); } + public void testDisplayNameUpdateFromStructuredNameUpdate() { + long rawContactId = createRawContact(); + Uri nameUri = insertStructuredName(rawContactId, "Slinky", "Dog"); + + long contactId = queryContactId(rawContactId); + + Uri uri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId); + assertStoredValue(uri, Contacts.DISPLAY_NAME, "Slinky Dog"); + + ContentValues values = new ContentValues(); + values.putNull(StructuredName.FAMILY_NAME); + + mResolver.update(nameUri, values, null, null); + assertStoredValue(uri, Contacts.DISPLAY_NAME, "Slinky"); + + values.putNull(StructuredName.GIVEN_NAME); + + mResolver.update(nameUri, values, null, null); + assertStoredValue(uri, Contacts.DISPLAY_NAME, null); + + values.put(StructuredName.FAMILY_NAME, "Dog"); + mResolver.update(nameUri, values, null, null); + + assertStoredValue(uri, Contacts.DISPLAY_NAME, "Dog"); + } + public void testSendToVoicemailDefault() { long rawContactId = createRawContactWithName(); long contactId = queryContactId(rawContactId); |