From 05d2df1678bfba02c2fbc54ce03229f45b0308cd Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Tue, 18 Jul 2017 01:22:01 -0700 Subject: Using collator for string matching This provides a better matching for non-latin characters on N and above Bug: 63763127 Change-Id: I220487d242ff547311ddd13e7af380a7e47eec0e --- .../search/DefaultAppSearchAlgorithmTest.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/src/com/android/launcher3/allapps') diff --git a/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java b/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java index 58dc0c43e..26ec69b1c 100644 --- a/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java +++ b/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java @@ -19,6 +19,7 @@ import android.content.ComponentName; import android.test.InstrumentationTestCase; import com.android.launcher3.AppInfo; +import com.android.launcher3.Utilities; import java.util.ArrayList; import java.util.List; @@ -75,6 +76,25 @@ public class DefaultAppSearchAlgorithmTest extends InstrumentationTestCase { assertTrue(mAlgorithm.matches(getInfo("电子邮件"), "电子")); assertFalse(mAlgorithm.matches(getInfo("电子邮件"), "子")); assertFalse(mAlgorithm.matches(getInfo("电子邮件"), "邮件")); + + assertFalse(mAlgorithm.matches(getInfo("Bot"), "ba")); + assertFalse(mAlgorithm.matches(getInfo("bot"), "ba")); + } + + public void testMatchesVN() { + if (!Utilities.ATLEAST_NOUGAT) { + return; + } + assertTrue(mAlgorithm.matches(getInfo("다운로드"), "다")); + assertTrue(mAlgorithm.matches(getInfo("드라이브"), "드")); + assertTrue(mAlgorithm.matches(getInfo("다운로드 드라이브"), "ㄷ")); + assertTrue(mAlgorithm.matches(getInfo("운로 드라이브"), "ㄷ")); + assertTrue(mAlgorithm.matches(getInfo("abc"), "åbç")); + assertTrue(mAlgorithm.matches(getInfo("Alpha"), "ål")); + + assertFalse(mAlgorithm.matches(getInfo("다운로드 드라이브"), "ㄷㄷ")); + assertFalse(mAlgorithm.matches(getInfo("로드라이브"), "ㄷ")); + assertFalse(mAlgorithm.matches(getInfo("abc"), "åç")); } private AppInfo getInfo(String title) { -- cgit v1.2.3