aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/InputLogicTests.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-10-10 18:57:47 +0900
committerJean Chalard <jchalard@google.com>2012-10-10 19:42:29 +0900
commit2752287c425b9be87800136bd616ee63940caaac (patch)
treed03a31e671150c6f47762cc78f53b677bb6ed0b0 /tests/src/com/android/inputmethod/latin/InputLogicTests.java
parent3873d36128c2066387bf9db90857cba0f67cb8a0 (diff)
downloadlatinime-2752287c425b9be87800136bd616ee63940caaac.tar.gz
latinime-2752287c425b9be87800136bd616ee63940caaac.tar.xz
latinime-2752287c425b9be87800136bd616ee63940caaac.zip
Fix failing tests.
Most of the failures can be ascribed to the tests not passing the correct old position of the cursor on a second call to onUpdateSelection() to LatinIME. Bug: 7276565 Bug: 7276805 Bug: 7276195 Change-Id: I3f1b52cdcc783ea18838408bed50699b7254eaf4
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTests.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
index 38e57aaed..3b9eda212 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
@@ -86,6 +86,7 @@ public class InputLogicTests extends InputTestsBase {
public void testDeleteSelection() {
final String STRING_TO_TYPE = "some text delete me some text";
+ final int typedLength = STRING_TO_TYPE.length();
final int SELECTION_START = 10;
final int SELECTION_END = 19;
final String EXPECTED_RESULT = "some text some text";
@@ -94,10 +95,11 @@ public class InputLogicTests extends InputTestsBase {
// Send once to simulate the cursor actually responding to the move caused by typing.
// This is necessary because LatinIME is bookkeeping to avoid confusing a real cursor
// move with a move triggered by LatinIME inputting stuff.
- mLatinIME.onUpdateSelection(0, 0, STRING_TO_TYPE.length(), STRING_TO_TYPE.length(), -1, -1);
+ mLatinIME.onUpdateSelection(0, 0, typedLength, typedLength, -1, -1);
mInputConnection.setSelection(SELECTION_START, SELECTION_END);
// And now we simulate the user actually selecting some text.
- mLatinIME.onUpdateSelection(0, 0, SELECTION_START, SELECTION_END, -1, -1);
+ mLatinIME.onUpdateSelection(typedLength, typedLength,
+ SELECTION_START, SELECTION_END, -1, -1);
type(Keyboard.CODE_DELETE);
assertEquals("delete selection", EXPECTED_RESULT, mTextView.getText().toString());
}
@@ -163,12 +165,14 @@ public class InputLogicTests extends InputTestsBase {
public void testBackspaceAtStartAfterAutocorrect() {
final String STRING_TO_TYPE = "tgis ";
+ final int typedLength = STRING_TO_TYPE.length();
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);
+ mLatinIME.onUpdateSelection(0, 0, typedLength, typedLength, -1, -1);
mInputConnection.setSelection(NEW_CURSOR_POSITION, NEW_CURSOR_POSITION);
- mLatinIME.onUpdateSelection(0, 0, NEW_CURSOR_POSITION, NEW_CURSOR_POSITION, -1, -1);
+ mLatinIME.onUpdateSelection(typedLength, typedLength,
+ NEW_CURSOR_POSITION, NEW_CURSOR_POSITION, -1, -1);
type(Keyboard.CODE_DELETE);
assertEquals("auto correct then move cursor to start of line then backspace",
EXPECTED_RESULT, mTextView.getText().toString());
@@ -176,12 +180,14 @@ public class InputLogicTests extends InputTestsBase {
public void testAutoCorrectThenMoveCursorThenBackspace() {
final String STRING_TO_TYPE = "and tgis ";
+ final int typedLength = STRING_TO_TYPE.length();
final String EXPECTED_RESULT = "andthis ";
final int NEW_CURSOR_POSITION = STRING_TO_TYPE.indexOf('t');
type(STRING_TO_TYPE);
- mLatinIME.onUpdateSelection(0, 0, STRING_TO_TYPE.length(), STRING_TO_TYPE.length(), -1, -1);
+ mLatinIME.onUpdateSelection(0, 0, typedLength, typedLength, -1, -1);
mInputConnection.setSelection(NEW_CURSOR_POSITION, NEW_CURSOR_POSITION);
- mLatinIME.onUpdateSelection(0, 0, NEW_CURSOR_POSITION, NEW_CURSOR_POSITION, -1, -1);
+ mLatinIME.onUpdateSelection(typedLength, typedLength,
+ NEW_CURSOR_POSITION, NEW_CURSOR_POSITION, -1, -1);
type(Keyboard.CODE_DELETE);
assertEquals("auto correct then move cursor then backspace",
EXPECTED_RESULT, mTextView.getText().toString());