From 5ca831dc33dfa16821647e14e377c484df823c80 Mon Sep 17 00:00:00 2001 From: Zheng Fu Date: Tue, 7 Jul 2015 15:25:28 -0700 Subject: Fix bug in aggregation suggestions in new contacts aggregator. New contact aggregator is using rawContactsMatcher, which is keyed by rawContactId instead of contactId. So we need to remove bestMatches with duplicate contactId for calculating the aggregation suggestions. Bug:22224442 Change-Id: I9e77400a5b09ec28d5bc120706cd4dfe2e296d56 --- .../contacts/aggregation/ContactAggregator2Test.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tests/src/com/android/providers/contacts/aggregation/ContactAggregator2Test.java') diff --git a/tests/src/com/android/providers/contacts/aggregation/ContactAggregator2Test.java b/tests/src/com/android/providers/contacts/aggregation/ContactAggregator2Test.java index 53e63cb0..ac64cacf 100644 --- a/tests/src/com/android/providers/contacts/aggregation/ContactAggregator2Test.java +++ b/tests/src/com/android/providers/contacts/aggregation/ContactAggregator2Test.java @@ -916,14 +916,15 @@ public class ContactAggregator2Test extends BaseContactsProvider2Test { } public void testAggregationSuggestionsBasedOnName() { + // Exact name match contact with two raw contacts long rawContactId1 = RawContactUtil.createRawContact(mResolver); DataUtil.insertStructuredName(mResolver, rawContactId1, "Duane", null); + insertPhoneNumber(rawContactId1, "(888)555-1236"); - // Exact name match + // Exact name match contact with two raw contacts long rawContactId2 = RawContactUtil.createRawContact(mResolver); DataUtil.insertStructuredName(mResolver, rawContactId2, "Duane", null); - setAggregationException(AggregationExceptions.TYPE_KEEP_SEPARATE, - rawContactId1, rawContactId2); + insertPhoneNumber(rawContactId2, "(888)555-1236"); // Edit distance == 0.84 long rawContactId3 = RawContactUtil.createRawContact(mResolver); @@ -933,11 +934,15 @@ public class ContactAggregator2Test extends BaseContactsProvider2Test { long rawContactId4 = RawContactUtil.createRawContact(mResolver); DataUtil.insertStructuredName(mResolver, rawContactId4, "Donny", null); + long rawContactId5 = RawContactUtil.createRawContact(mResolver); + DataUtil.insertStructuredName(mResolver, rawContactId5, "Duane", null); + long contactId1 = queryContactId(rawContactId1); long contactId2 = queryContactId(rawContactId2); long contactId3 = queryContactId(rawContactId3); - assertSuggestions(contactId1, contactId2, contactId3); + assertEquals(contactId1, contactId2); + assertSuggestions(queryContactId(rawContactId5), contactId1, contactId3); } public void testAggregationSuggestionsBasedOnPhoneNumber() { -- cgit v1.2.3