From 69ae7985ce26709b0acd9c376c751b8fb0ba4528 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Thu, 21 Mar 2013 18:22:18 -0700 Subject: Fix name matching bug with non space separators Bug: 8435819 Change-Id: I69c32207d123e5da4ae5421a5fe83ffeee4e5070 --- .../dialer/dialpad/SmartDialNameMatcherTest.java | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'tests/src/com/android') diff --git a/tests/src/com/android/dialer/dialpad/SmartDialNameMatcherTest.java b/tests/src/com/android/dialer/dialpad/SmartDialNameMatcherTest.java index 8b7ee03f6..08939b48e 100644 --- a/tests/src/com/android/dialer/dialpad/SmartDialNameMatcherTest.java +++ b/tests/src/com/android/dialer/dialpad/SmartDialNameMatcherTest.java @@ -80,8 +80,19 @@ public class SmartDialNameMatcherTest extends TestCase { checkMatches("William John Smith", "5764", true, 15, 16, 22, 25); } - // TODO: Do we want to make these pass anymore? - @Suppress + public void testMatches_InitialWithSeparator() { + // wjs matches (W)illiam (J)ohn (S)mith + checkMatches("William John-Smith", "957", true, 0, 1, 8, 9, 13, 14); + // wjsmit matches (W)illiam (J)ohn-(OShe)a + checkMatches("William John-O'Shea", "956743", true, 0, 1, 8, 9, 13, 18); + // wjohn matches (W)illiam-(John) Smith + checkMatches("William-John Smith", "95646", true, 0, 1, 8, 12); + // jsmi matches William (J)ohn-(Smi)th + checkMatches("William John-Smith", "5764", true, 8, 9, 13, 16); + // make sure multiple spaces don't mess things up + checkMatches("William John---Smith", "5764", true, 15, 16, 22, 25); + } + public void testMatches_repeatedSeparators() { // Simple match for single token checkMatches("John,,,,,Doe", "5646", true, 0, 4); @@ -91,6 +102,15 @@ public class SmartDialNameMatcherTest extends TestCase { checkMatches("John,,,,,Doe", "363", true, 9, 12); } + public void testMatches_LatinMix() { + // Latin + Chinese characters + checkMatches("Lee王力Wang宏", "59264", true, 0, 1, 5, 9); + // Latin + Japanese characters + checkMatches("千Abcd佳智Efgh佳IJKL", "222333444555", true, 1, 16); + // Latin + Arabic characters + checkMatches("Peterعبد الرحمنJames", "752637", true, 0, 1, 15, 20); + } + public void testMatches_umlaut() { checkMatches("ÄÖÜäöü", "268268", true, 0, 6); } -- cgit v1.2.3