Add unit tests for double tap shift key
Bug: 6568746 Change-Id: I84db31ce86e3e043ac9f9bb971663a629fa3d3c7main
parent
2959fc0f13
commit
9a3211802b
|
@ -417,4 +417,41 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
|
||||||
// Release shift key, back to alphabet (not shift locked).
|
// Release shift key, back to alphabet (not shift locked).
|
||||||
releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED);
|
releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testDoubleTapShiftAndChording() {
|
||||||
|
// TODO: The following tests fail due to bug. Temporarily commented.
|
||||||
|
// First shift key tap.
|
||||||
|
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
|
||||||
|
// Second shift key tap, maybe shift locked.
|
||||||
|
secondPressKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
|
||||||
|
// Press/release letter key, remain in manual shifted.
|
||||||
|
chordingPressAndReleaseKey('A', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
|
||||||
|
// Release shift key, back to alphabet shifted (not shift locked).
|
||||||
|
releaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
|
||||||
|
|
||||||
|
// Long press shift key, enter alphabet shift locked.
|
||||||
|
longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
|
||||||
|
ALPHABET_SHIFT_LOCKED);
|
||||||
|
// First shift key tap.
|
||||||
|
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
|
||||||
|
// Second shift key tap, maybe shift unlocked.
|
||||||
|
secondPressKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
|
||||||
|
// Press/release letter key, remain in manual shifted.
|
||||||
|
chordingPressAndReleaseKey('A', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
|
||||||
|
// Release shift key, back to alphabet (not shift locked).
|
||||||
|
releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED);
|
||||||
|
|
||||||
|
// Set capitalize the first character of all words mode.
|
||||||
|
setAutoCapsMode(CAP_MODE_WORDS);
|
||||||
|
// Load keyboard, should be in automatic shifted.
|
||||||
|
loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
|
||||||
|
// First shift key tap.
|
||||||
|
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
|
||||||
|
// Second shift key tap, maybe shift locked.
|
||||||
|
secondPressKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
|
||||||
|
// Press/release letter key, remain in manual shifted.
|
||||||
|
chordingPressAndReleaseKey('A', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
|
||||||
|
// Release shift key, back to alphabet (not shift locked).
|
||||||
|
releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,8 +120,12 @@ public class KeyboardStateTestsBase extends AndroidTestCase
|
||||||
releaseKey(code, afterRelease);
|
releaseKey(code, afterRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void secondPressAndReleaseKey(int code, int afterPress, int afterRelease) {
|
public void secondPressKey(int code, int afterPress) {
|
||||||
pressKeyWithoutTimerExpire(code, true, afterPress);
|
pressKeyWithoutTimerExpire(code, true, afterPress);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void secondPressAndReleaseKey(int code, int afterPress, int afterRelease) {
|
||||||
|
secondPressKey(code, afterPress);
|
||||||
releaseKey(code, afterRelease);
|
releaseKey(code, afterRelease);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue