diff options
author | 2014-08-06 10:39:26 +0900 | |
---|---|---|
committer | 2014-08-25 16:33:47 +0900 | |
commit | 908f0ed1541d1f5a9cb6d89d06ec39c219d079bd (patch) | |
tree | 9aeba0e17455def1b93c6adb19cf7f55be0b0f3d /tests/src/com/android/inputmethod/latin/InputTestsBase.java | |
parent | 19a7012db59efdc45d58c86085c2e8c871806761 (diff) | |
download | latinime-908f0ed1541d1f5a9cb6d89d06ec39c219d079bd.tar.gz latinime-908f0ed1541d1f5a9cb6d89d06ec39c219d079bd.tar.xz latinime-908f0ed1541d1f5a9cb6d89d06ec39c219d079bd.zip |
Introduce onEvent() to improve testability
...and prepare for the future
Change-Id: Ieed96ab552993fd148e80b9c3355f1b569bd716f
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputTestsBase.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/InputTestsBase.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java index 986fb1097..d7a649a5b 100644 --- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java +++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java @@ -36,6 +36,7 @@ import android.widget.EditText; import android.widget.FrameLayout; import com.android.inputmethod.compat.InputMethodSubtypeCompatUtils; +import com.android.inputmethod.event.Event; import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; @@ -263,14 +264,16 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> { // but keep them in mind if something breaks. Commenting them out as is should work. //mLatinIME.onPressKey(codePoint, 0 /* repeatCount */, true /* isSinglePointer */); final Key key = mKeyboard.getKey(codePoint); + final Event event; if (key == null) { - mLatinIME.onCodeInput(codePoint, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, - isKeyRepeat); + event = Event.createSoftwareKeypressEvent(codePoint, Event.NOT_A_KEY_CODE, + Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, isKeyRepeat); } else { final int x = key.getX() + key.getWidth() / 2; final int y = key.getY() + key.getHeight() / 2; - mLatinIME.onCodeInput(codePoint, x, y, isKeyRepeat); + event = mLatinIME.createSoftwareKeypressEvent(codePoint, x, y, isKeyRepeat); } + mLatinIME.onEvent(event); // Also see the comment at the top of this function about onReleaseKey //mLatinIME.onReleaseKey(codePoint, false /* withSliding */); } |