diff options
author | 2014-10-08 14:40:03 +0900 | |
---|---|---|
committer | 2014-10-09 17:54:58 +0900 | |
commit | bc18005948c3872a96bd3406e7dd2c722d60a013 (patch) | |
tree | dafa240dfdb28afd8f10357b7f156d0f4b1a3fb8 /tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java | |
parent | 41302021d61d3c876fe3952089ff211bab0abb4e (diff) | |
download | latinime-bc18005948c3872a96bd3406e7dd2c722d60a013.tar.gz latinime-bc18005948c3872a96bd3406e7dd2c722d60a013.tar.xz latinime-bc18005948c3872a96bd3406e7dd2c722d60a013.zip |
Always show the typed word in recorrections.
Bug: 11330140
Bug: 17875601
Bug: 17623275
Change-Id: Ie4620f36f312c54c7b01b5f6cbdb0bc9171b6179
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java | 45 |
1 files changed, 8 insertions, 37 deletions
diff --git a/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java b/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java index 563261f8f..221541e4a 100644 --- a/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java +++ b/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java @@ -59,40 +59,6 @@ public class SuggestedWordsTests extends AndroidTestCase { SuggestedWordInfo.NOT_A_CONFIDENCE /* autoCommitFirstWordConfidence */); } - public void testGetSuggestedWordsExcludingTypedWord() { - final String TYPED_WORD = "typed"; - final int NUMBER_OF_ADDED_SUGGESTIONS = 5; - final int KIND_OF_SECOND_CORRECTION = SuggestedWordInfo.KIND_CORRECTION; - final ArrayList<SuggestedWordInfo> list = new ArrayList<>(); - list.add(createTypedWordInfo(TYPED_WORD)); - for (int i = 0; i < NUMBER_OF_ADDED_SUGGESTIONS; ++i) { - list.add(createCorrectionWordInfo(Integer.toString(i))); - } - - final SuggestedWords words = new SuggestedWords( - list, null /* rawSuggestions */, - false /* typedWordValid */, - false /* willAutoCorrect */, - false /* isObsoleteSuggestions */, - SuggestedWords.INPUT_STYLE_NONE); - assertEquals(NUMBER_OF_ADDED_SUGGESTIONS + 1, words.size()); - assertEquals("typed", words.getWord(0)); - assertTrue(words.getInfo(0).isKindOf(SuggestedWordInfo.KIND_TYPED)); - assertEquals("0", words.getWord(1)); - assertTrue(words.getInfo(1).isKindOf(KIND_OF_SECOND_CORRECTION)); - assertEquals("4", words.getWord(5)); - assertTrue(words.getInfo(5).isKindOf(KIND_OF_SECOND_CORRECTION)); - - final SuggestedWords wordsWithoutTyped = - words.getSuggestedWordsExcludingTypedWordForRecorrection(); - // Make sure that the typed word has indeed been excluded, by testing the size of the - // suggested words, the string and the kind of the top suggestion, which should match - // the string and kind of what we inserted after the typed word. - assertEquals(words.size() - 1, wordsWithoutTyped.size()); - assertEquals("0", wordsWithoutTyped.getWord(0)); - assertTrue(wordsWithoutTyped.getInfo(0).isKindOf(KIND_OF_SECOND_CORRECTION)); - } - // Helper for testGetTransformedWordInfo private SuggestedWordInfo transformWordInfo(final String info, final int trailingSingleQuotesCount) { @@ -141,9 +107,14 @@ public class SuggestedWordsTests extends AndroidTestCase { assertNotNull(typedWord); assertEquals(TYPED_WORD, typedWord.mWord); - // Make sure getTypedWordInfoOrNull() returns null. - final SuggestedWords wordsWithoutTypedWord = - wordsWithTypedWord.getSuggestedWordsExcludingTypedWordForRecorrection(); + // Make sure getTypedWordInfoOrNull() returns null when no typed word. + list.remove(0); + final SuggestedWords wordsWithoutTypedWord = new SuggestedWords( + list, null /* rawSuggestions */, + false /* typedWordValid */, + false /* willAutoCorrect */, + false /* isObsoleteSuggestions */, + SuggestedWords.INPUT_STYLE_NONE); assertNull(wordsWithoutTypedWord.getTypedWordInfoOrNull()); // Make sure getTypedWordInfoOrNull() returns null. |