aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/InputLogicTests.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-03-22 18:08:23 +0900
committerJean Chalard <jchalard@google.com>2012-03-22 18:08:23 +0900
commit109728193e45262099cbf88d8d6fcc4ed05240ca (patch)
tree053589351cd045c648a3a8ca315076a30c09eff7 /tests/src/com/android/inputmethod/latin/InputLogicTests.java
parent9c4396abb3760166773f38e9ea12c27c795f54eb (diff)
downloadlatinime-109728193e45262099cbf88d8d6fcc4ed05240ca.tar.gz
latinime-109728193e45262099cbf88d8d6fcc4ed05240ca.tar.xz
latinime-109728193e45262099cbf88d8d6fcc4ed05240ca.zip
Don't rely on spell checker proximity in tests
This fixes the input logic tests that were broken and suppresses their dependency upon the spell checker proximity. Instead, it gets the Keyboard instance from Latin IME and uses the actual coordinates, which results in a test run closer to what actually happens during typing. Change-Id: I3a81d249ee7fb3ac6ae6940aa2e8b2421e829e5c
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTests.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
index 595fe5b10..19e1c3d2b 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
@@ -36,6 +36,7 @@ import android.view.inputmethod.InputConnection;
import android.widget.FrameLayout;
import android.widget.TextView;
+import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardActionListener;
import com.android.inputmethod.latin.spellcheck.AndroidSpellCheckerService; // for proximity info
@@ -49,6 +50,7 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> {
private static final String PREF_DEBUG_MODE = "debug_mode";
private LatinIME mLatinIME;
+ private Keyboard mKeyboard;
private TextView mTextView;
private InputConnection mInputConnection;
@@ -95,6 +97,7 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> {
mLatinIME.onStartInputView(ei, false);
mLatinIME.onCreateInputMethodInterface().startInput(ic, ei);
mInputConnection = ic;
+ mKeyboard = mLatinIME.mKeyboardSwitcher.getKeyboard();
changeLanguage("en_US");
}
@@ -152,6 +155,14 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> {
// to keep these tests as pinpoint as possible and avoid bringing it too many dependencies,
// but keep them in mind if something breaks. Commenting them out as is should work.
//mLatinIME.onPressKey(codePoint);
+ for (final Key key : mKeyboard.mKeys) {
+ if (key.mCode == codePoint) {
+ final int x = key.mX + key.mWidth / 2;
+ final int y = key.mY + key.mHeight / 2;
+ mLatinIME.onCodeInput(codePoint, x, y);
+ return;
+ }
+ }
mLatinIME.onCodeInput(codePoint,
KeyboardActionListener.SPELL_CHECKER_COORDINATE,
KeyboardActionListener.SPELL_CHECKER_COORDINATE);