Using collator for string matching
This provides a better matching for non-latin characters on N and above Bug: 63763127 Change-Id: I220487d242ff547311ddd13e7af380a7e47eec0e
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user