aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/InputLogicTests.java
diff options
context:
space:
mode:
authorAdrian Velicu <adrianv@google.com>2014-09-30 06:56:35 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-30 06:56:35 +0000
commit7ba79df1a521cd339a0c1e47e6b9c630e8d3fa26 (patch)
tree3d0edac27d56daf054dd8faccdd9237b38818fbf /tests/src/com/android/inputmethod/latin/InputLogicTests.java
parentc613c3e3b8a112bb00ccd6f9eabc3438a9562f9d (diff)
parent9586d69bdf90fe24a83c0c6ba22589f28ae6cd03 (diff)
downloadlatinime-7ba79df1a521cd339a0c1e47e6b9c630e8d3fa26.tar.gz
latinime-7ba79df1a521cd339a0c1e47e6b9c630e8d3fa26.tar.xz
latinime-7ba79df1a521cd339a0c1e47e6b9c630e8d3fa26.zip
am 9586d69b: Avoid double space when autocorrect is triggered
* commit '9586d69bdf90fe24a83c0c6ba22589f28ae6cd03': Avoid double space when autocorrect is triggered
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTests.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
index 59b858dbd..ec249dab3 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
@@ -159,8 +159,11 @@ public class InputLogicTests extends InputTestsBase {
}
public void testAutoCorrectWithSpaceThenRevert() {
+ // Backspacing to cancel the "tgis"->"this" autocorrection should result in
+ // a "phantom space": if the user presses space immediately after,
+ // only one space will be inserted in total.
final String STRING_TO_TYPE = "tgis ";
- final String EXPECTED_RESULT = "tgis ";
+ final String EXPECTED_RESULT = "tgis";
type(STRING_TO_TYPE);
mLatinIME.onUpdateSelection(0, 0, STRING_TO_TYPE.length(), STRING_TO_TYPE.length(), -1, -1);
type(Constants.CODE_DELETE);
@@ -168,6 +171,24 @@ public class InputLogicTests extends InputTestsBase {
mEditText.getText().toString());
}
+ public void testAutoCorrectWithSpaceThenRevertThenTypeMore() {
+ final String STRING_TO_TYPE_FIRST = "tgis ";
+ final String STRING_TO_TYPE_SECOND = "a";
+ final String EXPECTED_RESULT = "tgis a";
+ type(STRING_TO_TYPE_FIRST);
+ mLatinIME.onUpdateSelection(0, 0,
+ STRING_TO_TYPE_FIRST.length(), STRING_TO_TYPE_FIRST.length(), -1, -1);
+ type(Constants.CODE_DELETE);
+
+ type(STRING_TO_TYPE_SECOND);
+ mLatinIME.onUpdateSelection(STRING_TO_TYPE_FIRST.length(), STRING_TO_TYPE_FIRST.length(),
+ STRING_TO_TYPE_FIRST.length() - 1 + STRING_TO_TYPE_SECOND.length(),
+ STRING_TO_TYPE_FIRST.length() - 1 + STRING_TO_TYPE_SECOND.length(),
+ -1, -1);
+ assertEquals("auto-correct with space then revert then type more", EXPECTED_RESULT,
+ mEditText.getText().toString());
+ }
+
public void testAutoCorrectToSelfDoesNotRevert() {
final String STRING_TO_TYPE = "this ";
final String EXPECTED_RESULT = "this";