From 41df8a98fd0b89de87c7531903262c75dc7e505b Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Thu, 26 Jan 2012 10:02:33 +0900 Subject: [PATCH] Add a test case for backspace at start of line Tests the behavior from Bug: 5784542 Change-Id: I78ec9d77c5dd1e3ea8eff530f9d7d284a1c094d4 --- .../android/inputmethod/latin/InputLogicTests.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java index 7b87be6d3..8b4f64aa1 100644 --- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java +++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java @@ -191,5 +191,17 @@ public class InputLogicTests extends ServiceTestCase { type(STRING_TO_TYPE); type(Keyboard.CODE_DELETE); assertEquals("double space make a period", EXPECTED_RESULT, mTextView.getText().toString()); + + public void testBackspaceAtStartAfterAutocorrect() { + final String STRING_TO_TYPE = "tgis "; + final String EXPECTED_RESULT = "this "; + final int NEW_CURSOR_POSITION = 0; + type(STRING_TO_TYPE); + mLatinIME.onUpdateSelection(0, 0, STRING_TO_TYPE.length(), STRING_TO_TYPE.length(), -1, -1); + 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", + EXPECTED_RESULT, mTextView.getText().toString()); } }