aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-02-21 07:59:04 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-02-21 07:59:05 +0000
commit239256b1564cce1aba3d79d7bf931b290243432a (patch)
tree0a1f0e10e72f33022d1981aa9337632b65c73c2d /tests/src
parentd73044a2494873a4abe0d4da208533164314d2f0 (diff)
parent4cc582f3ba128b71426c3522fa0c324709870a67 (diff)
downloadlatinime-239256b1564cce1aba3d79d7bf931b290243432a.tar.gz
latinime-239256b1564cce1aba3d79d7bf931b290243432a.tar.xz
latinime-239256b1564cce1aba3d79d7bf931b290243432a.zip
Merge "Add an auto-correction by user history test."
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTests.java32
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);