diff options
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateMultiTouchTests.java | 26 | ||||
-rw-r--r-- | tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java | 16 |
2 files changed, 37 insertions, 5 deletions
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateMultiTouchTests.java b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateMultiTouchTests.java index f5ad7239e..053bcb53a 100644 --- a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateMultiTouchTests.java +++ b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateMultiTouchTests.java @@ -50,7 +50,7 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase { pressKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED); // Press/release symbol letter key. chordingPressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED); - // Release "123?" key, switch back to alphabet shift unshifted. + // Release "123?" key, switch back to alphabet unshifted. releaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED); } @@ -330,7 +330,7 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase { releaseKey('X', ALPHABET_MANUAL_SHIFTED); // Release 'Z' key releaseKey('Z', ALPHABET_MANUAL_SHIFTED); - // Release shift key. + // Release shift key, switch back to alphabet shifted. releaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED); } @@ -351,8 +351,24 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase { releaseKey('X', ALPHABET_MANUAL_SHIFTED); // Release 'Z' key releaseKey('Z', ALPHABET_MANUAL_SHIFTED); - // Release shift key. + // Release shift key, updated to alphabet unshifted. releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED); + + // Update shift state with auto caps enabled. + pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED); + + // Press shift key and hold, switch to alphabet shifted. + pressKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED); + // Press 'X' key and hold + chordingPressKey('X', ALPHABET_MANUAL_SHIFTED); + // Release 'X' key + releaseKey('X', ALPHABET_MANUAL_SHIFTED); + // Press key and hold, stays in alphabet shifted. + chordingPressKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_MANUAL_SHIFTED); + // Release 'Z' key + releaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_MANUAL_SHIFTED); + // Release shift key, updated to alphabet automatic shifted. + releaseKey(CODE_SHIFT, ALPHABET_AUTOMATIC_SHIFTED); } // Multi touch shift chording input in capitalize character mode. @@ -372,8 +388,8 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase { releaseKey('X', ALPHABET_MANUAL_SHIFTED); // Release 'Z' key releaseKey('Z', ALPHABET_MANUAL_SHIFTED); - // Release shift key. - releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED); + // Release shift key, updated to alphabet automatic shifted. + releaseKey(CODE_SHIFT, ALPHABET_AUTOMATIC_SHIFTED); } public void testLongPressShiftAndChording() { diff --git a/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java b/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java index a9947c1bd..03310c88b 100644 --- a/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java +++ b/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java @@ -104,4 +104,20 @@ public class BlueUnderlineTests extends InputTestsBase { final SpanGetter span = new SpanGetter(mTextView.getText(), SuggestionSpan.class); assertNull("blue underline removed when cursor is moved", span.mSpan); } + + public void testComposingStopsOnSpace() { + final String STRING_TO_TYPE = "this "; + type(STRING_TO_TYPE); + sleep(DELAY_TO_WAIT_FOR_UNDERLINE); + // Simulate the onUpdateSelection() event + mLatinIME.onUpdateSelection(0, 0, STRING_TO_TYPE.length(), STRING_TO_TYPE.length(), -1, -1); + runMessages(); + // Here the blue underline has been set. testBlueUnderline() is testing for this already, + // so let's not test it here again. + // Now simulate the user moving the cursor. + SpanGetter span = new SpanGetter(mTextView.getText(), UnderlineSpan.class); + assertNull("should not be composing, so should not have an underline span", span.mSpan); + span = new SpanGetter(mTextView.getText(), SuggestionSpan.class); + assertNull("should not be composing, so should not have an underline span", span.mSpan); + } } |