diff options
author | 2014-02-21 13:12:26 +0900 | |
---|---|---|
committer | 2014-02-21 13:12:26 +0900 | |
commit | 4cc582f3ba128b71426c3522fa0c324709870a67 (patch) | |
tree | 30264bde9b77d328a46c8613b5549abf50742971 /tests/src/com/android/inputmethod/latin/InputLogicTests.java | |
parent | d36328cecf3b0c5e7acde7bd5963ea670b8d634f (diff) | |
download | latinime-4cc582f3ba128b71426c3522fa0c324709870a67.tar.gz latinime-4cc582f3ba128b71426c3522fa0c324709870a67.tar.xz latinime-4cc582f3ba128b71426c3522fa0c324709870a67.zip |
Add an auto-correction by user history test.
Bug: 11122480
Change-Id: I830bb3399f9839a80c6d86fbf582299bce424871
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/InputLogicTests.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java index 1c714e7de..ab9751380 100644 --- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java +++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java @@ -351,6 +351,38 @@ public class InputLogicTests extends InputTestsBase { } // TODO: Add some tests for non-BMP characters + public void testAutoCorrectByUserHistory() { + final String WORD_TO_BE_CORRECTED = "qpmx"; + final String NOT_CORRECTED_RESULT = "qpmx "; + final String DESIRED_WORD = "qpmz"; + final String CORRECTED_RESULT = "qpmz "; + final int typeCountNotToAutocorrect = 3; + final int typeCountToAutoCorrect = 16; + int startIndex = 0; + int endIndex = 0; + + for (int i = 0; i < typeCountNotToAutocorrect; i++) { + type(DESIRED_WORD); + type(Constants.CODE_SPACE); + } + startIndex = mEditText.getText().length(); + type(WORD_TO_BE_CORRECTED); + type(Constants.CODE_SPACE); + endIndex = mEditText.getText().length(); + assertEquals("not auto-corrected by user history", NOT_CORRECTED_RESULT, + mEditText.getText().subSequence(startIndex, endIndex).toString()); + for (int i = typeCountNotToAutocorrect; i < typeCountToAutoCorrect; i++) { + type(DESIRED_WORD); + type(Constants.CODE_SPACE); + } + startIndex = mEditText.getText().length(); + type(WORD_TO_BE_CORRECTED); + type(Constants.CODE_SPACE); + endIndex = mEditText.getText().length(); + assertEquals("auto-corrected by user history", + CORRECTED_RESULT, mEditText.getText().subSequence(startIndex, endIndex).toString()); + } + public void testPredictionsAfterSpace() { final String WORD_TO_TYPE = "Barack "; type(WORD_TO_TYPE); |