From 9159b9953d857de83ae2f90a121fcd259f5ee01d Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Fri, 3 Feb 2012 16:05:48 +0900 Subject: Fix the auto-composer to support supplementary chars Change-Id: I61ff218ae2ca4eb443a370e581b677755258670a --- .../android/inputmethod/latin/InputLogicTests.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTests.java') diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java index 2cecc9d8d..9d886da3b 100644 --- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java +++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java @@ -159,11 +159,26 @@ public class InputLogicTests extends ServiceTestCase { } public void testPickSuggestionThenBackspace() { - final String WORD_TO_TYPE = "tgis"; + final String WORD_TO_TYPE = "this"; + final String EXPECTED_RESULT = "this"; type(WORD_TO_TYPE); mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE); + mLatinIME.onUpdateSelection(0, 0, WORD_TO_TYPE.length(), WORD_TO_TYPE.length(), -1, -1); type(Keyboard.CODE_DELETE); - assertEquals("press suggestion then backspace", WORD_TO_TYPE, + assertEquals("press suggestion then backspace", EXPECTED_RESULT, + mTextView.getText().toString()); + } + + public void testPickTypedWordOverAutoCorrectionThenBackspace() { + final String WORD_TO_TYPE = "tgis"; + final String EXPECTED_RESULT = "tgis"; + type(WORD_TO_TYPE); + // Choose the typed word, which should be in position 1 (because position 0 should + // be occupied by the "this" auto-correction, as checked by testAutoCorrect()) + mLatinIME.pickSuggestionManually(1, WORD_TO_TYPE); + mLatinIME.onUpdateSelection(0, 0, WORD_TO_TYPE.length(), WORD_TO_TYPE.length(), -1, -1); + type(Keyboard.CODE_DELETE); + assertEquals("pick typed word over auto-correction then backspace", EXPECTED_RESULT, mTextView.getText().toString()); } @@ -379,4 +394,6 @@ public class InputLogicTests extends ServiceTestCase { assertEquals("type word type dot then press the .com key", EXPECTED_RESULT, mTextView.getText().toString()); } + + // TODO: Add some tests for non-BMP characters } -- cgit v1.2.3-83-g751a