Merge "Fix KeyboardState to pass KeyboardStateMultiTouchTests"

This commit is contained in:
Tadashi G. Takaoka 2012-01-19 02:14:15 -08:00 committed by Android (Google) Code Review
commit 085b659463
2 changed files with 16 additions and 15 deletions

View file

@ -338,7 +338,11 @@ public class KeyboardState {
final boolean isShiftLocked = mAlphabetShiftState.isShiftLocked(); final boolean isShiftLocked = mAlphabetShiftState.isShiftLocked();
if (mShiftKeyState.isMomentary()) { if (mShiftKeyState.isMomentary()) {
// After chording input while normal state. // After chording input while normal state.
setShifted(SwitchActions.UNSHIFT); if (mAlphabetShiftState.isShiftLockShifted()) {
setShiftLocked(true);
} else {
setShifted(SwitchActions.UNSHIFT);
}
} else if (isShiftLocked && !mAlphabetShiftState.isShiftLockShifted() } else if (isShiftLocked && !mAlphabetShiftState.isShiftLockShifted()
&& (mShiftKeyState.isPressing() || mShiftKeyState.isPressingOnShifted()) && (mShiftKeyState.isPressing() || mShiftKeyState.isPressingOnShifted())
&& !withSliding) { && !withSliding) {

View file

@ -52,21 +52,18 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
chordingPressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED); chordingPressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
chordingPressAndReleaseKey('X', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED); chordingPressAndReleaseKey('X', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// TODO: This test fails due to bug, though external behavior is correct. // Release shift key, switch back to alphabet shift locked.
// // Release shift key, switch back to alphabet shift locked. releaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCKED);
// releaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCKED);
releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED);
// TODO: This test fails due to bug, though external behavior is correct. // Press symbols key and hold, enter into choring symbols state.
// // Press symbols key and hold, enter into choring symbols state. pressKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED);
// pressKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED);
// // Press/release symbol letter keys.
// // Press/release symbol letter keys. chordingPressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// chordingPressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED); chordingPressAndReleaseKey('2', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// chordingPressAndReleaseKey('2', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// // Release symbols key, switch back to alphabet shift locked.
// // Release symbols key, switch back to alphabet shift locked. releaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED);
// releaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED);
} }
// Symbols key chording input. // Symbols key chording input.