diff options
author | 2013-06-05 02:19:01 +0000 | |
---|---|---|
committer | 2013-06-05 02:19:02 +0000 | |
commit | 0bfc2bc419e7e758c6ce17b5fb959687f583551a (patch) | |
tree | 2c429078fce295f10a8aa35e91644022bd2512db /tests/src | |
parent | ad0c6d7b3635f0c1d92a3e4d895909234b7a2f0d (diff) | |
parent | 9552badf3c24d2098d227b0ddca0721b928a10b1 (diff) | |
download | latinime-0bfc2bc419e7e758c6ce17b5fb959687f583551a.tar.gz latinime-0bfc2bc419e7e758c6ce17b5fb959687f583551a.tar.xz latinime-0bfc2bc419e7e758c6ce17b5fb959687f583551a.zip |
Merge "Add CODE_CAPSLOCK for long press shift key"
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTestsBase.java | 8 | ||||
-rw-r--r-- | tests/src/com/android/inputmethod/keyboard/internal/MockKeyboardSwitcher.java | 18 |
2 files changed, 7 insertions, 19 deletions
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTestsBase.java b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTestsBase.java index e06ca064a..6991d05fa 100644 --- a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTestsBase.java +++ b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTestsBase.java @@ -18,6 +18,8 @@ package com.android.inputmethod.keyboard.internal; import android.test.AndroidTestCase; +import com.android.inputmethod.latin.Constants; + public class KeyboardStateTestsBase extends AndroidTestCase implements MockKeyboardSwitcher.MockConstants { protected MockKeyboardSwitcher mSwitcher; @@ -119,7 +121,11 @@ public class KeyboardStateTestsBase extends AndroidTestCase public void longPressKey(final int code, final int afterPress, final int afterLongPress) { pressKey(code, afterPress); - mSwitcher.onLongPressTimeout(code); + // Long press shift key will register {@link Constants#CODE_CAPS_LOCK}. See + // {@link R.xml#key_styles_common} and its baseForShiftKeyStyle. We thus emulate the + // behavior here. + final int longPressCode = code == CODE_SHIFT ? Constants.CODE_CAPSLOCK : code; + mSwitcher.onCodeInput(longPressCode); assertLayout("afterLongPress", afterLongPress, mSwitcher.getLayoutId()); } diff --git a/tests/src/com/android/inputmethod/keyboard/internal/MockKeyboardSwitcher.java b/tests/src/com/android/inputmethod/keyboard/internal/MockKeyboardSwitcher.java index 90dbaabc9..8506e16f2 100644 --- a/tests/src/com/android/inputmethod/keyboard/internal/MockKeyboardSwitcher.java +++ b/tests/src/com/android/inputmethod/keyboard/internal/MockKeyboardSwitcher.java @@ -139,24 +139,6 @@ public class MockKeyboardSwitcher implements KeyboardState.SwitchActions { return mIsInDoubleTapShiftKeyTimeout; } - @Override - public void startLongPressTimer(final int code) { - mLongPressTimeoutCode = code; - } - - @Override - public void cancelLongPressTimer() { - mLongPressTimeoutCode = 0; - } - - public void onLongPressTimeout(final int code) { - // TODO: Handle simultaneous long presses. - if (mLongPressTimeoutCode == code) { - mLongPressTimeoutCode = 0; - mState.onLongPressTimeout(code); - } - } - public void updateShiftState() { mState.onUpdateShiftState(mAutoCapsState, RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE); } |