diff options
author | 2014-06-06 10:47:10 +0000 | |
---|---|---|
committer | 2014-06-06 10:47:10 +0000 | |
commit | ab74fd6db773b342283a1bd6093a6b7d2be52d72 (patch) | |
tree | 66a181b13c8efd95f34fd9aa13b3c26dfc68f04a /tests/src | |
parent | 7950d2358e958ff7879edcbddd9b3b3ecd4fe0f4 (diff) | |
parent | 7640bb15054a84e9c2f044bd90e1a6ee429b3325 (diff) | |
download | latinime-ab74fd6db773b342283a1bd6093a6b7d2be52d72.tar.gz latinime-ab74fd6db773b342283a1bd6093a6b7d2be52d72.tar.xz latinime-ab74fd6db773b342283a1bd6093a6b7d2be52d72.zip |
am 7640bb15: Merge "Make Distracter filter use getMaxFrequencyOfExactMatches()."
* commit '7640bb15054a84e9c2f044bd90e1a6ee429b3325':
Make Distracter filter use getMaxFrequencyOfExactMatches().
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/DistracterFilterTest.java | 65 |
1 files changed, 54 insertions, 11 deletions
diff --git a/tests/src/com/android/inputmethod/latin/DistracterFilterTest.java b/tests/src/com/android/inputmethod/latin/DistracterFilterTest.java index 406e9a9b8..b7f2271be 100644 --- a/tests/src/com/android/inputmethod/latin/DistracterFilterTest.java +++ b/tests/src/com/android/inputmethod/latin/DistracterFilterTest.java @@ -42,11 +42,6 @@ public class DistracterFilterTest extends InputTestsBase { final Locale localeEnUs = new Locale("en", "US"); String typedWord; - typedWord = "google"; - // For this test case, we consider "google" is a distracter to "Google". - assertTrue(mDistracterFilter.isDistracterToWordsInDictionaries( - EMPTY_PREV_WORDS_INFO, typedWord, localeEnUs)); - typedWord = "Bill"; // For this test case, we consider "Bill" is a distracter to "bill". assertTrue(mDistracterFilter.isDistracterToWordsInDictionaries( @@ -83,15 +78,20 @@ public class DistracterFilterTest extends InputTestsBase { EMPTY_PREV_WORDS_INFO, typedWord, localeEnUs)); typedWord = "cafe"; - // For this test case, we consider "café" is not a distracter to any word in dictionaries. + // For this test case, we consider "cafe" is not a distracter to any word in dictionaries. assertFalse(mDistracterFilter.isDistracterToWordsInDictionaries( EMPTY_PREV_WORDS_INFO, typedWord, localeEnUs)); - typedWord = "ill"; - // For this test case, we consider "ill" is not a distracter to any word in dictionaries. + typedWord = "I'll"; + // For this test case, we consider "I'll" is not a distracter to any word in dictionaries. assertFalse(mDistracterFilter.isDistracterToWordsInDictionaries( EMPTY_PREV_WORDS_INFO, typedWord, localeEnUs)); + typedWord = "ill"; + // For this test case, we consider "ill" is a distracter to "I'll" + assertTrue(mDistracterFilter.isDistracterToWordsInDictionaries( + EMPTY_PREV_WORDS_INFO, typedWord, localeEnUs)); + typedWord = "asdfd"; // For this test case, we consider "asdfd" is not a distracter to any word in dictionaries. assertFalse( @@ -101,8 +101,51 @@ public class DistracterFilterTest extends InputTestsBase { typedWord = "thank"; // For this test case, we consider "thank" is not a distracter to any other word // in dictionaries. - assertFalse( - mDistracterFilter.isDistracterToWordsInDictionaries( - EMPTY_PREV_WORDS_INFO, typedWord, localeEnUs)); + assertFalse(mDistracterFilter.isDistracterToWordsInDictionaries( + EMPTY_PREV_WORDS_INFO, typedWord, localeEnUs)); + + final Locale localeDeDe = new Locale("de", "DE"); + + typedWord = "fuer"; + // For this test case, we consider "fuer" is a distracter to "für". + assertTrue(mDistracterFilter.isDistracterToWordsInDictionaries( + EMPTY_PREV_WORDS_INFO, typedWord, localeDeDe)); + + typedWord = "fUEr"; + // For this test case, we consider "fUEr" is a distracter to "für". + assertTrue(mDistracterFilter.isDistracterToWordsInDictionaries( + EMPTY_PREV_WORDS_INFO, typedWord, localeDeDe)); + + typedWord = "fur"; + // For this test case, we consider "fur" is a distracter to "für". + assertTrue(mDistracterFilter.isDistracterToWordsInDictionaries( + EMPTY_PREV_WORDS_INFO, typedWord, localeDeDe)); + + final Locale localeFrFr = new Locale("fr", "FR"); + + typedWord = "a"; + // For this test case, we consider "a" is a distracter to "à". + assertTrue(mDistracterFilter.isDistracterToWordsInDictionaries( + EMPTY_PREV_WORDS_INFO, typedWord, localeFrFr)); + + typedWord = "à"; + // For this test case, we consider "à" is not a distracter to any word in dictionaries. + assertFalse(mDistracterFilter.isDistracterToWordsInDictionaries( + EMPTY_PREV_WORDS_INFO, typedWord, localeFrFr)); + + typedWord = "etre"; + // For this test case, we consider "etre" is a distracter to "être". + assertTrue(mDistracterFilter.isDistracterToWordsInDictionaries( + EMPTY_PREV_WORDS_INFO, typedWord, localeFrFr)); + + typedWord = "États-unis"; + // For this test case, we consider "États-unis" is a distracter to "États-Unis". + assertTrue(mDistracterFilter.isDistracterToWordsInDictionaries( + EMPTY_PREV_WORDS_INFO, typedWord, localeFrFr)); + + typedWord = "ÉtatsUnis"; + // For this test case, we consider "ÉtatsUnis" is a distracter to "États-Unis". + assertTrue(mDistracterFilter.isDistracterToWordsInDictionaries( + EMPTY_PREV_WORDS_INFO, typedWord, localeFrFr)); } } |