summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-03-21 18:22:18 -0700
committerYorke Lee <yorkelee@google.com>2013-04-08 11:56:03 -0700
commit69ae7985ce26709b0acd9c376c751b8fb0ba4528 (patch)
tree7f8e4a06e6bd13fd386d104c63d089aeaef64c68 /tests
parentf5bc56a398b20eed03df82f5dacd86aebc35d954 (diff)
Fix name matching bug with non space separators
Bug: 8435819 Change-Id: I69c32207d123e5da4ae5421a5fe83ffeee4e5070
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/dialer/dialpad/SmartDialNameMatcherTest.java24
1 files changed, 22 insertions, 2 deletions
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);
}