diff options
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/InputLogicTests.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java index 8c0ccd40b..693352c85 100644 --- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java +++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java @@ -133,7 +133,7 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> { } private void type(final String stringToType) { - for (int i = 0; i < stringToType.length(); ++i) { + for (int i = 0; i < stringToType.length(); i = stringToType.offsetByCodePoints(i, 1)) { type(stringToType.codePointAt(i)); } } @@ -186,7 +186,7 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> { } public void testCancelDoubleSpace() { - final String STRING_TO_TYPE = "tgis "; + final String STRING_TO_TYPE = "this "; final String EXPECTED_RESULT = "this "; type(STRING_TO_TYPE); type(Keyboard.CODE_DELETE); @@ -202,7 +202,7 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> { mInputConnection.setSelection(NEW_CURSOR_POSITION, NEW_CURSOR_POSITION); mLatinIME.onUpdateSelection(0, 0, NEW_CURSOR_POSITION, NEW_CURSOR_POSITION, -1, -1); type(Keyboard.CODE_DELETE); - assertEquals("auto correct then move curor to start of line then backspace", + assertEquals("auto correct then move cursor to start of line then backspace", EXPECTED_RESULT, mTextView.getText().toString()); } @@ -215,7 +215,7 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> { mInputConnection.setSelection(NEW_CURSOR_POSITION, NEW_CURSOR_POSITION); mLatinIME.onUpdateSelection(0, 0, NEW_CURSOR_POSITION, NEW_CURSOR_POSITION, -1, -1); type(Keyboard.CODE_DELETE); - assertEquals("auto correct then move curor then backspace", + assertEquals("auto correct then move cursor then backspace", EXPECTED_RESULT, mTextView.getText().toString()); } @@ -291,4 +291,13 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> { assertEquals("manual pick then space then type", WORD1_TO_TYPE + WORD2_TO_TYPE, mTextView.getText().toString()); } + + public void testDeleteWholeComposingWord() { + final String WORD_TO_TYPE = "this"; + type(WORD_TO_TYPE); + for (int i = 0; i < WORD_TO_TYPE.length(); ++i) { + type(Keyboard.CODE_DELETE); + } + assertEquals("delete whole composing word", "", mTextView.getText().toString()); + } } |