diff options
author | 2014-08-06 10:39:26 +0900 | |
---|---|---|
committer | 2014-08-06 07:29:35 +0000 | |
commit | ef74e737f580f7ac0b3bd70d6255dde3c87d9078 (patch) | |
tree | 17bc3043b5a108ddcb80845ccc6a0ce1d624f851 /tests/src/com/android/inputmethod/latin/InputTestsBase.java | |
parent | 2d8f1b65dac731306b37a6f55c08975a2de0f719 (diff) | |
download | latinime-ef74e737f580f7ac0b3bd70d6255dde3c87d9078.tar.gz latinime-ef74e737f580f7ac0b3bd70d6255dde3c87d9078.tar.xz latinime-ef74e737f580f7ac0b3bd70d6255dde3c87d9078.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 | 10 |
1 files changed, 7 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..18671fbe8 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,17 @@ 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 = Event.createSoftwareKeypressEvent(codePoint, Event.NOT_A_KEY_CODE, + x, y, isKeyRepeat); } + mLatinIME.onEvent(event); // Also see the comment at the top of this function about onReleaseKey //mLatinIME.onReleaseKey(codePoint, false /* withSliding */); } |