am e3150664: Revert "Remove symbols shifted layout related code"

* commit 'e3150664ae4d8d007b8571b5bd0fd2259aac3a20':
  Revert "Remove symbols shifted layout related code"
This commit is contained in:
Satoshi Kataoka 2013-09-04 00:31:03 -07:00 committed by Android Git Automerger
commit 183570bbee
9 changed files with 646 additions and 108 deletions

View file

@ -388,6 +388,7 @@
<enum name="alphabetShiftLocked" value="3" />
<enum name="alphabetShiftLockShifted" value="4" />
<enum name="symbols" value="5" />
<enum name="symbolsShifted" value="6" />
<enum name="phone" value="7" />
<enum name="phoneSymbols" value="8" />
<enum name="number" value="9" />
@ -449,6 +450,7 @@
<enum name="alphabetShiftLocked" value="3" />
<enum name="alphabetShiftLockShifted" value="4" />
<enum name="symbols" value="5" />
<enum name="symbolsShifted" value="6" />
<enum name="phone" value="7" />
<enum name="phoneSymbols" value="8" />
<enum name="number" value="9" />

View file

@ -357,6 +357,7 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
break;
case KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED:
case KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED:
case KeyboardId.ELEMENT_SYMBOLS_SHIFTED:
text = context.getText(R.string.spoken_description_shiftmode_on);
break;
default:
@ -388,6 +389,7 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
resId = R.string.spoken_description_mode_alpha;
break;
case KeyboardId.ELEMENT_SYMBOLS:
case KeyboardId.ELEMENT_SYMBOLS_SHIFTED:
resId = R.string.spoken_description_mode_symbol;
break;
case KeyboardId.ELEMENT_PHONE:

View file

