Home | History | Annotate | Download | only in internal
      1 /*
      2  * Copyright (C) 2012 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.inputmethod.keyboard.internal;
     18 
     19 import android.test.suitebuilder.annotation.SmallTest;
     20 
     21 @SmallTest
     22 public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
     23     // Shift key in alphabet.
     24     public void testShiftAlphabet() {
     25         // Press/release shift key, enter into alphabet shifted.
     26         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
     27 
     28         // Press/release shift key, back to alphabet.
     29         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
     30 
     31         // Press/release shift key, enter into alphabet shifted.
     32         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
     33         // Press/release letter key, switch back to alphabet.
     34         pressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
     35     }
     36 
     37     // Shift key in symbols.
     38     public void testShiftSymbols() {
     39         // Press/release "?123" key, enter into symbols.
     40         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
     41 
     42         // Press/release "=\<" key, enter into symbols shifted.
     43         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
     44 
     45         // Press/release "?123" key, back to symbols.
     46         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
     47 
     48         // Press/release "=\<" key, enter into symbols shifted.
     49         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
     50         // Press/release symbol letter key, remain in symbols shifted.
     51         pressAndReleaseKey('1', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
     52     }
     53 
     54     // Switching between alphabet and symbols.
     55     public void testAlphabetAndSymbols() {
     56         // Press/release "?123" key, enter into symbols.
     57         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
     58         // Press/release "ABC" key, back to alphabet.
     59         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
     60         // Press/release "?123" key, enter into symbols.
     61         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
     62 
     63         // Press/release "=\<" key, enter into symbols shifted.
     64         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
     65         // Press/release "ABC" key, back to alphabet.
     66         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
     67         // Press/release "?123" key, back to symbols (not symbols shifted).
     68         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
     69     }
     70 
     71     // Switching between alphabet shifted and symbols.
     72     public void testAlphabetShiftedAndSymbols() {
     73         // Press/release shift key, enter into alphabet shifted.
     74         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
     75 
     76         // Press/release "?123" key, enter into symbols.
     77         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
     78         // Press/release "ABC" key, back to alphabet (not alphabet shifted).
     79         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
     80 
     81         // Press/release shift key, enter into alphabet shifted.
     82         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
     83         // Press/release "?123" key, enter into symbols.
     84         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
     85         // Press/release "=\< key, enter into symbols shifted.
     86         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
     87         // Press/release "ABC" key, back to alphabet (not alphabet shifted).
     88         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
     89     }
     90 
     91     // Switching between alphabet shift locked and symbols.
     92     public void testAlphabetShiftLockedAndSymbols() {
     93         // Long press shift key, enter alphabet shift locked.
     94         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
     95                 ALPHABET_SHIFT_LOCKED);
     96 
     97         // Press/release "?123" key, enter into symbols.
     98         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
     99         // Press/release "ABC" key, back to alphabet shift locked.
    100         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    101         // Press/release "?123" key, enter into symbols.
    102         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    103 
    104         // Press/release "=\<" key, enter into symbols shifted.
    105         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    106         // Press/release "ABC" key, back to alphabet shift locked.
    107         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    108         // Press/release "?123" key, back to symbols (not symbols shifted).
    109         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    110     }
    111 
    112     // Automatic switch back to alphabet by space key.
    113     public void testSwitchBackBySpace() {
    114         // Press/release "?123" key, enter into symbols.
    115         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    116         // Enter symbol letter.
    117         pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    118         // Enter space, switch back to alphabet.
    119         pressAndReleaseKey(CODE_SPACE, SYMBOLS_UNSHIFTED, ALPHABET_UNSHIFTED);
    120 
    121         // Press/release "?123" key, enter into symbols.
    122         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    123         // Press/release "=\<" key, enter into symbols shifted.
    124         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    125         // Enter symbol shift letter.
    126         pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    127         // Enter space, switch back to alphabet.
    128         pressAndReleaseKey(CODE_SPACE, SYMBOLS_SHIFTED, ALPHABET_UNSHIFTED);
    129         // Press/release "?123" key, enter into symbols (not symbols shifted).
    130         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    131     }
    132 
    133     // Automatic switch back to alphabet shift locked test by space key.
    134     public void testSwitchBackBySpaceShiftLocked() {
    135         // Long press shift key, enter alphabet shift locked.
    136         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    137                 ALPHABET_SHIFT_LOCKED);
    138 
    139         // Press/release "?123" key, enter into symbols.
    140         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    141         // Enter symbol letter.
    142         pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    143         // Enter space, switch back to alphabet shift locked.
    144         pressAndReleaseKey(CODE_SPACE, SYMBOLS_UNSHIFTED, ALPHABET_SHIFT_LOCKED);
    145 
    146         // Press/release "?123" key, enter into symbols.
    147         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    148         // Press/release "=\<" key, enter into symbols shifted.
    149         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    150         // Enter symbol shift letter.
    151         pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    152         // Enter space, switch back to alphabet shift locked.
    153         pressAndReleaseKey(CODE_SPACE, SYMBOLS_SHIFTED, ALPHABET_SHIFT_LOCKED);
    154     }
    155 
    156     // Automatic upper case test
    157     public void testAutomaticUpperCase() {
    158         // Set capitalize the first character of all words mode.
    159         setAutoCapsMode(CAP_MODE_WORDS);
    160         // Load keyboard, should be in automatic shifted.
    161         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
    162 
    163         // Press/release letter key, switch to alphabet.
    164         pressAndReleaseKey('A', ALPHABET_AUTOMATIC_SHIFTED, ALPHABET_UNSHIFTED);
    165         // Press/release auto caps trigger letter, should be in automatic shifted.
    166         pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
    167 
    168         // Press/release shift key, back to alphabet.
    169         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    170         // Press/release letter key, remain in alphabet.
    171         pressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    172         // Press/release auto caps trigger letter, should be in automatic shifted.
    173         pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
    174 
    175         // Press/release "?123" key, enter into symbols.
    176         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    177         // Press/release symbol letter key, remain in symbols.
    178         pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    179         // Press/release space, switch back to automatic shifted.
    180         pressAndReleaseKey(CODE_SPACE, SYMBOLS_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
    181 
    182         // Press/release "?123" key, enter into symbols.
    183         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    184         // Press/release "=\<" key, enter into symbols shifted.
    185         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    186         // Press/release symbol shift letter key, remain in symbols shifted.
    187         pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    188         // Press/release space, switch back to automatic shifted.
    189         pressAndReleaseKey(CODE_SPACE, SYMBOLS_SHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
    190     }
    191 
    192     // Long press shift key.
    193     public void testLongPressShift() {
    194         // Set auto caps mode off.
    195         setAutoCapsMode(CAP_MODE_OFF);
    196         // Load keyboard, should be in alphabet.
    197         loadKeyboard(ALPHABET_UNSHIFTED);
    198         // Long press shift key, enter alphabet shift locked.
    199         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    200                 ALPHABET_SHIFT_LOCKED);
    201         // Press/release shift key, back to alphabet.
    202         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
    203 
    204         // Long press shift key, enter alphabet shift locked.
    205         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    206                 ALPHABET_SHIFT_LOCKED);
    207         // Press/release letter key, remain in shift locked.
    208         pressAndReleaseKey('A', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    209         // Press/release word separator, remain in shift locked.
    210         pressAndReleaseKey(CODE_SPACE, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    211         // Press/release shift key, back to alphabet.
    212         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
    213 
    214         // Long press shift key, enter alphabet shift locked.
    215         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    216                 ALPHABET_SHIFT_LOCKED);
    217         // Long press shift key, back to alphabet.
    218         longPressAndReleaseShiftKey(ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_SHIFT_LOCK_SHIFTED,
    219                 ALPHABET_UNSHIFTED);
    220 
    221         // Press/release shift key, enter alphabet shifted.
    222         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    223         // Long press shift key, enter alphabet shift locked.
    224         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    225                 ALPHABET_SHIFT_LOCKED);
    226         // Press/release shift key, back to alphabet.
    227         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
    228 
    229         // Set capitalize the first character of all words mode.
    230         setAutoCapsMode(CAP_MODE_WORDS);
    231         // Load keyboard, should be in automatic shifted.
    232         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
    233         // Long press shift key, enter alphabet shift locked.
    234         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    235                 ALPHABET_SHIFT_LOCKED);
    236         // Press/release shift key, back to alphabet.
    237         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
    238     }
    239 
    240     // Double tap shift key.
    241     public void testDoubleTapShift() {
    242         // First shift key tap.
    243         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    244         // Second shift key tap.
    245         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    246 
    247         // First shift key tap.
    248         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
    249         // Second shift key tap.
    250         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    251 
    252         // Press/release shift key, enter alphabet manual shifted.
    253         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    254 
    255         // First shift key tap.
    256         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    257         // Second shift key tap.
    258         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    259 
    260         // First shift key tap.
    261         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
    262         // Second shift key tap.
    263         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    264 
    265         // Set capitalize the first character of all words mode.
    266         setAutoCapsMode(CAP_MODE_WORDS);
    267         // Load keyboard, should be in automatic shifted.
    268         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
    269 
    270         // First shift key tap.
    271         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    272         // Second shift key tap.
    273         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    274 
    275         // First shift key tap.
    276         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
    277         // Second shift key tap.
    278         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    279     }
    280 
    281     // Update shift state.
    282     public void testUpdateShiftState() {
    283         // Set auto caps mode off.
    284         setAutoCapsMode(CAP_MODE_OFF);
    285         // Load keyboard, should be in alphabet.
    286         loadKeyboard(ALPHABET_UNSHIFTED);
    287         // Update shift state, remained in alphabet.
    288         updateShiftState(ALPHABET_UNSHIFTED);
    289 
    290         // Press/release shift key, enter alphabet shifted.
    291         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    292         // Update shift state, back to alphabet.
    293         updateShiftState(ALPHABET_UNSHIFTED);
    294 
    295         // Long press shift key, enter alphabet shift locked.
    296         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    297                 ALPHABET_SHIFT_LOCKED);
    298         // Update shift state, remained in alphabet shift locked.
    299         updateShiftState(ALPHABET_SHIFT_LOCKED);
    300         // Long press shift key, back to alphabet.
    301         longPressAndReleaseShiftKey(ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_SHIFT_LOCK_SHIFTED,
    302                 ALPHABET_UNSHIFTED);
    303 
    304         // Press/release "?123" key, enter into symbols.
    305         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    306         // Update shift state, remained in symbols.
    307         updateShiftState(SYMBOLS_UNSHIFTED);
    308 
    309         // Press/release "=\<" key, enter symbols shifted.
    310         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    311         // Update shift state, remained in symbols shifted.
    312         updateShiftState(SYMBOLS_SHIFTED);
    313 
    314         // Set capitalize the first character of all words mode.
    315         setAutoCapsMode(CAP_MODE_WORDS);
    316         // Load keyboard, should be in automatic shifted.
    317         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
    318         // Update shift state, remained in automatic shifted.
    319         updateShiftState(ALPHABET_AUTOMATIC_SHIFTED);
    320 
    321         // Press/release shift key, enter alphabet.
    322         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    323         // Press/release shift key, enter alphabet shifted.
    324         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    325         // Update shift state, enter to automatic shifted (not alphabet shifted).
    326         updateShiftState(ALPHABET_AUTOMATIC_SHIFTED);
    327 
    328         // Long press shift key, enter alphabet shift locked.
    329         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    330                 ALPHABET_SHIFT_LOCKED);
    331         // Update shift state, remained in alphabet shift locked (not automatic shifted).
    332         updateShiftState(ALPHABET_SHIFT_LOCKED);
    333         // Long press shift key, back to alphabet.
    334         longPressAndReleaseShiftKey(ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_SHIFT_LOCK_SHIFTED,
    335                 ALPHABET_UNSHIFTED);
    336 
    337         // Load keyboard, should be in automatic shifted.
    338         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
    339         // Press/release "?123" key, enter into symbols.
    340         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    341         // Update shift state, remained in symbols.
    342         updateShiftState(SYMBOLS_UNSHIFTED);
    343 
    344         // Press/release "=\<" key, enter symbols shifted.
    345         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    346         // Update shift state, remained in symbols shifted.
    347         updateShiftState(SYMBOLS_SHIFTED);
    348     }
    349 
    350     // Sliding input in alphabet.
    351     public void testSlidingAlphabet() {
    352         // Alphabet -> shift key + letter -> alphabet.
    353         // Press and slide from shift key, enter alphabet shifted.
    354         pressAndSlideFromKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    355         // Enter/release letter keys, switch back to alphabet.
    356         pressAndSlideFromKey('A', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    357         stopSlidingOnKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    358 
    359         // Alphabet -> "?123" key + letter -> alphabet.
    360         // Press and slide from "123?" key, enter symbols.
    361         pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    362         // Enter/release into symbol letter keys, switch back to alphabet.
    363         pressAndSlideFromKey('@', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    364         stopSlidingOnKey('!', SYMBOLS_UNSHIFTED, ALPHABET_UNSHIFTED);
    365 
    366         // Alphabet shifted -> shift key + letter -> alphabet.
    367         // Press/release shift key, enter alphabet shifted.
    368         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    369         // Press and slide from shift key, remain alphabet shifted.
    370         pressAndSlideFromKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    371         // Enter/release letter keys, switch back to alphabet (not alphabet shifted).
    372         pressAndSlideFromKey('A', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    373         stopSlidingOnKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    374 
    375         // Alphabet shifted -> "?123" key + letter -> alphabet.
    376         // Press/release shift key, enter alphabet shifted.
    377         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    378         // Press and slide from "123?" key, enter symbols.
    379         pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    380         // Enter/release into symbol letter keys, switch back to alphabet (not alphabet shifted).
    381         pressAndSlideFromKey('@', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    382         stopSlidingOnKey('!', SYMBOLS_UNSHIFTED, ALPHABET_UNSHIFTED);
    383 
    384         // Alphabet shift locked -> shift key + letter -> alphabet shift locked.
    385         // Long press shift key, enter alphabet shift locked.
    386         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    387                 ALPHABET_SHIFT_LOCKED);
    388         // Press and slide from "123?" key, enter symbols.
    389         pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    390         // Enter/release into symbol letter keys, switch back to alphabet shift locked.
    391         pressAndSlideFromKey('!', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    392         stopSlidingOnKey('!', SYMBOLS_UNSHIFTED, ALPHABET_SHIFT_LOCKED);
    393 
    394         // Alphabet shift locked -> "?123" key + letter -> alphabet shift locked.
    395         // Press and slide from shift key, enter alphabet shifted.
    396         pressAndSlideFromKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_SHIFT_LOCKED);
    397         // Enter/release letter keys, switch back to shift locked.
    398         pressAndSlideFromKey('A', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    399         stopSlidingOnKey('Z', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    400     }
    401 
    402     // Cancel sliding input in alphabet.
    403     public void testSlidingAlphabetCancel() {
    404         // Alphabet -> shift key + letter -> cancel -> alphabet.
    405         // Press and slide from shift key, enter alphabet shifted.
    406         pressAndSlideFromKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    407         // Press and slide from shift key, enter alphabet shifted.
    408         pressAndSlideFromKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    409         // Enter/release letter key, remains in alphabet shifted.
    410         pressAndSlideFromKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    411         // Cancel sliding, switch back to alphabet.
    412         stopSlidingAndCancel(ALPHABET_UNSHIFTED);
    413 
    414         // Alphabet -> "?123" key + letter -> cancel -> alphabet.
    415         // Press and slide from "123?" key, enter symbols.
    416         pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    417         // Enter/release into symbol letter key, remains in symbols.
    418         pressAndSlideFromKey('!', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    419         // Cancel sliding, switch back to alphabet.
    420         stopSlidingAndCancel(ALPHABET_UNSHIFTED);
    421 
    422         // Alphabet shifted -> shift key + letter -> cancel -> alphabet.
    423         // Press/release shift key, enter alphabet shifted.
    424         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    425         // Press and slide from shift key, remain alphabet shifted.
    426         pressAndSlideFromKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    427         // Enter/release letter key, remains in alphabet shifted.
    428         pressAndSlideFromKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    429         // Cancel sliding, switch back to alphabet (not alphabet shifted).
    430         stopSlidingAndCancel(ALPHABET_UNSHIFTED);
    431 
    432         // Alphabet shifted -> "?123" key + letter -> cancel -> alphabet.
    433         // Press/release shift key, enter alphabet shifted.
    434         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    435         // Press and slide from "123?" key, enter symbols.
    436         pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    437         // Enter/release into symbol letter key, remains in symbols.
    438         pressAndSlideFromKey('!', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    439         // Cancel sliding, switch back to alphabet (not alphabet shifted).
    440         stopSlidingAndCancel(ALPHABET_UNSHIFTED);
    441 
    442         // Alphabet shift locked -> shift key + letter -> cancel -> alphabet shift locked.
    443         // Long press shift key, enter alphabet shift locked.
    444         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    445                 ALPHABET_SHIFT_LOCKED);
    446         // Press and slide from "123?" key, enter symbols.
    447         pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    448         // Enter/release into symbol letter key, remains in symbols.
    449         pressAndSlideFromKey('!', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    450         // Cancel sliding, switch back to alphabet shift locked.
    451         stopSlidingAndCancel( ALPHABET_SHIFT_LOCKED);
    452 
    453         // Alphabet shift locked -> "?123" key + letter -> cancel -> alphabet shift locked.
    454         // Press and slide from shift key, enter alphabet shifted.
    455         pressAndSlideFromKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_SHIFT_LOCKED);
    456         // Enter/release letter key, remains in alphabet shift locked.
    457         pressAndSlideFromKey('Z', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    458         // Enter/release letter key, switch back to shift locked.
    459         stopSlidingAndCancel(ALPHABET_SHIFT_LOCKED);
    460     }
    461 
    462     // Sliding input in symbols.
    463     public void testSlidingSymbols() {
    464         // Symbols -> "=\<" key + letter -> symbols.
    465         // Press/release "?123" key, enter into symbols.
    466         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    467         // Press and slide from shift key, enter symbols shifted.
    468         pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    469         // Enter/release symbol shifted letter keys, switch back to symbols.
    470         pressAndSlideFromKey('|', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    471         stopSlidingOnKey('~', SYMBOLS_SHIFTED, SYMBOLS_UNSHIFTED);
    472 
    473         // Symbols -> "ABC" key + letter -> Symbols.
    474         // Press and slide from "ABC" key, enter alphabet.
    475         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    476         // Enter/release letter keys, switch back to symbols.
    477         pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    478         stopSlidingOnKey('a', ALPHABET_UNSHIFTED, SYMBOLS_UNSHIFTED);
    479         // Press/release "ABC" key, switch to alphabet.
    480         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    481 
    482         // Alphabet shifted -> symbols -> "ABC" key + letter -> symbols ->
    483         // alphabet.
    484         // Load keyboard
    485         loadKeyboard(ALPHABET_UNSHIFTED);
    486         // Press/release shift key, enter alphabet shifted.
    487         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    488         // Press/release "?123" key, enter into symbols.
    489         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    490         // Press and slide from "ABC" key.
    491         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    492         // Enter/release letter keys, switch back to symbols.
    493         pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    494         stopSlidingOnKey('a', ALPHABET_UNSHIFTED, SYMBOLS_UNSHIFTED);
    495         // Press/release "ABC" key, switch to alphabet (not alphabet shifted).
    496         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    497 
    498         // Alphabet shift locked -> symbols -> "ABC" key + letter -> symbols ->
    499         // alphabet shift locked.
    500         // Load keyboard
    501         loadKeyboard(ALPHABET_UNSHIFTED);
    502         // Long press shift key, enter alphabet shift locked.
    503         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    504                 ALPHABET_SHIFT_LOCKED);
    505         // Press/release "?123" key, enter into symbols.
    506         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    507         // Press and slide from "ABC" key, enter alphabet shift locked.
    508         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    509         // Enter/release letter keys, switch back to symbols.
    510         pressAndSlideFromKey('Z', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    511         stopSlidingOnKey('A', ALPHABET_SHIFT_LOCKED, SYMBOLS_UNSHIFTED);
    512         // Press/release "ABC" key, switch to alphabet shift locked.
    513         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    514 
    515         // Alphabet shift locked -> symbols -> "=\<" key + letter -> symbols ->
    516         // alphabet shift locked.
    517         // Load keyboard
    518         loadKeyboard(ALPHABET_UNSHIFTED);
    519         // Long press shift key, enter alphabet shift locked.
    520         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    521                 ALPHABET_SHIFT_LOCKED);
    522         // Press/release "?123" key, enter into symbols.
    523         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    524         // Press and slide from "=\<" key, enter symbols shifted.
    525         pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    526         // Enter/release symbols shift letter keys, switch back to symbols.
    527         pressAndSlideFromKey('|', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    528         stopSlidingOnKey('~', SYMBOLS_SHIFTED, SYMBOLS_UNSHIFTED);
    529         // Press/release "ABC" key, switch to alphabet shift locked.
    530         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    531     }
    532 
    533     // Cancel sliding input in symbols.
    534     public void testSlidingSymbolsCancel() {
    535         // Symbols -> "=\<" key + letter -> cancel -> symbols.
    536         // Press/release "?123" key, enter into symbols.
    537         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    538         // Press and slide from shift key, enter symbols shifted.
    539         pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    540         // Enter/release symbol shifted letter key, remains in symbols shifted.
    541         pressAndSlideFromKey('|', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    542         // Cancel sliding, switch back to symbols.
    543         stopSlidingAndCancel(SYMBOLS_UNSHIFTED);
    544 
    545         // Symbols -> "ABC" key + letter -> Symbols.
    546         // Press and slide from "ABC" key, enter alphabet.
    547         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    548         // Enter/release letter keys, remains in alphabet.
    549         pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    550         // Cancel sliding, switch back to symbols.
    551         stopSlidingAndCancel(SYMBOLS_UNSHIFTED);
    552         // Press/release "ABC" key, switch to alphabet.
    553         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    554 
    555         // Alphabet shifted -> symbols -> "ABC" key + letter -> symbols ->
    556         // alphabet.
    557         // Load keyboard
    558         loadKeyboard(ALPHABET_UNSHIFTED);
    559         // Press/release shift key, enter alphabet shifted.
    560         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    561         // Press/release "?123" key, enter into symbols.
    562         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    563         // Press and slide from "ABC" key.
    564         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    565         // Enter/release letter key, remains in alphabet.
    566         pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    567         // Cancel sliding, switch back to symbols.
    568         stopSlidingAndCancel(SYMBOLS_UNSHIFTED);
    569         // Press/release "ABC" key, switch to alphabet (not alphabet shifted).
    570         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    571 
    572         // Alphabet shift locked -> symbols -> "ABC" key + letter -> symbols ->
    573         // alphabet shift locked.
    574         // Load keyboard
    575         loadKeyboard(ALPHABET_UNSHIFTED);
    576         // Long press shift key, enter alphabet shift locked.
    577         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    578                 ALPHABET_SHIFT_LOCKED);
    579         // Press/release "?123" key, enter into symbols.
    580         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    581         // Press and slide from "ABC" key, enter alphabet shift locked.
    582         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    583         // Enter/release letter key, remains in alphabet shifted.
    584         pressAndSlideFromKey('Z', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    585         // Cancel sliding, switch back to symbols.
    586         stopSlidingAndCancel(SYMBOLS_UNSHIFTED);
    587         // Press/release "ABC" key, switch to alphabet shift locked.
    588         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    589 
    590         // Alphabet shift locked -> symbols -> "=\<" key + letter -> symbols ->
    591         // alphabet shift locked.
    592         // Load keyboard
    593         loadKeyboard(ALPHABET_UNSHIFTED);
    594         // Long press shift key, enter alphabet shift locked.
    595         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    596                 ALPHABET_SHIFT_LOCKED);
    597         // Press/release "?123" key, enter into symbols.
    598         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    599         // Press and slide from "=\<" key, enter symbols shifted.
    600         pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    601         // Enter/release symbols shift letter key, remains in symbols shifted.
    602         pressAndSlideFromKey('|', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    603         // Cancel sliding, switch back to symbols.
    604         stopSlidingAndCancel(SYMBOLS_UNSHIFTED);
    605         // Press/release "ABC" key, switch to alphabet shift locked.
    606         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    607     }
    608 
    609     // Sliding input in symbols shifted.
    610     public void testSlidingSymbolsShifted() {
    611         // Symbols shifted -> "?123" + letter -> symbols shifted.
    612         // Press/release "?123" key, enter into symbols.
    613         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    614         // Press/release "=\<" key, enter into symbols shifted.
    615         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    616         // Press and slide from shift key, enter symbols.
    617         pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    618         // Enter/release symbol letter keys, switch back to symbols shifted.
    619         pressAndSlideFromKey('2', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    620         stopSlidingOnKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_SHIFTED);
    621 
    622         // Symbols shifted -> "ABC" key + letter -> symbols shifted.
    623         // Press and slide from "ABC" key, enter alphabet.
    624         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    625         // Enter/release letter keys, switch back to symbols shifted.
    626         pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    627         stopSlidingOnKey('a', ALPHABET_UNSHIFTED, SYMBOLS_SHIFTED);
    628         // Press/release "ABC" key, switch to alphabet.
    629         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    630 
    631         // Alphabet shifted -> symbols shifted -> "ABC" + letter -> symbols shifted ->
    632         // alphabet.
    633         // Load keyboard
    634         loadKeyboard(ALPHABET_UNSHIFTED);
    635         // Press/release shift key, enter alphabet shifted.
    636         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    637         // Press/release "?123" key, enter into symbols.
    638         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    639         // Press/release "=\<" key, enter into symbols shifted.
    640         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    641         // Press and slide from "ABC" key.
    642         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    643         // Enter/release letter keys, switch back to symbols shifted.
    644         pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    645         stopSlidingOnKey('a', ALPHABET_UNSHIFTED, SYMBOLS_SHIFTED);
    646         // Press/release "ABC" key, switch to alphabet (not alphabet shifted).
    647         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    648 
    649         // Alphabet shift locked -> symbols shifted -> "ABC" + letter -> symbols shifted ->
    650         // alphabet shift locked.
    651         // Load keyboard
    652         loadKeyboard(ALPHABET_UNSHIFTED);
    653         // Long press shift key, enter alphabet shift locked.
    654         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    655                 ALPHABET_SHIFT_LOCKED);
    656         // Press/release "?123" key, enter into symbols.
    657         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    658         // Press/release "=\<" key, enter into symbols shifted.
    659         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    660         // Press and slide from "ABC" key.
    661         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    662         // Enter/release letter keys, switch back to symbols shifted.
    663         pressAndSlideFromKey('Z', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    664         stopSlidingOnKey('A', ALPHABET_SHIFT_LOCKED, SYMBOLS_SHIFTED);
    665         // Press/release "ABC" key, switch to alphabet shift locked.
    666         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    667 
    668         // Alphabet shift locked -> symbols shifted -> "?123" + letter -> symbols shifted ->
    669         // alphabet shift locked.
    670         // Load keyboard
    671         loadKeyboard(ALPHABET_UNSHIFTED);
    672         // Long press shift key, enter alphabet shift locked.
    673         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    674                 ALPHABET_SHIFT_LOCKED);
    675         // Press/release "?123" key, enter into symbols.
    676         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    677         // Press/release "=\<" key, enter into symbols shifted.
    678         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    679         // Press and slide from "?123" key.
    680         pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    681         // Enter/release symbol letter keys, switch back to symbols shifted.
    682         pressAndSlideFromKey('2', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    683         stopSlidingOnKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_SHIFTED);
    684         // Press/release "ABC" key, switch to alphabet shift locked.
    685         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    686     }
    687 
    688     // Cancel sliding input in symbols shifted.
    689     public void testSlidingSymbolsShiftedCancel() {
    690         // Symbols shifted -> "?123" + letter -> symbols shifted.
    691         // Press/release "?123" key, enter into symbols.
    692         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    693         // Press/release "=\<" key, enter into symbols shifted.
    694         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    695         // Press and slide from shift key, enter symbols.
    696         pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    697         // Enter/release symbol letter key, remains in symbols.
    698         pressAndSlideFromKey('2', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    699         // Cancel sliding, switch back to symbols shifted.
    700         stopSlidingAndCancel(SYMBOLS_SHIFTED);
    701 
    702         // Symbols shifted -> "ABC" key + letter -> symbols shifted.
    703         // Press and slide from "ABC" key, enter alphabet.
    704         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    705         // Enter/release letter key, remains in alphabet.
    706         pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    707         // Cancel sliding, switch back to symbols shifted.
    708         stopSlidingAndCancel(SYMBOLS_SHIFTED);
    709         // Press/release "ABC" key, switch to alphabet.
    710         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    711 
    712         // Alphabet shifted -> symbols shifted -> "ABC" + letter -> symbols shifted ->
    713         // alphabet.
    714         // Load keyboard
    715         loadKeyboard(ALPHABET_UNSHIFTED);
    716         // Press/release shift key, enter alphabet shifted.
    717         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    718         // Press/release "?123" key, enter into symbols.
    719         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    720         // Press/release "=\<" key, enter into symbols shifted.
    721         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    722         // Press and slide from "ABC" key.
    723         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    724         // Enter/release letter key, remains in alphabet.
    725         pressAndSlideFromKey('z', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    726         // Cancel sliding, switch back to symbols shifted.
    727         stopSlidingAndCancel(SYMBOLS_SHIFTED);
    728         // Press/release "ABC" key, switch to alphabet (not alphabet shifted).
    729         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    730 
    731         // Alphabet shift locked -> symbols shifted -> "ABC" + letter -> symbols shifted ->
    732         // alphabet shift locked.
    733         // Load keyboard
    734         loadKeyboard(ALPHABET_UNSHIFTED);
    735         // Long press shift key, enter alphabet shift locked.
    736         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    737                 ALPHABET_SHIFT_LOCKED);
    738         // Press/release "?123" key, enter into symbols.
    739         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    740         // Press/release "=\<" key, enter into symbols shifted.
    741         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    742         // Press and slide from "ABC" key.
    743         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    744         // Enter/release letter key, remains in alphabet shift locked.
    745         pressAndSlideFromKey('Z', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    746         // Cancel sliding, switch back to symbols shifted.
    747         stopSlidingAndCancel(SYMBOLS_SHIFTED);
    748         // Press/release "ABC" key, switch to alphabet shift locked.
    749         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    750 
    751         // Alphabet shift locked -> symbols shifted -> "?123" + letter -> symbols shifted ->
    752         // alphabet shift locked.
    753         // Load keyboard
    754         loadKeyboard(ALPHABET_UNSHIFTED);
    755         // Long press shift key, enter alphabet shift locked.
    756         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    757                 ALPHABET_SHIFT_LOCKED);
    758         // Press/release "?123" key, enter into symbols.
    759         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    760         // Press/release "=\<" key, enter into symbols shifted.
    761         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    762         // Press and slide from "?123" key.
    763         pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    764         // Enter/release symbol letter key, remains in symbols.
    765         pressAndSlideFromKey('2', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    766         // Cancel sliding, switch back to symbols shifted.
    767         stopSlidingAndCancel(SYMBOLS_SHIFTED);
    768         // Press/release "ABC" key, switch to alphabet shift locked.
    769         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    770     }
    771 
    772     // Change focus to new text field.
    773     public void testChangeFocus() {
    774         // Press/release shift key.
    775         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    776         // Change focus to new text field.
    777         loadKeyboard(ALPHABET_UNSHIFTED);
    778 
    779         // Long press shift key, enter alphabet shift locked.
    780         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    781                 ALPHABET_SHIFT_LOCKED);
    782         // Change focus to new text field.
    783         loadKeyboard(ALPHABET_UNSHIFTED);
    784 
    785         // Press/release "?123" key.
    786         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    787         // Change focus to new text field.
    788         loadKeyboard(ALPHABET_UNSHIFTED);
    789 
    790         // Press/release "?123" key.
    791         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    792         // Press/release "=\<" key.
    793         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    794         // Change focus to new text field.
    795         loadKeyboard(ALPHABET_UNSHIFTED);
    796     }
    797 
    798     // Change focus to auto caps text field.
    799     public void testChangeFocusAutoCaps() {
    800         // Set capitalize the first character of all words mode.
    801         setAutoCapsMode(CAP_MODE_WORDS);
    802         // Change focus to new text field.
    803         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
    804 
    805         // Press/release shift key, enter alphabet.
    806         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    807         // Change focus to new text field.
    808         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
    809 
    810         // Long press shift key, enter alphabet shift locked.
    811         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    812                 ALPHABET_SHIFT_LOCKED);
    813         // Change focus to new text field.
    814         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
    815 
    816         // Press/release "?123" key.
    817         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    818         // Change focus to new text field.
    819         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
    820 
    821         // Press/release "?123" key.
    822         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    823         // Press/release "=\<" key.
    824         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    825         // Change focus to new text field.
    826         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
    827     }
    828 
    829     // Change orientation.
    830     public void testChangeOrientation() {
    831         // Alphabet -> rotate -> alphabet.
    832         updateShiftState(ALPHABET_UNSHIFTED);
    833         // Rotate device, remain in alphabet.
    834         rotateDevice(ALPHABET_UNSHIFTED);
    835 
    836         // Alphabet automatic shifted -> rotate -> automatic shifted.
    837         // Set capitalize the first character of all words mode.
    838         setAutoCapsMode(CAP_MODE_WORDS);
    839         // Press/release auto caps trigger letter to enter alphabet automatic shifted.
    840         pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
    841         // Rotate device, remain in alphabet.
    842         rotateDevice(ALPHABET_AUTOMATIC_SHIFTED);
    843         setAutoCapsMode(CAP_MODE_OFF);
    844         // Press/release auto caps trigger letter to reset shift state.
    845         pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_AUTOMATIC_SHIFTED, ALPHABET_UNSHIFTED);
    846 
    847         // Alphabet shifted -> rotate -> alphabet shifted.
    848         // Press/release shift key, enter alphabet shifted.
    849         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    850         // Rotate device, remain in alphabet shifted.
    851         rotateDevice(ALPHABET_MANUAL_SHIFTED);
    852 
    853         // Alphabet shift locked -> rotate -> alphabet shift locked.
    854         // Long press shift key, enter alphabet shift locked.
    855         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    856                 ALPHABET_SHIFT_LOCKED);
    857         // Rotate device, remain in alphabet shift locked.
    858         rotateDevice(ALPHABET_SHIFT_LOCKED);
    859 
    860         // Alphabet shift locked -> symbols -> rotate -> symbols ->
    861         // Alphabet shift locked.
    862         // Press/release "?123" key, enter symbols.
    863         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    864         // Rotate device, remain in symbols,
    865         rotateDevice(SYMBOLS_UNSHIFTED);
    866         // Press/release "ABC" key, alphabet shift locked state should be maintained.
    867         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    868 
    869         // Alphabet shift locked -> symbols shifted -> rotate -> symbols shifted ->
    870         // Alphabet shift locked.
    871         // Press/release "?123" key, enter symbols.
    872         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    873         // Press/release "=\<" key, enter symbols shifted.
    874         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    875         // Rotate device, remain in symbols shifted.
    876         rotateDevice(SYMBOLS_SHIFTED);
    877         // Press/release "ABC" key, alphabet shift locked state should be maintained.
    878         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    879 
    880         // Alphabet shift locked -> symbols shifted -> alphabet shift locked -> rotate ->
    881         // Alphabet shift locked -> symbols.
    882         // Press/release "?123" key, enter symbols.
    883         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    884         // Press/release "=\<" key, enter symbols shifted.
    885         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    886         // Press/release "ABC" key, enter alphabet shift locked.
    887         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
    888         // Rotate device, remain in alphabet shift locked.
    889         rotateDevice(ALPHABET_SHIFT_LOCKED);
    890         // Press/release "?123" key, enter symbols (not symbols shifted).
    891         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    892 
    893         // Alphabet -> symbols shifted -> alphabet -> rotate ->
    894         // Alphabet -> symbols.
    895         loadKeyboard(ALPHABET_UNSHIFTED);
    896         // Press/release "?123" key, enter symbols.
    897         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    898         // Press/release "=\<" key, enter symbols shifted.
    899         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
    900         // Press/release "ABC" key, enter alphabet.
    901         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    902         // Rotate device, remain in alphabet shift locked.
    903         rotateDevice(ALPHABET_UNSHIFTED);
    904         // Press/release "?123" key, enter symbols (not symbols shifted).
    905         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
    906     }
    907 
    908     // Rapidly type shift key.
    909     public void testRapidShiftTyping() {
    910         // Press/release shift key
    911         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    912         // Rapidly press/release letter key.
    913         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    914         // Rapidly press/release shift key.
    915         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    916         // Rapidly press/release letter key.
    917         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    918         // Rapidly press/release shift key.
    919         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    920         // Rapidly press/release letter key.
    921         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    922 
    923         // Press/release shift key to enter alphabet manual shifted.
    924         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    925         // Press/release shift key
    926         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    927         // Rapidly press/release letter key.
    928         secondPressAndReleaseKey('j', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    929         // Rapidly press/release shift key.
    930         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    931         // Rapidly press/release letter key.
    932         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    933         // Rapidly press/release shift key.
    934         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    935         // Rapidly press/release letter key.
    936         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    937 
    938         // Long press shift key to enter alphabet shift locked.
    939         longPressAndReleaseShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
    940                 ALPHABET_SHIFT_LOCKED);
    941         // Press/release shift key
    942         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
    943         // Rapidly press/release letter key.
    944         secondPressAndReleaseKey('j', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    945         // Rapidly press/release shift key.
    946         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    947         // Rapidly press/release letter key.
    948         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    949         // Rapidly press/release shift key.
    950         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    951         // Rapidly press/release letter key.
    952         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    953 
    954         // Set capitalize the first character of all words mode.
    955         setAutoCapsMode(CAP_MODE_WORDS);
    956         // Press/release auto caps trigger letter to enter alphabet automatic shifted.
    957         pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
    958         // Press/release shift key
    959         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    960         // Rapidly press/release letter key.
    961         secondPressAndReleaseKey('j', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
    962         // Rapidly press/release shift key.
    963         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    964         // Rapidly press/release letter key.
    965         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    966         // Rapidly press/release shift key.
    967         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
    968         // Rapidly press/release letter key.
    969         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
    970     }
    971 }
    972