2011-12-09 11:18:39 +00:00
|
|
|
/*
|
2012-01-18 09:01:53 +00:00
|
|
|
* Copyright (C) 2012 The Android Open Source Project
|
2011-12-09 11:18:39 +00:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
|
|
* use this file except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations under
|
|
|
|
* the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package com.android.inputmethod.keyboard.internal;
|
|
|
|
|
2012-01-18 09:01:53 +00:00
|
|
|
public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
|
2012-01-23 09:11:37 +00:00
|
|
|
// Chording input in alphabet.
|
|
|
|
public void testChordingAlphabet() {
|
2012-01-10 05:31:47 +00:00
|
|
|
// Press shift key and hold, enter into choring shift state.
|
2012-01-18 03:31:02 +00:00
|
|
|
pressKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press/release letter key.
|
2012-01-18 03:31:02 +00:00
|
|
|
chordingPressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
|
2012-01-18 07:40:28 +00:00
|
|
|
// Release shift key, switch back to alphabet.
|
2012-01-18 03:31:02 +00:00
|
|
|
releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED);
|
2012-01-18 07:40:28 +00:00
|
|
|
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press "?123" key and hold, enter into choring symbols state.
|
2012-01-18 07:40:28 +00:00
|
|
|
pressKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press/release symbol letter key.
|
2012-01-18 07:40:28 +00:00
|
|
|
chordingPressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Release "ABC" key, switch back to alphabet.
|
2012-01-18 07:40:28 +00:00
|
|
|
releaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
|
|
|
|
}
|
|
|
|
|
2012-01-23 09:11:37 +00:00
|
|
|
// Chording input in shift locked.
|
|
|
|
public void testChordingShiftLocked() {
|
2012-01-18 07:40:28 +00:00
|
|
|
// Long press shift key, enter alphabet shift locked.
|
|
|
|
longPressShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
|
|
|
|
|
|
|
|
// Press shift key and hold, enter into choring shift state.
|
|
|
|
pressKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press/release letter key.
|
2012-01-18 07:40:28 +00:00
|
|
|
chordingPressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
|
2012-01-19 09:48:02 +00:00
|
|
|
// Release shift key, switch back to alphabet shift locked.
|
|
|
|
releaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCKED);
|
|
|
|
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press "?123" key and hold, enter into choring symbols state.
|
2012-01-19 09:48:02 +00:00
|
|
|
pressKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press/release symbol letter key.
|
2012-01-19 09:48:02 +00:00
|
|
|
chordingPressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Release "123?" key, switch back to alphabet shift locked.
|
2012-01-19 09:48:02 +00:00
|
|
|
releaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED);
|
2011-12-09 11:18:39 +00:00
|
|
|
}
|
|
|
|
|
2012-01-23 09:11:37 +00:00
|
|
|
// Chording input in symbols.
|
|
|
|
public void testChordingSymbols() {
|
|
|
|
// Press/release "?123" key, enter symbols.
|
2012-01-18 07:40:28 +00:00
|
|
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
|
|
|
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press "=\<" key and hold, enter into choring symbols shifted state.
|
2012-01-18 07:40:28 +00:00
|
|
|
pressKey(CODE_SHIFT, SYMBOLS_SHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press/release symbol letter key.
|
2012-01-18 07:40:28 +00:00
|
|
|
chordingPressAndReleaseKey('1', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Release "=\<" key, switch back to symbols.
|
2012-01-18 07:40:28 +00:00
|
|
|
releaseKey(CODE_SHIFT, SYMBOLS_UNSHIFTED);
|
|
|
|
|
|
|
|
// Press "ABC" key and hold, enter into choring alphabet state.
|
|
|
|
pressKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press/release letter key.
|
2012-01-18 07:40:28 +00:00
|
|
|
chordingPressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
|
|
|
|
// Release "ABC" key, switch back to symbols.
|
|
|
|
releaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED);
|
|
|
|
}
|
|
|
|
|
2012-01-23 09:11:37 +00:00
|
|
|
// Chording input in symbol shifted.
|
|
|
|
public void testChordingSymbolsShifted() {
|
|
|
|
// Press/release "?123" key, enter symbols.
|
2012-01-18 07:40:28 +00:00
|
|
|
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press/release "=\<" key, enter symbols shifted.
|
2012-01-18 07:40:28 +00:00
|
|
|
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
|
|
|
|
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press "=\<" key and hold, enter into chording symbols state.
|
2012-01-18 07:40:28 +00:00
|
|
|
pressKey(CODE_SHIFT, SYMBOLS_UNSHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press/release symbol letter key.
|
2012-01-18 03:31:02 +00:00
|
|
|
chordingPressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Release "=\<" key, switch back to symbols shifted state.
|
2012-01-18 07:40:28 +00:00
|
|
|
releaseKey(CODE_SHIFT, SYMBOLS_SHIFTED);
|
|
|
|
|
2012-01-19 09:53:38 +00:00
|
|
|
// Press "ABC" key and hold, enter into choring alphabet state.
|
|
|
|
pressKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press/release letter key.
|
2012-01-19 09:53:38 +00:00
|
|
|
chordingPressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
|
|
|
|
// Release "ABC" key, switch back to symbols.
|
|
|
|
releaseKey(CODE_SYMBOL, SYMBOLS_SHIFTED);
|
2012-01-10 05:31:47 +00:00
|
|
|
}
|
|
|
|
|
2012-01-23 09:11:37 +00:00
|
|
|
// Chording input in automatic upper case.
|
|
|
|
public void testChordingAutomaticUpperCase() {
|
2012-01-18 03:31:02 +00:00
|
|
|
// Set auto caps mode on.
|
|
|
|
setAutoCapsMode(AUTO_CAPS);
|
|
|
|
|
2012-01-10 05:31:47 +00:00
|
|
|
// Update shift state with auto caps enabled.
|
2012-01-23 09:11:37 +00:00
|
|
|
pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
|
2012-01-18 07:40:28 +00:00
|
|
|
// Press shift key and hold, enter into chording shift state.
|
2012-01-18 03:31:02 +00:00
|
|
|
pressKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press/release letter key.
|
2012-01-18 03:31:02 +00:00
|
|
|
chordingPressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
|
2012-01-18 07:40:28 +00:00
|
|
|
// Release shift key, switch back to alphabet.
|
2012-01-18 03:31:02 +00:00
|
|
|
releaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED);
|
|
|
|
|
2012-01-10 05:31:47 +00:00
|
|
|
// Update shift state with auto caps enabled.
|
2012-01-23 09:11:37 +00:00
|
|
|
pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
|
2012-01-18 07:40:28 +00:00
|
|
|
// Press "123?" key and hold, enter into chording symbols state.
|
2012-01-18 03:31:02 +00:00
|
|
|
pressKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED);
|
2012-01-23 09:11:37 +00:00
|
|
|
// Press/release symbol letter key.
|
2012-01-18 03:31:02 +00:00
|
|
|
chordingPressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
|
2012-01-18 07:40:28 +00:00
|
|
|
// Release "123?" key, switch back to alphabet.
|
2012-01-18 03:31:02 +00:00
|
|
|
releaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
|
2012-01-10 05:31:47 +00:00
|
|
|
}
|
2011-12-09 11:18:39 +00:00
|
|
|
}
|