diff options
| author | Scott Kennedy <skennedy@google.com> | 2013-11-21 14:31:33 -0800 |
|---|---|---|
| committer | Scott Kennedy <skennedy@google.com> | 2014-02-05 21:33:37 -0800 |
| commit | 7a4e67708498ec46c2e9b3bad69d3807d88c064e (patch) | |
| tree | d108d244a3740f62912bd62cad9527704884f8f9 /tests | |
| parent | 53e718a52258e2240ed82faaee0ecef05fe112a0 (diff) | |
| download | android_frameworks_opt_chips-7a4e67708498ec46c2e9b3bad69d3807d88c064e.tar.gz android_frameworks_opt_chips-7a4e67708498ec46c2e9b3bad69d3807d88c064e.tar.bz2 android_frameworks_opt_chips-7a4e67708498ec46c2e9b3bad69d3807d88c064e.zip | |
Fix directory lookups
The previous "fix" disabled the lookups.
Now we will do the lookups, with the proper lookup key and
directory id. We also do a much better job of showing directory
images.
Bug: 11693322
Bug: 12793279
Change-Id: I372711fd7b485f3183516fce2b11f9eff46a9b23
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/src/com/android/ex/chips/RecipientAlternatesAdapterTest.java | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/tests/src/com/android/ex/chips/RecipientAlternatesAdapterTest.java b/tests/src/com/android/ex/chips/RecipientAlternatesAdapterTest.java index d4c0460..afb6a00 100644 --- a/tests/src/com/android/ex/chips/RecipientAlternatesAdapterTest.java +++ b/tests/src/com/android/ex/chips/RecipientAlternatesAdapterTest.java @@ -27,25 +27,28 @@ import com.android.ex.chips.RecipientEntry; public class RecipientAlternatesAdapterTest extends AndroidTestCase { - public void testRemoveDuplicateDestinations() { + public void testRemoveUndesiredDestinations() { MatrixCursor c = new MatrixCursor(Queries.EMAIL.getProjection()); Cursor result; // Test: Empty input - assertEquals(0, RecipientAlternatesAdapter.removeDuplicateDestinations(c).getCount()); + assertEquals(0, RecipientAlternatesAdapter.removeUndesiredDestinations(c, + null /* desiredMimeType */, null /* lookupKey */).getCount()); // Test: One row addRow(c, "a", "1@android.com", 1, "home", 1000, 2000, "x", 0); - result = RecipientAlternatesAdapter.removeDuplicateDestinations(c); + result = RecipientAlternatesAdapter.removeUndesiredDestinations(c, + null /* desiredMimeType */, null /* lookupKey */); assertEquals(1, result.getCount()); assertRow(result, 0, "a", "1@android.com", 1, "home", 1000, 2000, "x", 0); // Test: two unique rows, different destinations addRow(c, "a", "2@android.com", 1, "home", 1000, 2000, "x", 0); - result = RecipientAlternatesAdapter.removeDuplicateDestinations(c); + result = RecipientAlternatesAdapter.removeUndesiredDestinations(c, + null /* desiredMimeType */, null /* lookupKey */); assertEquals(2, result.getCount()); assertRow(result, 0, "a", "1@android.com", 1, "home", 1000, 2000, "x", 0); assertRow(result, 1, "a", "2@android.com", 1, "home", 1000, 2000, "x", 0); @@ -54,7 +57,8 @@ public class RecipientAlternatesAdapterTest extends AndroidTestCase { addRow(c, "ax", "1@android.com", 11, "homex", 10001, 2000, "xx", 1); // Third row should be removed. - result = RecipientAlternatesAdapter.removeDuplicateDestinations(c); + result = RecipientAlternatesAdapter.removeUndesiredDestinations(c, + null /* desiredMimeType */, null /* lookupKey */); assertEquals(2, result.getCount()); assertRow(result, 0, "a", "1@android.com", 1, "home", 1000, 2000, "x", 0); assertRow(result, 1, "a", "2@android.com", 1, "home", 1000, 2000, "x", 0); @@ -63,7 +67,8 @@ public class RecipientAlternatesAdapterTest extends AndroidTestCase { addRow(c, "ax", "2@android.com", 11, "homex", 10001, 2000, "xx", 1); // Forth row should also be removed. - result = RecipientAlternatesAdapter.removeDuplicateDestinations(c); + result = RecipientAlternatesAdapter.removeUndesiredDestinations(c, + null /* desiredMimeType */, null /* lookupKey */); assertEquals(2, result.getCount()); assertRow(result, 0, "a", "1@android.com", 1, "home", 1000, 2000, "x", 0); assertRow(result, 1, "a", "2@android.com", 1, "home", 1000, 2000, "x", 0); @@ -120,8 +125,8 @@ public class RecipientAlternatesAdapterTest extends AndroidTestCase { { final RecipientEntry entry1 = RecipientEntry.constructTopLevelEntry("Android", DisplayNameSources.NICKNAME, - "1@android.com", 0, null, 0, 0, (Uri) null, true, - false /* isGalContact */); + "1@android.com", 0, null, 0, null /* directoryId */, 0, (Uri) null, + true, null /* lookupKey */); final RecipientEntry entry2 = RecipientEntry.constructFakeEntry("1@android.com", true); assertEquals(RecipientAlternatesAdapter.getBetterRecipient(entry1, entry2), entry1); @@ -133,12 +138,12 @@ public class RecipientAlternatesAdapterTest extends AndroidTestCase { { final RecipientEntry entry1 = RecipientEntry.constructTopLevelEntry("Android", DisplayNameSources.NICKNAME, - "1@android.com", 0, null, 0, 0, (Uri) null, true, - false /* isGalContact */); + "1@android.com", 0, null, 0, null /* directoryId */, 0, (Uri) null, + true, null /* lookupKey */); final RecipientEntry entry2 = RecipientEntry.constructTopLevelEntry("2@android.com", DisplayNameSources.EMAIL, - "2@android.com", 0, null, 0, 0, (Uri) null, true, - false /* isGalContact */); + "2@android.com", 0, null, 0, null /* directoryId */, 0, (Uri) null, + true, null /* lookupKey */); assertEquals(RecipientAlternatesAdapter.getBetterRecipient(entry1, entry2), entry1); assertEquals(RecipientAlternatesAdapter.getBetterRecipient(entry2, entry1), entry1); @@ -148,12 +153,12 @@ public class RecipientAlternatesAdapterTest extends AndroidTestCase { { final RecipientEntry entry1 = RecipientEntry.constructTopLevelEntry("Android", DisplayNameSources.NICKNAME, - "1@android.com", 0, null, 0, 0, Uri.parse("http://www.android.com"), - true, false /* isGalContact */); + "1@android.com", 0, null, 0, null /* directoryId */, 0, + Uri.parse("http://www.android.com"), true, null /* lookupKey */); final RecipientEntry entry2 = RecipientEntry.constructTopLevelEntry("Android", DisplayNameSources.EMAIL, - "2@android.com", 0, null, 0, 0, (Uri) null, true, - false /* isGalContact */); + "2@android.com", 0, null, 0, null /* directoryId */, + 0, (Uri) null, true, null /* lookupKey */); assertEquals(RecipientAlternatesAdapter.getBetterRecipient(entry1, entry2), entry1); assertEquals(RecipientAlternatesAdapter.getBetterRecipient(entry2, entry1), entry1); |
