am 08c295c5: am 9a321180: Add unit tests for double tap shift key

* commit '08c295c5bb8d48b26a4486ed42a32a955b39ddd3':
  Add unit tests for double tap shift key
main
Tadashi G. Takaoka 2012-05-29 03:31:09 -07:00 committed by Android Git Automerger
commit 2033d9880e
2 changed files with 42 additions and 1 deletions

View File

@ -417,4 +417,41 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
// Release shift key, back to alphabet (not shift locked).
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);
}
}

View File

@ -120,8 +120,12 @@ public class KeyboardStateTestsBase extends AndroidTestCase
releaseKey(code, afterRelease);
}
public void secondPressAndReleaseKey(int code, int afterPress, int afterRelease) {
public void secondPressKey(int code, int afterPress) {
pressKeyWithoutTimerExpire(code, true, afterPress);
}
public void secondPressAndReleaseKey(int code, int afterPress, int afterRelease) {
secondPressKey(code, afterPress);
releaseKey(code, afterRelease);
}
}