am 7291fbce: am 16531ad5: Merge "More precise KeyboardState unit test" into jb-dev
* commit '7291fbce4776519f764a4a175951a9ae2a1c2a30': More precise KeyboardState unit testmain
commit
9afa42ddf0
|
@ -57,7 +57,8 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
|
||||||
// Chording input in shift locked.
|
// Chording input in shift locked.
|
||||||
public void testChordingShiftLocked() {
|
public void testChordingShiftLocked() {
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
|
|
||||||
// Press shift key and hold, enter into choring shift state.
|
// Press shift key and hold, enter into choring shift state.
|
||||||
pressKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED);
|
pressKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED);
|
||||||
|
@ -115,7 +116,8 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
|
||||||
// Load keyboard
|
// Load keyboard
|
||||||
loadKeyboard(ALPHABET_UNSHIFTED);
|
loadKeyboard(ALPHABET_UNSHIFTED);
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release "?123" key, enter into symbols.
|
// Press/release "?123" key, enter into symbols.
|
||||||
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
||||||
// Press "ABC" key, enter into chording alphabet shift locked.
|
// Press "ABC" key, enter into chording alphabet shift locked.
|
||||||
|
@ -132,7 +134,8 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
|
||||||
// Load keyboard
|
// Load keyboard
|
||||||
loadKeyboard(ALPHABET_UNSHIFTED);
|
loadKeyboard(ALPHABET_UNSHIFTED);
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release "?123" key, enter into symbols.
|
// Press/release "?123" key, enter into symbols.
|
||||||
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
||||||
// Press "=\<" key, enter into symbols shifted chording state.
|
// Press "=\<" key, enter into symbols shifted chording state.
|
||||||
|
@ -190,7 +193,8 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
|
||||||
// Load keyboard
|
// Load keyboard
|
||||||
loadKeyboard(ALPHABET_UNSHIFTED);
|
loadKeyboard(ALPHABET_UNSHIFTED);
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release "?123" key, enter into symbols.
|
// Press/release "?123" key, enter into symbols.
|
||||||
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
||||||
// Press/release "=\<" key, enter symbols shifted.
|
// Press/release "=\<" key, enter symbols shifted.
|
||||||
|
@ -209,7 +213,8 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
|
||||||
// Load keyboard
|
// Load keyboard
|
||||||
loadKeyboard(ALPHABET_UNSHIFTED);
|
loadKeyboard(ALPHABET_UNSHIFTED);
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release "?123" key, enter into symbols.
|
// Press/release "?123" key, enter into symbols.
|
||||||
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
||||||
// Press/release "=\<" key, enter symbols shifted.
|
// Press/release "=\<" key, enter symbols shifted.
|
||||||
|
|
|
@ -88,7 +88,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
// Switching between alphabet shift locked and symbols.
|
// Switching between alphabet shift locked and symbols.
|
||||||
public void testAlphabetShiftLockedAndSymbols() {
|
public void testAlphabetShiftLockedAndSymbols() {
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
|
|
||||||
// Press/release "?123" key, enter into symbols.
|
// Press/release "?123" key, enter into symbols.
|
||||||
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
||||||
|
@ -129,7 +130,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
// Automatic switch back to alphabet shift locked test by space key.
|
// Automatic switch back to alphabet shift locked test by space key.
|
||||||
public void testSwitchBackBySpaceShiftLocked() {
|
public void testSwitchBackBySpaceShiftLocked() {
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
|
|
||||||
// Press/release "?123" key, enter into symbols.
|
// Press/release "?123" key, enter into symbols.
|
||||||
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
||||||
|
@ -181,7 +183,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
setLayoutSwitchBackSymbols(switchBackSymbols);
|
setLayoutSwitchBackSymbols(switchBackSymbols);
|
||||||
loadKeyboard(ALPHABET_UNSHIFTED);
|
loadKeyboard(ALPHABET_UNSHIFTED);
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
|
|
||||||
// Press/release "?123" key, enter into symbols.
|
// Press/release "?123" key, enter into symbols.
|
||||||
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
||||||
|
@ -243,12 +246,14 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
// Load keyboard, should be in alphabet.
|
// Load keyboard, should be in alphabet.
|
||||||
loadKeyboard(ALPHABET_UNSHIFTED);
|
loadKeyboard(ALPHABET_UNSHIFTED);
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release shift key, back to alphabet.
|
// Press/release shift key, back to alphabet.
|
||||||
pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
|
pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
|
||||||
|
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release letter key, remain in shift locked.
|
// Press/release letter key, remain in shift locked.
|
||||||
pressAndReleaseKey('A', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
|
pressAndReleaseKey('A', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release word separator, remain in shift locked.
|
// Press/release word separator, remain in shift locked.
|
||||||
|
@ -257,14 +262,17 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
|
pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
|
||||||
|
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Long press shift key, back to alphabet.
|
// Long press shift key, back to alphabet.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED,
|
||||||
|
ALPHABET_UNSHIFTED);
|
||||||
|
|
||||||
// Press/release shift key, enter alphabet shifted.
|
// Press/release shift key, enter alphabet shifted.
|
||||||
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
|
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release shift key, back to alphabet.
|
// Press/release shift key, back to alphabet.
|
||||||
pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
|
pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
|
||||||
|
|
||||||
|
@ -273,7 +281,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
// Load keyboard, should be in automatic shifted.
|
// Load keyboard, should be in automatic shifted.
|
||||||
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
|
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release shift key, back to alphabet.
|
// Press/release shift key, back to alphabet.
|
||||||
pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
|
pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
|
||||||
}
|
}
|
||||||
|
@ -334,11 +343,13 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
updateShiftState(ALPHABET_UNSHIFTED);
|
updateShiftState(ALPHABET_UNSHIFTED);
|
||||||
|
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Update shift state, remained in alphabet shift locked.
|
// Update shift state, remained in alphabet shift locked.
|
||||||
updateShiftState(ALPHABET_SHIFT_LOCKED);
|
updateShiftState(ALPHABET_SHIFT_LOCKED);
|
||||||
// Long press shift key, back to alphabet.
|
// Long press shift key, back to alphabet.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED,
|
||||||
|
ALPHABET_UNSHIFTED);
|
||||||
|
|
||||||
// Press/release "?123" key, enter into symbols.
|
// Press/release "?123" key, enter into symbols.
|
||||||
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
||||||
|
@ -365,11 +376,13 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
updateShiftState(ALPHABET_AUTOMATIC_SHIFTED);
|
updateShiftState(ALPHABET_AUTOMATIC_SHIFTED);
|
||||||
|
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Update shift state, remained in alphabet shift locked (not automatic shifted).
|
// Update shift state, remained in alphabet shift locked (not automatic shifted).
|
||||||
updateShiftState(ALPHABET_SHIFT_LOCKED);
|
updateShiftState(ALPHABET_SHIFT_LOCKED);
|
||||||
// Long press shift key, back to alphabet.
|
// Long press shift key, back to alphabet.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED,
|
||||||
|
ALPHABET_UNSHIFTED);
|
||||||
|
|
||||||
// Load keyboard, should be in automatic shifted.
|
// Load keyboard, should be in automatic shifted.
|
||||||
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
|
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
|
||||||
|
@ -416,7 +429,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
|
|
||||||
// Alphabet shift locked -> shift key + letter -> alphabet shift locked.
|
// Alphabet shift locked -> shift key + letter -> alphabet shift locked.
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press and slide from "123?" key, enter symbols.
|
// Press and slide from "123?" key, enter symbols.
|
||||||
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
||||||
// Enter/release into symbol letter key, switch back to alphabet shift locked.
|
// Enter/release into symbol letter key, switch back to alphabet shift locked.
|
||||||
|
@ -467,7 +481,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
// Load keyboard
|
// Load keyboard
|
||||||
loadKeyboard(ALPHABET_UNSHIFTED);
|
loadKeyboard(ALPHABET_UNSHIFTED);
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release "?123" key, enter into symbols.
|
// Press/release "?123" key, enter into symbols.
|
||||||
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
||||||
// Press and slide from "ABC" key, enter alphabet shift locked.
|
// Press and slide from "ABC" key, enter alphabet shift locked.
|
||||||
|
@ -482,7 +497,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
// Load keyboard
|
// Load keyboard
|
||||||
loadKeyboard(ALPHABET_UNSHIFTED);
|
loadKeyboard(ALPHABET_UNSHIFTED);
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release "?123" key, enter into symbols.
|
// Press/release "?123" key, enter into symbols.
|
||||||
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
||||||
// Press and slide from "=\<" key, enter symbols shifted.
|
// Press and slide from "=\<" key, enter symbols shifted.
|
||||||
|
@ -535,7 +551,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
// Load keyboard
|
// Load keyboard
|
||||||
loadKeyboard(ALPHABET_UNSHIFTED);
|
loadKeyboard(ALPHABET_UNSHIFTED);
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release "?123" key, enter into symbols.
|
// Press/release "?123" key, enter into symbols.
|
||||||
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
||||||
// Press/release "=\<" key, enter into symbols shifted.
|
// Press/release "=\<" key, enter into symbols shifted.
|
||||||
|
@ -552,7 +569,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
// Load keyboard
|
// Load keyboard
|
||||||
loadKeyboard(ALPHABET_UNSHIFTED);
|
loadKeyboard(ALPHABET_UNSHIFTED);
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release "?123" key, enter into symbols.
|
// Press/release "?123" key, enter into symbols.
|
||||||
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
||||||
// Press/release "=\<" key, enter into symbols shifted.
|
// Press/release "=\<" key, enter into symbols shifted.
|
||||||
|
@ -573,7 +591,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
loadKeyboard(ALPHABET_UNSHIFTED);
|
loadKeyboard(ALPHABET_UNSHIFTED);
|
||||||
|
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Change focus to new text field.
|
// Change focus to new text field.
|
||||||
loadKeyboard(ALPHABET_UNSHIFTED);
|
loadKeyboard(ALPHABET_UNSHIFTED);
|
||||||
|
|
||||||
|
@ -603,7 +622,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
|
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
|
||||||
|
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Change focus to new text field.
|
// Change focus to new text field.
|
||||||
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
|
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
|
||||||
|
|
||||||
|
@ -635,7 +655,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
|
|
||||||
// Alphabet shift locked -> rotate -> alphabet shift locked.
|
// Alphabet shift locked -> rotate -> alphabet shift locked.
|
||||||
// Long press shift key, enter alphabet shift locked.
|
// Long press shift key, enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Rotate device, remain in alphabet shift locked.
|
// Rotate device, remain in alphabet shift locked.
|
||||||
rotateDevice(ALPHABET_SHIFT_LOCKED);
|
rotateDevice(ALPHABET_SHIFT_LOCKED);
|
||||||
|
|
||||||
|
@ -718,7 +739,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
|
secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
|
||||||
|
|
||||||
// Long press shift key to enter alphabet shift locked.
|
// Long press shift key to enter alphabet shift locked.
|
||||||
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
// Press/release shift key
|
// Press/release shift key
|
||||||
pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
|
pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
|
||||||
// Rapidly press/release letter key.
|
// Rapidly press/release letter key.
|
||||||
|
|
|
@ -42,31 +42,32 @@ public class KeyboardStateTestsBase extends AndroidTestCase
|
||||||
mLayoutSwitchBackSymbols = switchBackSymbols;
|
mLayoutSwitchBackSymbols = switchBackSymbols;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void assertLayout(int expected, int actual) {
|
private static void assertLayout(String message, int expected, int actual) {
|
||||||
assertTrue("expected=" + MockKeyboardSwitcher.getLayoutName(expected)
|
assertTrue(message + ": expected=" + MockKeyboardSwitcher.getLayoutName(expected)
|
||||||
+ " actual=" + MockKeyboardSwitcher.getLayoutName(actual),
|
+ " actual=" + MockKeyboardSwitcher.getLayoutName(actual),
|
||||||
expected == actual);
|
expected == actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateShiftState(int afterUpdate) {
|
public void updateShiftState(int afterUpdate) {
|
||||||
mSwitcher.updateShiftState();
|
mSwitcher.updateShiftState();
|
||||||
assertLayout(afterUpdate, mSwitcher.getLayoutId());
|
assertLayout("afterUpdate", afterUpdate, mSwitcher.getLayoutId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadKeyboard(int afterLoad) {
|
public void loadKeyboard(int afterLoad) {
|
||||||
mSwitcher.loadKeyboard(mLayoutSwitchBackSymbols);
|
mSwitcher.loadKeyboard(mLayoutSwitchBackSymbols);
|
||||||
updateShiftState(afterLoad);
|
mSwitcher.updateShiftState();
|
||||||
|
assertLayout("afterLoad", afterLoad, mSwitcher.getLayoutId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rotateDevice(int afterRotate) {
|
public void rotateDevice(int afterRotate) {
|
||||||
mSwitcher.saveKeyboardState();
|
mSwitcher.saveKeyboardState();
|
||||||
mSwitcher.loadKeyboard(mLayoutSwitchBackSymbols);
|
mSwitcher.loadKeyboard(mLayoutSwitchBackSymbols);
|
||||||
assertLayout(afterRotate, mSwitcher.getLayoutId());
|
assertLayout("afterRotate", afterRotate, mSwitcher.getLayoutId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pressKeyWithoutTimerExpire(int code, boolean isSinglePointer, int afterPress) {
|
private void pressKeyWithoutTimerExpire(int code, boolean isSinglePointer, int afterPress) {
|
||||||
mSwitcher.onPressKey(code, isSinglePointer);
|
mSwitcher.onPressKey(code, isSinglePointer);
|
||||||
assertLayout(afterPress, mSwitcher.getLayoutId());
|
assertLayout("afterPress", afterPress, mSwitcher.getLayoutId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pressKey(int code, int afterPress) {
|
public void pressKey(int code, int afterPress) {
|
||||||
|
@ -77,7 +78,7 @@ public class KeyboardStateTestsBase extends AndroidTestCase
|
||||||
public void releaseKey(int code, int afterRelease) {
|
public void releaseKey(int code, int afterRelease) {
|
||||||
mSwitcher.onCodeInput(code, SINGLE);
|
mSwitcher.onCodeInput(code, SINGLE);
|
||||||
mSwitcher.onReleaseKey(code, NOT_SLIDING);
|
mSwitcher.onReleaseKey(code, NOT_SLIDING);
|
||||||
assertLayout(afterRelease, mSwitcher.getLayoutId());
|
assertLayout("afterRelease", afterRelease, mSwitcher.getLayoutId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pressAndReleaseKey(int code, int afterPress, int afterRelease) {
|
public void pressAndReleaseKey(int code, int afterPress, int afterRelease) {
|
||||||
|
@ -93,7 +94,7 @@ public class KeyboardStateTestsBase extends AndroidTestCase
|
||||||
public void chordingReleaseKey(int code, int afterRelease) {
|
public void chordingReleaseKey(int code, int afterRelease) {
|
||||||
mSwitcher.onCodeInput(code, MULTI);
|
mSwitcher.onCodeInput(code, MULTI);
|
||||||
mSwitcher.onReleaseKey(code, NOT_SLIDING);
|
mSwitcher.onReleaseKey(code, NOT_SLIDING);
|
||||||
assertLayout(afterRelease, mSwitcher.getLayoutId());
|
assertLayout("afterRelease", afterRelease, mSwitcher.getLayoutId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void chordingPressAndReleaseKey(int code, int afterPress, int afterRelease) {
|
public void chordingPressAndReleaseKey(int code, int afterPress, int afterRelease) {
|
||||||
|
@ -104,14 +105,15 @@ public class KeyboardStateTestsBase extends AndroidTestCase
|
||||||
public void pressAndSlideFromKey(int code, int afterPress, int afterSlide) {
|
public void pressAndSlideFromKey(int code, int afterPress, int afterSlide) {
|
||||||
pressKey(code, afterPress);
|
pressKey(code, afterPress);
|
||||||
mSwitcher.onReleaseKey(code, SLIDING);
|
mSwitcher.onReleaseKey(code, SLIDING);
|
||||||
assertLayout(afterSlide, mSwitcher.getLayoutId());
|
assertLayout("afterSlide", afterSlide, mSwitcher.getLayoutId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void longPressAndReleaseKey(int code, int afterPress, int afterLongPress) {
|
public void longPressAndReleaseKey(int code, int afterPress, int afterLongPress,
|
||||||
|
int afterRelease) {
|
||||||
pressKey(code, afterPress);
|
pressKey(code, afterPress);
|
||||||
mSwitcher.onLongPressTimeout(code);
|
mSwitcher.onLongPressTimeout(code);
|
||||||
assertLayout(afterLongPress, mSwitcher.getLayoutId());
|
assertLayout("afterLongPress", afterLongPress, mSwitcher.getLayoutId());
|
||||||
releaseKey(code, afterLongPress);
|
releaseKey(code, afterRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void secondPressAndReleaseKey(int code, int afterPress, int afterRelease) {
|
public void secondPressAndReleaseKey(int code, int afterPress, int afterRelease) {
|
||||||
|
|
Loading…
Reference in New Issue