diff options
author | 2013-01-09 01:53:47 -0800 | |
---|---|---|
committer | 2013-01-09 01:53:47 -0800 | |
commit | b112a13518fd7479da4113d8e4f4f327ad8b9bbb (patch) | |
tree | 5701c793eb829ab18297af620a53d4d861d7e12e /tests/src/com/android/inputmethod/latin/InputLogicTests.java | |
parent | e56686f43af81db965941a393c5e0231c26ec77b (diff) | |
parent | 516b63db2866f144a00ec7e1e6c29cb0865f5ff3 (diff) | |
download | latinime-b112a13518fd7479da4113d8e4f4f327ad8b9bbb.tar.gz latinime-b112a13518fd7479da4113d8e4f4f327ad8b9bbb.tar.xz latinime-b112a13518fd7479da4113d8e4f4f327ad8b9bbb.zip |
Merge "Fix a race condition with backspaces"
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/InputLogicTests.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java index 38f5305de..6412a9db5 100644 --- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java +++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java @@ -102,6 +102,27 @@ public class InputLogicTests extends InputTestsBase { assertEquals("delete selection", EXPECTED_RESULT, mTextView.getText().toString()); } + public void testDeleteSelectionTwice() { + final String STRING_TO_TYPE = "some text delete me some text"; + final int typedLength = STRING_TO_TYPE.length(); + final int SELECTION_START = 10; + final int SELECTION_END = 19; + final String EXPECTED_RESULT = "some text some text"; + type(STRING_TO_TYPE); + // There is no IMF to call onUpdateSelection for us so we must do it by hand. + // Send once to simulate the cursor actually responding to the move caused by typing. + // This is necessary because LatinIME is bookkeeping to avoid confusing a real cursor + // move with a move triggered by LatinIME inputting stuff. + mLatinIME.onUpdateSelection(0, 0, typedLength, typedLength, -1, -1); + mInputConnection.setSelection(SELECTION_START, SELECTION_END); + // And now we simulate the user actually selecting some text. + mLatinIME.onUpdateSelection(typedLength, typedLength, + SELECTION_START, SELECTION_END, -1, -1); + type(Constants.CODE_DELETE); + type(Constants.CODE_DELETE); + assertEquals("delete selection twice", EXPECTED_RESULT, mTextView.getText().toString()); + } + public void testAutoCorrect() { final String STRING_TO_TYPE = "tgis "; final String EXPECTED_RESULT = "this "; |