summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-04-08 22:29:35 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-04-08 22:29:35 +0000
commit4334d3b852e369b591f591e66e493cc92a721233 (patch)
tree0d3050918c988d3af37284338f33b3a856c9a50a /tests
parente9d94e6a112b119d8ca895e0b7e8c82655eaa9a7 (diff)
parent69ae7985ce26709b0acd9c376c751b8fb0ba4528 (diff)
downloadandroid_packages_apps_Dialer-4334d3b852e369b591f591e66e493cc92a721233.tar.gz
android_packages_apps_Dialer-4334d3b852e369b591f591e66e493cc92a721233.tar.bz2
android_packages_apps_Dialer-4334d3b852e369b591f591e66e493cc92a721233.zip
Merge "Fix name matching bug with non space separators" into jb-mr2-dev
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);
}