diff options
author | 2014-12-22 17:18:56 +0900 | |
---|---|---|
committer | 2014-12-22 17:47:33 +0900 | |
commit | 8e235191dd3501fc3562fe0654d41501ec9760d0 (patch) | |
tree | 217e998021ab7de6cf3b99beecaf4fb6e192fac0 /tests/src/com/android/inputmethod/latin/InputLogicTestsLanguageWithoutSpaces.java | |
parent | 3e35b8712c3df40291e6ff8ec2889b53f6dd8371 (diff) | |
download | latinime-8e235191dd3501fc3562fe0654d41501ec9760d0.tar.gz latinime-8e235191dd3501fc3562fe0654d41501ec9760d0.tar.xz latinime-8e235191dd3501fc3562fe0654d41501ec9760d0.zip |
Fix moving the cursor inside composition in lang w/o spaces
Also introduce the cursor move event, which we needed to do
anyway
Bug: 18827118
Change-Id: I30e994764c095b4423b874dc05d1bbedc0de592f
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTestsLanguageWithoutSpaces.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/InputLogicTestsLanguageWithoutSpaces.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTestsLanguageWithoutSpaces.java b/tests/src/com/android/inputmethod/latin/InputLogicTestsLanguageWithoutSpaces.java index 6e6f551cc..12461c96e 100644 --- a/tests/src/com/android/inputmethod/latin/InputLogicTestsLanguageWithoutSpaces.java +++ b/tests/src/com/android/inputmethod/latin/InputLogicTestsLanguageWithoutSpaces.java @@ -89,6 +89,34 @@ public class InputLogicTestsLanguageWithoutSpaces extends InputTestsBase { BaseInputConnection.getComposingSpanEnd(mEditText.getText())); } + public void testMovingCursorInsideWordAndType() { + final String WORD_TO_TYPE = "abcdefgh"; + final int typedLength = WORD_TO_TYPE.length(); + final int CURSOR_POS = 4; + changeKeyboardLocaleAndDictLocale("th", "en_US"); + type(WORD_TO_TYPE); + mLatinIME.onUpdateSelection(0, 0, typedLength, typedLength, 0, typedLength); + sleep(DELAY_TO_WAIT_FOR_PREDICTIONS_MILLIS); + runMessages(); + mInputConnection.setSelection(CURSOR_POS, CURSOR_POS); + mLatinIME.onUpdateSelection(typedLength, typedLength, + CURSOR_POS, CURSOR_POS, 0, typedLength); + sleep(DELAY_TO_WAIT_FOR_PREDICTIONS_MILLIS); + runMessages(); + assertEquals("move cursor inside text", 0, + BaseInputConnection.getComposingSpanStart(mEditText.getText())); + assertEquals("move cursor inside text", typedLength, + BaseInputConnection.getComposingSpanEnd(mEditText.getText())); + type("x"); + sleep(DELAY_TO_WAIT_FOR_PREDICTIONS_MILLIS); + sleep(DELAY_TO_WAIT_FOR_PREDICTIONS_MILLIS); + runMessages(); + assertEquals("start typing while cursor inside composition", CURSOR_POS, + BaseInputConnection.getComposingSpanStart(mEditText.getText())); + assertEquals("start typing while cursor inside composition", CURSOR_POS + 1, + BaseInputConnection.getComposingSpanEnd(mEditText.getText())); + } + public void testPredictions() { final String WORD_TO_TYPE = "Barack "; changeKeyboardLocaleAndDictLocale("th", "en_US"); |