@ -156,6 +156,7 @@ public final class KeyCodeDescriptionMapper {
resId = R.string.spoken_description_to_symbol;
break;
case KeyboardId.ELEMENT_SYMBOLS:
case KeyboardId.ELEMENT_SYMBOLS_SHIFTED:
resId = R.string.spoken_description_to_alpha;
break;
case KeyboardId.ELEMENT_PHONE:
@ -190,6 +191,7 @@ public final class KeyCodeDescriptionMapper {
break;
case KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED:
case KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED:
case KeyboardId.ELEMENT_SYMBOLS_SHIFTED:
resId = R.string.spoken_description_shift_shifted;
break;
default:

View file

@ -50,6 +50,7 @@ public final class KeyboardId {
public static final int ELEMENT_ALPHABET_SHIFT_LOCKED = 3;
public static final int ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED = 4;
public static final int ELEMENT_SYMBOLS = 5;
public static final int ELEMENT_SYMBOLS_SHIFTED = 6;
public static final int ELEMENT_PHONE = 7;
public static final int ELEMENT_PHONE_SYMBOLS = 8;
public static final int ELEMENT_NUMBER = 9;
@ -219,6 +220,7 @@ public final class KeyboardId {
case ELEMENT_ALPHABET_SHIFT_LOCKED: return "alphabetShiftLocked";
case ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED: return "alphabetShiftLockShifted";
case ELEMENT_SYMBOLS: return "symbols";
case ELEMENT_SYMBOLS_SHIFTED: return "symbolsShifted";
case ELEMENT_PHONE: return "phone";
case ELEMENT_PHONE_SYMBOLS: return "phoneSymbols";
case ELEMENT_NUMBER: return "number";

View file

@ -269,6 +269,12 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
mEmojiKeyboardView.setVisibility(View.VISIBLE);
}
// Implements {@link KeyboardState.SwitchActions}.
@Override
public void setSymbolsShiftedKeyboard() {
setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_SYMBOLS_SHIFTED));
}
// Implements {@link KeyboardState.SwitchActions}.
@Override
public void requestUpdatingShiftState() {

View file

@ -47,6 +47,7 @@ public final class KeyboardState {
public void setAlphabetShiftLockShiftedKeyboard();
public void setSymbolsKeyboard();
public void setEmojiKeyboard();
public void setSymbolsShiftedKeyboard();
/**
* Request to call back {@link KeyboardState#onUpdateShiftState(int, int)}.
@ -64,11 +65,13 @@ public final class KeyboardState {
private ModifierKeyState mSymbolKeyState = new ModifierKeyState("Symbol");
// TODO: Merge {@link #mSwitchState}, {@link #mIsAlphabetMode}, {@link #mAlphabetShiftState},
// {@link #mPrevMainKeyboardWasShiftLocked} into single state variable.
// {@link #mIsSymbolShifted}, {@link #mPrevMainKeyboardWasShiftLocked}, and
// {@link #mPrevSymbolsKeyboardWasShifted} into single state variable.
private static final int SWITCH_STATE_ALPHA = 0;
private static final int SWITCH_STATE_SYMBOL_BEGIN = 1;
private static final int SWITCH_STATE_SYMBOL = 2;
private static final int SWITCH_STATE_MOMENTARY_ALPHA_AND_SYMBOL = 3;
private static final int SWITCH_STATE_MOMENTARY_SYMBOL_AND_MORE = 4;
private static final int SWITCH_STATE_MOMENTARY_ALPHA_SHIFT = 5;
private int mSwitchState = SWITCH_STATE_ALPHA;
@ -77,7 +80,9 @@ public final class KeyboardState {
private boolean mIsAlphabetMode;
private boolean mIsEmojiMode;
private AlphabetShiftState mAlphabetShiftState = new AlphabetShiftState();
private boolean mIsSymbolShifted;
private boolean mPrevMainKeyboardWasShiftLocked;
private boolean mPrevSymbolsKeyboardWasShifted;
private int mRecapitalizeMode;
// For handling double tap.
@ -102,7 +107,7 @@ public final class KeyboardState {
} else if (mIsEmojiMode) {
return "EMOJI";
} else {
return "SYMBOLS";
return "SYMBOLS_" + shiftModeToString(mShiftMode);
}
}
}
@ -119,6 +124,7 @@ public final class KeyboardState {
// Reset alphabet shift state.
mAlphabetShiftState.setShiftLocked(false);
mPrevMainKeyboardWasShiftLocked = false;
mPrevSymbolsKeyboardWasShifted = false;
mShiftKeyState.onRelease();
mSymbolKeyState.onRelease();
onRestoreKeyboardState();
@ -139,6 +145,7 @@ public final class KeyboardState {
: (mAlphabetShiftState.isShiftedOrShiftLocked() ? MANUAL_SHIFT : UNSHIFT);
} else {
state.mIsAlphabetShiftLocked = mPrevMainKeyboardWasShiftLocked;
state.mShiftMode = mIsSymbolShifted ? MANUAL_SHIFT : UNSHIFT;
}
state.mIsValid = true;
if (DEBUG_EVENT) {
@ -156,7 +163,11 @@ public final class KeyboardState {
} else if (state.mIsEmojiMode) {
setEmojiKeyboard();
} else {
setSymbolsKeyboard();
if (state.mShiftMode == MANUAL_SHIFT) {
setSymbolsShiftedKeyboard();
} else {
setSymbolsKeyboard();
}
}
if (!state.mIsValid) return;
@ -232,8 +243,14 @@ public final class KeyboardState {
}
if (mIsAlphabetMode) {
mPrevMainKeyboardWasShiftLocked = mAlphabetShiftState.isShiftLocked();
setSymbolsKeyboard();
if (mPrevSymbolsKeyboardWasShifted) {
setSymbolsShiftedKeyboard();
} else {
setSymbolsKeyboard();
}
mPrevSymbolsKeyboardWasShifted = false;
} else {
mPrevSymbolsKeyboardWasShifted = mIsSymbolShifted;
setAlphabetKeyboard();
if (mPrevMainKeyboardWasShiftLocked) {
setShiftLocked(true);
@ -250,6 +267,7 @@ public final class KeyboardState {
}
if (mIsAlphabetMode) return;
mPrevSymbolsKeyboardWasShifted = mIsSymbolShifted;
setAlphabetKeyboard();
if (mPrevMainKeyboardWasShiftLocked) {
setShiftLocked(true);
@ -257,6 +275,14 @@ public final class KeyboardState {
mPrevMainKeyboardWasShiftLocked = false;
}
private void toggleShiftInSymbols() {
if (mIsSymbolShifted) {
setSymbolsKeyboard();
} else {
setSymbolsShiftedKeyboard();
}
}
private void setAlphabetKeyboard() {
if (DEBUG_ACTION) {
Log.d(TAG, "setAlphabetKeyboard");
@ -265,6 +291,7 @@ public final class KeyboardState {
mSwitchActions.setAlphabetKeyboard();
mIsAlphabetMode = true;
mIsEmojiMode = false;
mIsSymbolShifted = false;
mRecapitalizeMode = RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE;
mSwitchState = SWITCH_STATE_ALPHA;
mSwitchActions.requestUpdatingShiftState();
@ -276,6 +303,19 @@ public final class KeyboardState {
}
mSwitchActions.setSymbolsKeyboard();
mIsAlphabetMode = false;
mIsSymbolShifted = false;
// Reset alphabet shift state.
mAlphabetShiftState.setShiftLocked(false);
mSwitchState = SWITCH_STATE_SYMBOL_BEGIN;
}
private void setSymbolsShiftedKeyboard() {
if (DEBUG_ACTION) {
Log.d(TAG, "setSymbolsShiftedKeyboard");
}
mSwitchActions.setSymbolsShiftedKeyboard();
mIsAlphabetMode = false;
mIsSymbolShifted = true;
// Reset alphabet shift state.
mAlphabetShiftState.setShiftLocked(false);
mSwitchState = SWITCH_STATE_SYMBOL_BEGIN;
@ -337,7 +377,7 @@ public final class KeyboardState {
} else if (code == Constants.CODE_CAPSLOCK) {
setShiftLocked(!mAlphabetShiftState.isShiftLocked());
} else if (code == Constants.CODE_SWITCH_ALPHA_SYMBOL) {
onReleaseSymbol();
onReleaseSymbol(withSliding);
}
}
@ -347,11 +387,16 @@ public final class KeyboardState {
mSwitchState = SWITCH_STATE_MOMENTARY_ALPHA_AND_SYMBOL;
}
private void onReleaseSymbol() {
private void onReleaseSymbol(final boolean withSliding) {
if (mSymbolKeyState.isChording()) {
// Switch back to the previous keyboard mode if the user chords the mode change key and
// another key, then releases the mode change key.
toggleAlphabetAndSymbols();
} else if (!withSliding) {
// If the mode change key is being released without sliding, we should forget the
// previous symbols keyboard shift state and simply switch back to symbols layout
// (never symbols shifted) next time the mode gets changed to symbols layout.
mPrevSymbolsKeyboardWasShifted = false;
}
mSymbolKeyState.onRelease();
}
@ -417,43 +462,48 @@ public final class KeyboardState {
if (RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE != mRecapitalizeMode) {
return;
}
if (!mIsAlphabetMode) {
// There is no shift key on symbols keyboard.
return;
}
mIsInDoubleTapShiftKey = mSwitchActions.isInDoubleTapShiftKeyTimeout();
if (!mIsInDoubleTapShiftKey) {
// This is first tap.
mSwitchActions.startDoubleTapShiftKeyTimer();
}
if (mIsInDoubleTapShiftKey) {
if (mAlphabetShiftState.isManualShifted() || mIsInAlphabetUnshiftedFromShifted) {
// Shift key has been double tapped while in manual shifted or automatic
// shifted state.
setShiftLocked(true);
if (mIsAlphabetMode) {
mIsInDoubleTapShiftKey = mSwitchActions.isInDoubleTapShiftKeyTimeout();
if (!mIsInDoubleTapShiftKey) {
// This is first tap.
mSwitchActions.startDoubleTapShiftKeyTimer();
}
if (mIsInDoubleTapShiftKey) {
if (mAlphabetShiftState.isManualShifted() || mIsInAlphabetUnshiftedFromShifted) {
// Shift key has been double tapped while in manual shifted or automatic
// shifted state.
setShiftLocked(true);
} else {
// Shift key has been double tapped while in normal state. This is the second
// tap to disable shift locked state, so just ignore this.
}
} else {
// Shift key has been double tapped while in normal state. This is the second
// tap to disable shift locked state, so just ignore this.
if (mAlphabetShiftState.isShiftLocked()) {
// Shift key is pressed while shift locked state, we will treat this state as
// shift lock shifted state and mark as if shift key pressed while normal
// state.
setShifted(SHIFT_LOCK_SHIFTED);
mShiftKeyState.onPress();
} else if (mAlphabetShiftState.isAutomaticShifted()) {
// Shift key is pressed while automatic shifted, we have to move to manual
// shifted.
setShifted(MANUAL_SHIFT);
mShiftKeyState.onPress();
} else if (mAlphabetShiftState.isShiftedOrShiftLocked()) {
// In manual shifted state, we just record shift key has been pressing while
// shifted state.
mShiftKeyState.onPressOnShifted();
} else {
// In base layout, chording or manual shifted mode is started.
setShifted(MANUAL_SHIFT);
mShiftKeyState.onPress();
}
}
} else {
if (mAlphabetShiftState.isShiftLocked()) {
// Shift key is pressed while shift locked state, we will treat this state as
// shift lock shifted state and mark as if shift key pressed while normal state.
setShifted(SHIFT_LOCK_SHIFTED);
mShiftKeyState.onPress();
} else if (mAlphabetShiftState.isAutomaticShifted()) {
// Shift key is pressed while automatic shifted, we have to move to manual shifted.
setShifted(MANUAL_SHIFT);
mShiftKeyState.onPress();
} else if (mAlphabetShiftState.isShiftedOrShiftLocked()) {
// In manual shifted state, we just record shift key has been pressing while
// shifted state.
mShiftKeyState.onPressOnShifted();
} else {
// In base layout, chording or manual shifted mode is started.
setShifted(MANUAL_SHIFT);
mShiftKeyState.onPress();
}
// In symbol mode, just toggle symbol and symbol more keyboard.
toggleShiftInSymbols();
mSwitchState = SWITCH_STATE_MOMENTARY_SYMBOL_AND_MORE;
mShiftKeyState.onPress();
}
}
@ -508,7 +558,11 @@ public final class KeyboardState {
mIsInAlphabetUnshiftedFromShifted = true;
}
} else {
// There is no shift key on symbols keyboard.
// In symbol mode, switch back to the previous keyboard mode if the user chords the
// shift key and another key, then releases the shift key.
if (mShiftKeyState.isChording()) {
toggleShiftInSymbols();
}
}
mShiftKeyState.onRelease();
}
@ -522,6 +576,9 @@ public final class KeyboardState {
case SWITCH_STATE_MOMENTARY_ALPHA_AND_SYMBOL:
toggleAlphabetAndSymbols();
break;
case SWITCH_STATE_MOMENTARY_SYMBOL_AND_MORE:
toggleShiftInSymbols();
break;
case SWITCH_STATE_MOMENTARY_ALPHA_SHIFT:
setAlphabetKeyboard();
break;
@ -549,6 +606,13 @@ public final class KeyboardState {
}
}
break;
case SWITCH_STATE_MOMENTARY_SYMBOL_AND_MORE:
if (code == Constants.CODE_SHIFT) {
// Detected only the shift key has been pressed on symbol layout, and then
// released.
mSwitchState = SWITCH_STATE_SYMBOL_BEGIN;
}
break;
case SWITCH_STATE_SYMBOL_BEGIN:
if (!isSpaceCharacter(code) && (Constants.isLetterCode(code)
|| code == Constants.CODE_OUTPUT_TEXT)) {
@ -560,6 +624,7 @@ public final class KeyboardState {
// characters followed by a space/enter.
if (isSpaceCharacter(code)) {
toggleAlphabetAndSymbols();
mPrevSymbolsKeyboardWasShifted = false;
}
break;
}
@ -587,6 +652,7 @@ public final class KeyboardState {
case SWITCH_STATE_SYMBOL_BEGIN: return "SYMBOL-BEGIN";
case SWITCH_STATE_SYMBOL: return "SYMBOL";
case SWITCH_STATE_MOMENTARY_ALPHA_AND_SYMBOL: return "MOMENTARY-ALPHA-SYMBOL";
case SWITCH_STATE_MOMENTARY_SYMBOL_AND_MORE: return "MOMENTARY-SYMBOL-MORE";
case SWITCH_STATE_MOMENTARY_ALPHA_SHIFT: return "MOMENTARY-ALPHA_SHIFT";
default: return null;
}
@ -594,7 +660,8 @@ public final class KeyboardState {
@Override
public String toString() {
return "[keyboard=" + (mIsAlphabetMode ? mAlphabetShiftState.toString() : "SYMBOLS")
return "[keyboard=" + (mIsAlphabetMode ? mAlphabetShiftState.toString()
: (mIsSymbolShifted ? "SYMBOLS_SHIFTED" : "SYMBOLS"))
+ " shift=" + mShiftKeyState
+ " symbol=" + mSymbolKeyState
+ " switch=" + switchStateToString(mSwitchState) + "]";

View file

@ -30,9 +30,9 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED);
// Press "?123" key and hold, enter into choring symbols state.
pressKey(CODE_SYMBOL, SYMBOLS);
pressKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED);
// Press/release symbol letter key.
chordingPressAndReleaseKey('1', SYMBOLS, SYMBOLS);
chordingPressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Release "ABC" key, switch back to alphabet.
releaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
}
@ -50,9 +50,9 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
releaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
// Press "?123" key and hold, enter into choring symbols state.
pressKey(CODE_SYMBOL, SYMBOLS);
pressKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED);
// Press/release symbol letter key.
chordingPressAndReleaseKey('1', SYMBOLS, SYMBOLS);
chordingPressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Release "123?" key, switch back to alphabet unshifted.
releaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
}
@ -71,9 +71,9 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
releaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCKED);
// Press "?123" key and hold, enter into choring symbols state.
pressKey(CODE_SYMBOL, SYMBOLS);
pressKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED);
// Press/release symbol letter key.
chordingPressAndReleaseKey('1', SYMBOLS, SYMBOLS);
chordingPressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Release "123?" key, switch back to alphabet shift locked.
releaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED);
}
@ -81,14 +81,21 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
// Chording input in symbols.
public void testChordingSymbols() {
// Press/release "?123" key, enter symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press "=\<" key and hold, enter into choring symbols shifted state.
pressKey(CODE_SHIFT, SYMBOLS_SHIFTED);
// Press/release symbol letter key.
chordingPressAndReleaseKey('1', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Release "=\<" key, switch back to symbols.
releaseKey(CODE_SHIFT, SYMBOLS_UNSHIFTED);
// Press "ABC" key and hold, enter into choring alphabet state.
pressKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
// Press/release letter key.
chordingPressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Release "ABC" key, switch back to symbols.
releaseKey(CODE_SYMBOL, SYMBOLS);
releaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED);
// Alphabet shifted -> symbols -> "ABC" key + letter -> symbols
// -> alphabet.
@ -97,13 +104,13 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
// Press/release shift key, enter alphabet shifted.
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press "ABC" key, enter into chording alphabet state.
pressKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
// Enter/release letter key.
chordingPressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Release "ABC" key, switch back to symbols.
releaseKey(CODE_SYMBOL, SYMBOLS);
releaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, switch to alphabet (not alphabet shifted).
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
@ -115,13 +122,112 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press "ABC" key, enter into chording alphabet shift locked.
pressKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED);
// Enter/release letter key.
chordingPressAndReleaseKey('A', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Release "ABC" key, switch back to symbols.
releaseKey(CODE_SYMBOL, SYMBOLS);
releaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Alphabet shift locked -> symbols -> "=\<" key + letter -> symbols ->
// alphabet shift locked.
// Load keyboard
loadKeyboard(ALPHABET_UNSHIFTED);
// Long press shift key, enter alphabet shift locked.
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press "=\<" key, enter into symbols shifted chording state.
pressKey(CODE_SHIFT, SYMBOLS_SHIFTED);
// Enter/release symbols shift letter key.
chordingPressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Release "=\<" key, switch back to symbols.
releaseKey(CODE_SHIFT, SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
}
// Chording input in symbol shifted.
public void testChordingSymbolsShifted() {
// Press/release "?123" key, enter symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press "?123" key and hold, enter into chording symbols state.
pressKey(CODE_SHIFT, SYMBOLS_UNSHIFTED);
// Press/release symbol letter key.
chordingPressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Release "=\<" key, switch back to symbols shifted state.
releaseKey(CODE_SHIFT, SYMBOLS_SHIFTED);
// Press "ABC" key and hold, enter into choring alphabet state.
pressKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
// Press/release letter key.
chordingPressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Release "ABC" key, switch back to symbols.
releaseKey(CODE_SYMBOL, SYMBOLS_SHIFTED);
// Alphabet shifted -> symbols shifted -> "ABC" key + letter -> symbols shifted ->
// alphabet.
// Load keyboard
loadKeyboard(ALPHABET_UNSHIFTED);
// Press/release shift key, enter alphabet shifted.
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press "ABC" key, enter into chording alphabet state.
pressKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
// Enter/release letter key.
chordingPressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Release "ABC" key, switch back to symbols shifted.
releaseKey(CODE_SYMBOL, SYMBOLS_SHIFTED);
// Press/release "ABC" key, switch to alphabet (not alphabet shifted).
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Alphabet shift locked -> symbols shifted -> "ABC" key + letter -> symbols shifted
// -> alphabet shift locked.
// Load keyboard
loadKeyboard(ALPHABET_UNSHIFTED);
// Long press shift key, enter alphabet shift locked.
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press "ABC" key, enter into chording alphabet shift locked.
pressKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED);
// Enter/release letter key.
chordingPressAndReleaseKey('A', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Release "ABC" key, switch back to symbols shifted.
releaseKey(CODE_SYMBOL, SYMBOLS_SHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Alphabet shift locked -> symbols shifted -> "=\<" key + letter -> symbols shifted
// -> alphabet shift locked.
// Load keyboard
loadKeyboard(ALPHABET_UNSHIFTED);
// Long press shift key, enter alphabet shift locked.
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press "=\<" key, enter into symbols chording state.
pressKey(CODE_SHIFT, SYMBOLS_UNSHIFTED);
// Enter/release symbols letter key.
chordingPressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Release "=\<" key, switch back to symbols shifted.
releaseKey(CODE_SHIFT, SYMBOLS_SHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
}
@ -143,9 +249,9 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
// Update shift state with auto caps enabled.
pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
// Press "123?" key and hold, enter into chording symbols state.
pressKey(CODE_SYMBOL, SYMBOLS);
pressKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED);
// Press/release symbol letter key.
chordingPressAndReleaseKey('1', SYMBOLS, SYMBOLS);
chordingPressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Release "123?" key, switch back to alphabet.
releaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
}

View file

@ -34,14 +34,38 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
pressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
}
// Shift key in symbols.
public void testShiftSymbols() {
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press/release "?123" key, back to symbols.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press/release symbol letter key, remain in symbols shifted.
pressAndReleaseKey('1', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
}
// Switching between alphabet and symbols.
public void testAlphabetAndSymbols() {
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, back to alphabet.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press/release "ABC" key, back to alphabet.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Press/release "?123" key, back to symbols (not symbols shifted).
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
}
// Switching between alphabet shifted and symbols.
@ -50,7 +74,16 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, back to alphabet (not alphabet shifted).
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Press/release shift key, enter into alphabet shifted.
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\< key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press/release "ABC" key, back to alphabet (not alphabet shifted).
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
}
@ -62,21 +95,39 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, back to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press/release "ABC" key, back to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, back to symbols (not symbols shifted).
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
}
// Automatic switch back to alphabet by space key.
public void testSwitchBackBySpace() {
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter symbol letter.
pressAndReleaseKey('1', SYMBOLS, SYMBOLS);
pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter space, switch back to alphabet.
pressAndReleaseKey(CODE_SPACE, SYMBOLS, ALPHABET_UNSHIFTED);
pressAndReleaseKey(CODE_SPACE, SYMBOLS_UNSHIFTED, ALPHABET_UNSHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Enter symbol shift letter.
pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Enter space, switch back to alphabet.
pressAndReleaseKey(CODE_SPACE, SYMBOLS_SHIFTED, ALPHABET_UNSHIFTED);
// Press/release "?123" key, enter into symbols (not symbols shifted).
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
}
// Automatic switch back to alphabet shift locked test by space key.
@ -86,11 +137,20 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter symbol letter.
pressAndReleaseKey('1', SYMBOLS, SYMBOLS);
pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter space, switch back to alphabet shift locked.
pressAndReleaseKey(CODE_SPACE, SYMBOLS, ALPHABET_SHIFT_LOCKED);
pressAndReleaseKey(CODE_SPACE, SYMBOLS_UNSHIFTED, ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Enter symbol shift letter.
pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Enter space, switch back to alphabet shift locked.
pressAndReleaseKey(CODE_SPACE, SYMBOLS_SHIFTED, ALPHABET_SHIFT_LOCKED);
}
// Automatic upper case test
@ -113,11 +173,20 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release symbol letter key, remain in symbols.
pressAndReleaseKey('1', SYMBOLS, SYMBOLS);
pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release space, switch back to automatic shifted.
pressAndReleaseKey(CODE_SPACE, SYMBOLS, ALPHABET_AUTOMATIC_SHIFTED);
pressAndReleaseKey(CODE_SPACE, SYMBOLS_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press/release symbol shift letter key, remain in symbols shifted.
pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press/release space, switch back to automatic shifted.
pressAndReleaseKey(CODE_SPACE, SYMBOLS_SHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
}
// Long press shift key.
@ -233,9 +302,14 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
ALPHABET_UNSHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Update shift state, remained in symbols.
updateShiftState(SYMBOLS);
updateShiftState(SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Update shift state, remained in symbols shifted.
updateShiftState(SYMBOLS_SHIFTED);
// Set capitalize the first character of all words mode.
setAutoCapsMode(CAP_MODE_WORDS);
@ -263,9 +337,14 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
// Load keyboard, should be in automatic shifted.
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Update shift state, remained in symbols.
updateShiftState(SYMBOLS);
updateShiftState(SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Update shift state, remained in symbols shifted.
updateShiftState(SYMBOLS_SHIFTED);
}
// Sliding input in alphabet.
@ -279,10 +358,10 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
// Alphabet -> "?123" key + letter -> alphabet.
// Press and slide from "123?" key, enter symbols.
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter/release into symbol letter keys, switch back to alphabet.
pressAndSlideFromKey('@', SYMBOLS, SYMBOLS);
stopSlidingOnKey('!', SYMBOLS, ALPHABET_UNSHIFTED);
pressAndSlideFromKey('@', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
stopSlidingOnKey('!', SYMBOLS_UNSHIFTED, ALPHABET_UNSHIFTED);
// Alphabet shifted -> shift key + letter -> alphabet.
// Press/release shift key, enter alphabet shifted.
@ -297,20 +376,20 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
// Press/release shift key, enter alphabet shifted.
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Press and slide from "123?" key, enter symbols.
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter/release into symbol letter keys, switch back to alphabet (not alphabet shifted).
pressAndSlideFromKey('@', SYMBOLS, SYMBOLS);
stopSlidingOnKey('!', SYMBOLS, ALPHABET_UNSHIFTED);
pressAndSlideFromKey('@', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
stopSlidingOnKey('!', SYMBOLS_UNSHIFTED, ALPHABET_UNSHIFTED);
// Alphabet shift locked -> shift key + letter -> alphabet shift locked.
// Long press shift key, enter alphabet shift locked.
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press and slide from "123?" key, enter symbols.
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter/release into symbol letter keys, switch back to alphabet shift locked.
pressAndSlideFromKey('!', SYMBOLS, SYMBOLS);
stopSlidingOnKey('!', SYMBOLS, ALPHABET_SHIFT_LOCKED);
pressAndSlideFromKey('!', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
stopSlidingOnKey('!', SYMBOLS_UNSHIFTED, ALPHABET_SHIFT_LOCKED);
// Alphabet shift locked -> "?123" key + letter -> alphabet shift locked.
// Press and slide from shift key, enter alphabet shifted.
@ -334,9 +413,9 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
// Alphabet -> "?123" key + letter -> cancel -> alphabet.
// Press and slide from "123?" key, enter symbols.
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter/release into symbol letter key, remains in symbols.
pressAndSlideFromKey('!', SYMBOLS, SYMBOLS);
pressAndSlideFromKey('!', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Cancel sliding, switch back to alphabet.
stopSlidingAndCancel(ALPHABET_UNSHIFTED);
@ -354,9 +433,9 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
// Press/release shift key, enter alphabet shifted.
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Press and slide from "123?" key, enter symbols.
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter/release into symbol letter key, remains in symbols.
pressAndSlideFromKey('!', SYMBOLS, SYMBOLS);
pressAndSlideFromKey('!', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Cancel sliding, switch back to alphabet (not alphabet shifted).
stopSlidingAndCancel(ALPHABET_UNSHIFTED);
@ -365,9 +444,9 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press and slide from "123?" key, enter symbols.
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter/release into symbol letter key, remains in symbols.
pressAndSlideFromKey('!', SYMBOLS, SYMBOLS);
pressAndSlideFromKey('!', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Cancel sliding, switch back to alphabet shift locked.
stopSlidingAndCancel( ALPHABET_SHIFT_LOCKED);
@ -382,14 +461,21 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
// Sliding input in symbols.
public void testSlidingSymbols() {
// Symbols -> "=\<" key + letter -> symbols.
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press and slide from shift key, enter symbols shifted.
pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Enter/release symbol shifted letter keys, switch back to symbols.
pressAndSlideFromKey('|', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
stopSlidingOnKey('~', SYMBOLS_SHIFTED, SYMBOLS_UNSHIFTED);
// Symbols -> "ABC" key + letter -> Symbols.
// Press and slide from "ABC" key, enter alphabet.
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Enter/release letter keys, switch back to symbols.
pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
stopSlidingOnKey('a', ALPHABET_UNSHIFTED, SYMBOLS);
stopSlidingOnKey('a', ALPHABET_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, switch to alphabet.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
@ -400,12 +486,12 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
// Press/release shift key, enter alphabet shifted.
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press and slide from "ABC" key.
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Enter/release letter keys, switch back to symbols.
pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
stopSlidingOnKey('a', ALPHABET_UNSHIFTED, SYMBOLS);
stopSlidingOnKey('a', ALPHABET_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, switch to alphabet (not alphabet shifted).
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
@ -417,27 +503,52 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press and slide from "ABC" key, enter alphabet shift locked.
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Enter/release letter keys, switch back to symbols.
pressAndSlideFromKey('Z', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
stopSlidingOnKey('A', ALPHABET_SHIFT_LOCKED, SYMBOLS);
stopSlidingOnKey('A', ALPHABET_SHIFT_LOCKED, SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Alphabet shift locked -> symbols -> "=\<" key + letter -> symbols ->
// alphabet shift locked.
// Load keyboard
loadKeyboard(ALPHABET_UNSHIFTED);
// Long press shift key, enter alphabet shift locked.
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press and slide from "=\<" key, enter symbols shifted.
pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Enter/release symbols shift letter keys, switch back to symbols.
pressAndSlideFromKey('|', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
stopSlidingOnKey('~', SYMBOLS_SHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
}
// Cancel sliding input in symbols.
public void testSlidingSymbolsCancel() {
// Symbols -> "=\<" key + letter -> cancel -> symbols.
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press and slide from shift key, enter symbols shifted.
pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Enter/release symbol shifted letter key, remains in symbols shifted.
pressAndSlideFromKey('|', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Cancel sliding, switch back to symbols.
stopSlidingAndCancel(SYMBOLS_UNSHIFTED);
// Symbols -> "ABC" key + letter -> Symbols.
// Press and slide from "ABC" key, enter alphabet.
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Enter/release letter keys, remains in alphabet.
pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Cancel sliding, switch back to symbols.
stopSlidingAndCancel(SYMBOLS);
stopSlidingAndCancel(SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, switch to alphabet.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
@ -448,13 +559,13 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
// Press/release shift key, enter alphabet shifted.
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press and slide from "ABC" key.
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Enter/release letter key, remains in alphabet.
pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Cancel sliding, switch back to symbols.
stopSlidingAndCancel(SYMBOLS);
stopSlidingAndCancel(SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, switch to alphabet (not alphabet shifted).
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
@ -466,13 +577,194 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press and slide from "ABC" key, enter alphabet shift locked.
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Enter/release letter key, remains in alphabet shifted.
pressAndSlideFromKey('Z', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Cancel sliding, switch back to symbols.
stopSlidingAndCancel(SYMBOLS);
stopSlidingAndCancel(SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Alphabet shift locked -> symbols -> "=\<" key + letter -> symbols ->
// alphabet shift locked.
// Load keyboard
loadKeyboard(ALPHABET_UNSHIFTED);
// Long press shift key, enter alphabet shift locked.
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press and slide from "=\<" key, enter symbols shifted.
pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Enter/release symbols shift letter key, remains in symbols shifted.
pressAndSlideFromKey('|', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Cancel sliding, switch back to symbols.
stopSlidingAndCancel(SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
}
// Sliding input in symbols shifted.
public void testSlidingSymbolsShifted() {
// Symbols shifted -> "?123" + letter -> symbols shifted.
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press and slide from shift key, enter symbols.
pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter/release symbol letter keys, switch back to symbols shifted.
pressAndSlideFromKey('2', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
stopSlidingOnKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_SHIFTED);
// Symbols shifted -> "ABC" key + letter -> symbols shifted.
// Press and slide from "ABC" key, enter alphabet.
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Enter/release letter keys, switch back to symbols shifted.
pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
stopSlidingOnKey('a', ALPHABET_UNSHIFTED, SYMBOLS_SHIFTED);
// Press/release "ABC" key, switch to alphabet.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Alphabet shifted -> symbols shifted -> "ABC" + letter -> symbols shifted ->
// alphabet.
// Load keyboard
loadKeyboard(ALPHABET_UNSHIFTED);
// Press/release shift key, enter alphabet shifted.
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press and slide from "ABC" key.
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Enter/release letter keys, switch back to symbols shifted.
pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
stopSlidingOnKey('a', ALPHABET_UNSHIFTED, SYMBOLS_SHIFTED);
// Press/release "ABC" key, switch to alphabet (not alphabet shifted).
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Alphabet shift locked -> symbols shifted -> "ABC" + letter -> symbols shifted ->
// alphabet shift locked.
// Load keyboard
loadKeyboard(ALPHABET_UNSHIFTED);
// Long press shift key, enter alphabet shift locked.
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press and slide from "ABC" key.
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Enter/release letter keys, switch back to symbols shifted.
pressAndSlideFromKey('Z', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
stopSlidingOnKey('A', ALPHABET_SHIFT_LOCKED, SYMBOLS_SHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Alphabet shift locked -> symbols shifted -> "?123" + letter -> symbols shifted ->
// alphabet shift locked.
// Load keyboard
loadKeyboard(ALPHABET_UNSHIFTED);
// Long press shift key, enter alphabet shift locked.
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press and slide from "?123" key.
pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter/release symbol letter keys, switch back to symbols shifted.
pressAndSlideFromKey('2', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
stopSlidingOnKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_SHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
}
// Cancel sliding input in symbols shifted.
public void testSlidingSymbolsShiftedCancel() {
// Symbols shifted -> "?123" + letter -> symbols shifted.
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press and slide from shift key, enter symbols.
pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter/release symbol letter key, remains in symbols.
pressAndSlideFromKey('2', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Cancel sliding, switch back to symbols shifted.
stopSlidingAndCancel(SYMBOLS_SHIFTED);
// Symbols shifted -> "ABC" key + letter -> symbols shifted.
// Press and slide from "ABC" key, enter alphabet.
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Enter/release letter key, remains in alphabet.
pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Cancel sliding, switch back to symbols shifted.
stopSlidingAndCancel(SYMBOLS_SHIFTED);
// Press/release "ABC" key, switch to alphabet.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Alphabet shifted -> symbols shifted -> "ABC" + letter -> symbols shifted ->
// alphabet.
// Load keyboard
loadKeyboard(ALPHABET_UNSHIFTED);
// Press/release shift key, enter alphabet shifted.
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press and slide from "ABC" key.
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Enter/release letter key, remains in alphabet.
pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Cancel sliding, switch back to symbols shifted.
stopSlidingAndCancel(SYMBOLS_SHIFTED);
// Press/release "ABC" key, switch to alphabet (not alphabet shifted).
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Alphabet shift locked -> symbols shifted -> "ABC" + letter -> symbols shifted ->
// alphabet shift locked.
// Load keyboard
loadKeyboard(ALPHABET_UNSHIFTED);
// Long press shift key, enter alphabet shift locked.
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press and slide from "ABC" key.
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Enter/release letter key, remains in alphabet shift locked.
pressAndSlideFromKey('Z', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Cancel sliding, switch back to symbols shifted.
stopSlidingAndCancel(SYMBOLS_SHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Alphabet shift locked -> symbols shifted -> "?123" + letter -> symbols shifted ->
// alphabet shift locked.
// Load keyboard
loadKeyboard(ALPHABET_UNSHIFTED);
// Long press shift key, enter alphabet shift locked.
longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press and slide from "?123" key.
pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter/release symbol letter key, remains in symbols.
pressAndSlideFromKey('2', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Cancel sliding, switch back to symbols shifted.
stopSlidingAndCancel(SYMBOLS_SHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
}
@ -491,7 +783,14 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
loadKeyboard(ALPHABET_UNSHIFTED);
// Press/release "?123" key.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Change focus to new text field.
loadKeyboard(ALPHABET_UNSHIFTED);
// Press/release "?123" key.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Change focus to new text field.
loadKeyboard(ALPHABET_UNSHIFTED);
}
@ -515,7 +814,14 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
// Press/release "?123" key.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Change focus to new text field.
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
// Press/release "?123" key.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Change focus to new text field.
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
}
@ -554,11 +860,49 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
// Alphabet shift locked -> symbols -> rotate -> symbols ->
// Alphabet shift locked.
// Press/release "?123" key, enter symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS, SYMBOLS);
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Rotate device, remain in symbols,
rotateDevice(SYMBOLS);
rotateDevice(SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, alphabet shift locked state should be maintained.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Alphabet shift locked -> symbols shifted -> rotate -> symbols shifted ->
// Alphabet shift locked.
// Press/release "?123" key, enter symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Rotate device, remain in symbols shifted.
rotateDevice(SYMBOLS_SHIFTED);
// Press/release "ABC" key, alphabet shift locked state should be maintained.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Alphabet shift locked -> symbols shifted -> alphabet shift locked -> rotate ->
// Alphabet shift locked -> symbols.
// Press/release "?123" key, enter symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press/release "ABC" key, enter alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Rotate device, remain in alphabet shift locked.
rotateDevice(ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter symbols (not symbols shifted).
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Alphabet -> symbols shifted -> alphabet -> rotate ->
// Alphabet -> symbols.
loadKeyboard(ALPHABET_UNSHIFTED);
// Press/release "?123" key, enter symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press/release "ABC" key, enter alphabet.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Rotate device, remain in alphabet shift locked.
rotateDevice(ALPHABET_UNSHIFTED);
// Press/release "?123" key, enter symbols (not symbols shifted).
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
}
// Rapidly type shift key.

View file

@ -43,7 +43,8 @@ public class MockKeyboardSwitcher implements KeyboardState.SwitchActions {
public static final int ALPHABET_AUTOMATIC_SHIFTED = 2;
public static final int ALPHABET_SHIFT_LOCKED = 3;
public static final int ALPHABET_SHIFT_LOCK_SHIFTED = 4;
public static final int SYMBOLS = 5;
public static final int SYMBOLS_UNSHIFTED = 5;
public static final int SYMBOLS_SHIFTED = 6;
}
private int mLayout = MockConstants.ALPHABET_UNSHIFTED;
@ -68,7 +69,8 @@ public class MockKeyboardSwitcher implements KeyboardState.SwitchActions {
case MockConstants.ALPHABET_AUTOMATIC_SHIFTED: return "ALPHABET_AUTOMATIC_SHIFTED";
case MockConstants.ALPHABET_SHIFT_LOCKED: return "ALPHABET_SHIFT_LOCKED";
case MockConstants.ALPHABET_SHIFT_LOCK_SHIFTED: return "ALPHABET_SHIFT_LOCK_SHIFTED";
case MockConstants.SYMBOLS: return "SYMBOLS";
case MockConstants.SYMBOLS_UNSHIFTED: return "SYMBOLS_UNSHIFTED";
case MockConstants.SYMBOLS_SHIFTED: return "SYMBOLS_SHIFTED";
default: return "UNKNOWN<" + layoutId + ">";
}
}
@ -109,7 +111,12 @@ public class MockKeyboardSwitcher implements KeyboardState.SwitchActions {
@Override
public void setSymbolsKeyboard() {
mLayout = MockConstants.SYMBOLS;
mLayout = MockConstants.SYMBOLS_UNSHIFTED;
}
@Override
public void setSymbolsShiftedKeyboard() {
mLayout = MockConstants.SYMBOLS_SHIFTED;
}
@Override