diff options
author | Chiao Cheng <chiaocheng@google.com> | 2012-09-13 13:06:23 -0700 |
---|---|---|
committer | Chiao Cheng <chiaocheng@google.com> | 2013-01-15 11:37:55 -0800 |
commit | 44cfc56d1701629070384364416c1311b780535d (patch) | |
tree | dc1241fe3278e431acb14b734f8d94526b614b4a /tests | |
parent | d683b541718154aa73ce3a304acd2cd3665a6737 (diff) | |
download | packages_apps_Contacts-44cfc56d1701629070384364416c1311b780535d.tar.gz packages_apps_Contacts-44cfc56d1701629070384364416c1311b780535d.tar.bz2 packages_apps_Contacts-44cfc56d1701629070384364416c1311b780535d.zip |
Allow read-only contacts to be editable.
- Automatically create new raw contact when editing a read-only contact.
- Refactored mState to be always initialized.
- Allow RawContactDeltaList to be instantiated with empty constructor.
Bug: 6406182
Change-Id: I7a58625485dae6957b4f9bcc446122f54551afa1
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/contacts/RawContactDeltaListTests.java | 7 | ||||
-rw-r--r-- | tests/src/com/android/contacts/RawContactModifierTests.java | 13 |
2 files changed, 12 insertions, 8 deletions
diff --git a/tests/src/com/android/contacts/RawContactDeltaListTests.java b/tests/src/com/android/contacts/RawContactDeltaListTests.java index a8c445b88..6a75b818a 100644 --- a/tests/src/com/android/contacts/RawContactDeltaListTests.java +++ b/tests/src/com/android/contacts/RawContactDeltaListTests.java @@ -45,6 +45,7 @@ import com.google.common.collect.Lists; import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Collections; /** * Tests for {@link RawContactDeltaList} which focus on "diff" operations that should @@ -112,10 +113,8 @@ public class RawContactDeltaListTests extends AndroidTestCase { } static RawContactDeltaList buildSet(RawContactDelta... deltas) { - final RawContactDeltaList set = RawContactDeltaList.fromSingle(deltas[0]); - for (int i = 1; i < deltas.length; i++) { - set.add(deltas[i]); - } + final RawContactDeltaList set = new RawContactDeltaList(); + Collections.addAll(set, deltas); return set; } diff --git a/tests/src/com/android/contacts/RawContactModifierTests.java b/tests/src/com/android/contacts/RawContactModifierTests.java index 91358ca37..ce69b55bc 100644 --- a/tests/src/com/android/contacts/RawContactModifierTests.java +++ b/tests/src/com/android/contacts/RawContactModifierTests.java @@ -521,7 +521,9 @@ public class RawContactModifierTests extends AndroidTestCase { // Try creating a contact without any child entries final RawContactDelta state = getRawContact(null); - final RawContactDeltaList set = RawContactDeltaList.fromSingle(state); + final RawContactDeltaList set = new RawContactDeltaList(); + set.add(state); + // Build diff, expecting single insert final ArrayList<ContentProviderOperation> diff = Lists.newArrayList(); @@ -549,7 +551,8 @@ public class RawContactModifierTests extends AndroidTestCase { // Try creating a contact with single empty entry final RawContactDelta state = getRawContact(null); RawContactModifier.insertChild(state, kindPhone, typeHome); - final RawContactDeltaList set = RawContactDeltaList.fromSingle(state); + final RawContactDeltaList set = new RawContactDeltaList(); + set.add(state); // Build diff, expecting two insert operations final ArrayList<ContentProviderOperation> diff = Lists.newArrayList(); @@ -593,7 +596,8 @@ public class RawContactModifierTests extends AndroidTestCase { second.put(Phone.NUMBER, TEST_PHONE); final RawContactDelta state = getRawContact(TEST_ID, first, second); - final RawContactDeltaList set = RawContactDeltaList.fromSingle(state); + final RawContactDeltaList set = new RawContactDeltaList(); + set.add(state); // Build diff, expecting no changes final ArrayList<ContentProviderOperation> diff = Lists.newArrayList(); @@ -658,7 +662,8 @@ public class RawContactModifierTests extends AndroidTestCase { first.put(Phone.NUMBER, TEST_PHONE); final RawContactDelta state = getRawContact(TEST_ID, first); - final RawContactDeltaList set = RawContactDeltaList.fromSingle(state); + final RawContactDeltaList set = new RawContactDeltaList(); + set.add(state); // Build diff, expecting no changes final ArrayList<ContentProviderOperation> diff = Lists.newArrayList(); |