• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * 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, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */
16 
17 package com.android.inputmethod.keyboard.internal;
18 
19 public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
20     // Shift key in alphabet.
testShiftAlphabet()21     public void testShiftAlphabet() {
22         // Press/release shift key, enter into alphabet shifted.
23         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
24 
25         // Press/release shift key, back to alphabet.
26         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
27 
28         // Press/release shift key, enter into alphabet shifted.
29         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
30         // Press/release letter key, switch back to alphabet.
31         pressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
32     }
33 
34     // Shift key in symbols.
testShiftSymbols()35     public void testShiftSymbols() {
36         // Press/release "?123" key, enter into symbols.
37         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
38 
39         // Press/release "=\<" key, enter into symbols shifted.
40         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
41 
42         // Press/release "?123" key, back to symbols.
43         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
44 
45         // Press/release "=\<" key, enter into symbols shifted.
46         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
47         // Press/release symbol letter key, remain in symbols shifted.
48         pressAndReleaseKey('1', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
49     }
50 
51     // Switching between alphabet and symbols.
testAlphabetAndSymbols()52     public void testAlphabetAndSymbols() {
53         // Press/release "?123" key, enter into symbols.
54         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
55         // Press/release "ABC" key, back to alphabet.
56         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
57         // Press/release "?123" key, enter into symbols.
58         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
59 
60         // Press/release "=\<" key, enter into symbols shifted.
61         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
62         // Press/release "ABC" key, back to alphabet.
63         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
64         // Press/release "?123" key, back to symbols (not symbols shifted).
65         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
66     }
67 
68     // Switching between alphabet shifted and symbols.
testAlphabetShiftedAndSymbols()69     public void testAlphabetShiftedAndSymbols() {
70         // Press/release shift key, enter into alphabet shifted.
71         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
72 
73         // Press/release "?123" key, enter into symbols.
74         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
75         // Press/release "ABC" key, back to alphabet (not alphabet shifted).
76         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
77 
78         // Press/release shift key, enter into alphabet shifted.
79         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
80         // Press/release "?123" key, enter into symbols.
81         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
82         // Press/release "=\< key, enter into symbols shifted.
83         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
84         // Press/release "ABC" key, back to alphabet (not alphabet shifted).
85         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
86     }
87 
88     // Switching between alphabet shift locked and symbols.
testAlphabetShiftLockedAndSymbols()89     public void testAlphabetShiftLockedAndSymbols() {
90         // Long press shift key, enter alphabet shift locked.
91         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
92                 ALPHABET_SHIFT_LOCKED);
93 
94         // Press/release "?123" key, enter into symbols.
95         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
96         // Press/release "ABC" key, back to alphabet shift locked.
97         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
98         // Press/release "?123" key, enter into symbols.
99         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
100 
101         // Press/release "=\<" key, enter into symbols shifted.
102         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
103         // Press/release "ABC" key, back to alphabet shift locked.
104         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
105         // Press/release "?123" key, back to symbols (not symbols shifted).
106         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
107     }
108 
109     // Automatic switch back to alphabet by space key.
testSwitchBackBySpace()110     public void testSwitchBackBySpace() {
111         // Press/release "?123" key, enter into symbols.
112         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
113         // Enter symbol letter.
114         pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
115         // Enter space, switch back to alphabet.
116         pressAndReleaseKey(CODE_SPACE, SYMBOLS_UNSHIFTED, ALPHABET_UNSHIFTED);
117 
118         // Press/release "?123" key, enter into symbols.
119         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
120         // Press/release "=\<" key, enter into symbols shifted.
121         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
122         // Enter symbol shift letter.
123         pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
124         // Enter space, switch back to alphabet.
125         pressAndReleaseKey(CODE_SPACE, SYMBOLS_SHIFTED, ALPHABET_UNSHIFTED);
126         // Press/release "?123" key, enter into symbols (not symbols shifted).
127         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
128     }
129 
130     // Automatic switch back to alphabet shift locked test by space key.
testSwitchBackBySpaceShiftLocked()131     public void testSwitchBackBySpaceShiftLocked() {
132         // Long press shift key, enter alphabet shift locked.
133         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
134                 ALPHABET_SHIFT_LOCKED);
135 
136         // Press/release "?123" key, enter into symbols.
137         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
138         // Enter symbol letter.
139         pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
140         // Enter space, switch back to alphabet shift locked.
141         pressAndReleaseKey(CODE_SPACE, SYMBOLS_UNSHIFTED, ALPHABET_SHIFT_LOCKED);
142 
143         // Press/release "?123" key, enter into symbols.
144         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
145         // Press/release "=\<" key, enter into symbols shifted.
146         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
147         // Enter symbol shift letter.
148         pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
149         // Enter space, switch back to alphabet shift locked.
150         pressAndReleaseKey(CODE_SPACE, SYMBOLS_SHIFTED, ALPHABET_SHIFT_LOCKED);
151     }
152 
153     // Automatic switch back to alphabet by registered letters.
testSwitchBackChar()154     public void testSwitchBackChar() {
155         // Set switch back chars.
156         final String switchBackSymbols = "'";
157         final int switchBackCode = switchBackSymbols.codePointAt(0);
158         setLayoutSwitchBackSymbols(switchBackSymbols);
159         loadKeyboard(ALPHABET_UNSHIFTED);
160 
161         // Press/release "?123" key, enter into symbols.
162         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
163         // Enter symbol letter.
164         pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
165         // Enter switch back letter, switch back to alphabet.
166         pressAndReleaseKey(switchBackCode, SYMBOLS_UNSHIFTED, ALPHABET_UNSHIFTED);
167 
168         // Press/release "?123" key, enter into symbols.
169         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
170         // Press/release "=\<" key, enter into symbols shifted.
171         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
172         // Enter symbol shift letter.
173         pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
174         // Enter switch abck letter, switch back to alphabet.
175         pressAndReleaseKey(switchBackCode, SYMBOLS_SHIFTED, ALPHABET_UNSHIFTED);
176     }
177 
178     // Automatic switch back to alphabet shift locked by registered letters.
testSwitchBackCharShiftLocked()179     public void testSwitchBackCharShiftLocked() {
180         // Set switch back chars.
181         final String switchBackSymbols = "'";
182         final int switchBackCode = switchBackSymbols.codePointAt(0);
183         setLayoutSwitchBackSymbols(switchBackSymbols);
184         loadKeyboard(ALPHABET_UNSHIFTED);
185         // Long press shift key, enter alphabet shift locked.
186         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
187                 ALPHABET_SHIFT_LOCKED);
188 
189         // Press/release "?123" key, enter into symbols.
190         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
191         // Enter symbol letter.
192         pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
193         // Enter switch back letter, switch back to alphabet shift locked.
194         pressAndReleaseKey(switchBackCode, SYMBOLS_UNSHIFTED, ALPHABET_SHIFT_LOCKED);
195 
196         // Press/release "?123" key, enter into symbols.
197         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
198         // Press/release "=\<" key, enter into symbols shifted.
199         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
200         // Enter symbol shift letter.
201         pressAndReleaseKey(CODE_SPACE, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
202         // Enter switch back letter, switch back to alphabet shift locked.
203         pressAndReleaseKey(switchBackCode, SYMBOLS_SHIFTED, ALPHABET_SHIFT_LOCKED);
204     }
205 
206     // Automatic upper case test
testAutomaticUpperCase()207     public void testAutomaticUpperCase() {
208         // Set capitalize the first character of all words mode.
209         setAutoCapsMode(CAP_MODE_WORDS);
210         // Load keyboard, should be in automatic shifted.
211         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
212 
213         // Press/release letter key, switch to alphabet.
214         pressAndReleaseKey('A', ALPHABET_AUTOMATIC_SHIFTED, ALPHABET_UNSHIFTED);
215         // Press/release auto caps trigger letter, should be in automatic shifted.
216         pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
217 
218         // Press/release shift key, back to alphabet.
219         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
220         // Press/release letter key, remain in alphabet.
221         pressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
222         // Press/release auto caps trigger letter, should be in automatic shifted.
223         pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
224 
225         // Press/release "?123" key, enter into symbols.
226         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
227         // Press/release symbol letter key, remain in symbols.
228         pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
229         // Press/release space, switch back to automatic shifted.
230         pressAndReleaseKey(CODE_SPACE, SYMBOLS_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
231 
232         // Press/release "?123" key, enter into symbols.
233         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
234         // Press/release "=\<" key, enter into symbols shifted.
235         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
236         // Press/release symbol shift letter key, remain in symbols shifted.
237         pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
238         // Press/release space, switch back to automatic shifted.
239         pressAndReleaseKey(CODE_SPACE, SYMBOLS_SHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
240     }
241 
242     // Long press shift key.
testLongPressShift()243     public void testLongPressShift() {
244         // Set auto caps mode off.
245         setAutoCapsMode(CAP_MODE_OFF);
246         // Load keyboard, should be in alphabet.
247         loadKeyboard(ALPHABET_UNSHIFTED);
248         // Long press shift key, enter alphabet shift locked.
249         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
250                 ALPHABET_SHIFT_LOCKED);
251         // Press/release shift key, back to alphabet.
252         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
253 
254         // Long press shift key, enter alphabet shift locked.
255         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
256                 ALPHABET_SHIFT_LOCKED);
257         // Press/release letter key, remain in shift locked.
258         pressAndReleaseKey('A', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
259         // Press/release word separator, remain in shift locked.
260         pressAndReleaseKey(CODE_SPACE, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
261         // Press/release shift key, back to alphabet.
262         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
263 
264         // Long press shift key, enter alphabet shift locked.
265         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
266                 ALPHABET_SHIFT_LOCKED);
267         // Long press shift key, back to alphabet.
268         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_SHIFT_LOCK_SHIFTED,
269                 ALPHABET_UNSHIFTED);
270 
271         // Press/release shift key, enter alphabet shifted.
272         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
273         // Long press shift key, enter alphabet shift locked.
274         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
275                 ALPHABET_SHIFT_LOCKED);
276         // Press/release shift key, back to alphabet.
277         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
278 
279         // Set capitalize the first character of all words mode.
280         setAutoCapsMode(CAP_MODE_WORDS);
281         // Load keyboard, should be in automatic shifted.
282         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
283         // Long press shift key, enter alphabet shift locked.
284         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
285                 ALPHABET_SHIFT_LOCKED);
286         // Press/release shift key, back to alphabet.
287         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
288     }
289 
290     // Double tap shift key.
testDoubleTapShift()291     public void testDoubleTapShift() {
292         // First shift key tap.
293         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
294         // Second shift key tap.
295         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
296 
297         // First shift key tap.
298         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
299         // Second shift key tap.
300         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
301 
302         // Press/release shift key, enter alphabet manual shifted.
303         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
304 
305         // First shift key tap.
306         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
307         // Second shift key tap.
308         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
309 
310         // First shift key tap.
311         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
312         // Second shift key tap.
313         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
314 
315         // Set capitalize the first character of all words mode.
316         setAutoCapsMode(CAP_MODE_WORDS);
317         // Load keyboard, should be in automatic shifted.
318         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
319 
320         // First shift key tap.
321         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
322         // Second shift key tap.
323         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
324 
325         // First shift key tap.
326         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
327         // Second shift key tap.
328         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
329     }
330 
331     // Update shift state.
testUpdateShiftState()332     public void testUpdateShiftState() {
333         // Set auto caps mode off.
334         setAutoCapsMode(CAP_MODE_OFF);
335         // Load keyboard, should be in alphabet.
336         loadKeyboard(ALPHABET_UNSHIFTED);
337         // Update shift state, remained in alphabet.
338         updateShiftState(ALPHABET_UNSHIFTED);
339 
340         // Press/release shift key, enter alphabet shifted.
341         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
342         // Update shift state, back to alphabet.
343         updateShiftState(ALPHABET_UNSHIFTED);
344 
345         // Long press shift key, enter alphabet shift locked.
346         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
347                 ALPHABET_SHIFT_LOCKED);
348         // Update shift state, remained in alphabet shift locked.
349         updateShiftState(ALPHABET_SHIFT_LOCKED);
350         // Long press shift key, back to alphabet.
351         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_SHIFT_LOCK_SHIFTED,
352                 ALPHABET_UNSHIFTED);
353 
354         // Press/release "?123" key, enter into symbols.
355         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
356         // Update shift state, remained in symbols.
357         updateShiftState(SYMBOLS_UNSHIFTED);
358 
359         // Press/release "=\<" key, enter symbols shifted.
360         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
361         // Update shift state, remained in symbols shifted.
362         updateShiftState(SYMBOLS_SHIFTED);
363 
364         // Set capitalize the first character of all words mode.
365         setAutoCapsMode(CAP_MODE_WORDS);
366         // Load keyboard, should be in automatic shifted.
367         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
368         // Update shift state, remained in automatic shifted.
369         updateShiftState(ALPHABET_AUTOMATIC_SHIFTED);
370 
371         // Press/release shift key, enter alphabet.
372         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
373         // Press/release shift key, enter alphabet shifted.
374         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
375         // Update shift state, enter to automatic shifted (not alphabet shifted).
376         updateShiftState(ALPHABET_AUTOMATIC_SHIFTED);
377 
378         // Long press shift key, enter alphabet shift locked.
379         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
380                 ALPHABET_SHIFT_LOCKED);
381         // Update shift state, remained in alphabet shift locked (not automatic shifted).
382         updateShiftState(ALPHABET_SHIFT_LOCKED);
383         // Long press shift key, back to alphabet.
384         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_SHIFT_LOCK_SHIFTED,
385                 ALPHABET_UNSHIFTED);
386 
387         // Load keyboard, should be in automatic shifted.
388         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
389         // Press/release "?123" key, enter into symbols.
390         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
391         // Update shift state, remained in symbols.
392         updateShiftState(SYMBOLS_UNSHIFTED);
393 
394         // Press/release "=\<" key, enter symbols shifted.
395         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
396         // Update shift state, remained in symbols shifted.
397         updateShiftState(SYMBOLS_SHIFTED);
398     }
399 
400     // Sliding input in alphabet.
testSlidingAlphabet()401     public void testSlidingAlphabet() {
402         // Alphabet -> shift key + letter -> alphabet.
403         // Press and slide from shift key, enter alphabet shifted.
404         pressAndSlideFromKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
405         // Enter/release letter key, switch back to alphabet.
406         pressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
407 
408         // Alphabet -> "?123" key + letter -> alphabet.
409         // Press and slide from "123?" key, enter symbols.
410         pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
411         // Enter/release into symbol letter key, switch back to alphabet.
412         pressAndReleaseKey('!', SYMBOLS_UNSHIFTED, ALPHABET_UNSHIFTED);
413 
414         // Alphabet shifted -> shift key + letter -> alphabet.
415         // Press/release shift key, enter alphabet shifted.
416         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
417         // Press and slide from shift key, remain alphabet shifted.
418         pressAndSlideFromKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
419         // Enter/release letter key, switch back to alphabet (not alphabet shifted).
420         pressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
421 
422         // Alphabet shifted -> "?123" key + letter -> alphabet.
423         // Press/release shift key, enter alphabet shifted.
424         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
425         // Press and slide from "123?" key, enter symbols.
426         pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
427         // Enter/release into symbol letter key, switch back to alphabet (not alphabet shifted).
428         pressAndReleaseKey('!', SYMBOLS_UNSHIFTED, ALPHABET_UNSHIFTED);
429 
430         // Alphabet shift locked -> shift key + letter -> alphabet shift locked.
431         // Long press shift key, enter alphabet shift locked.
432         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
433                 ALPHABET_SHIFT_LOCKED);
434         // Press and slide from "123?" key, enter symbols.
435         pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
436         // Enter/release into symbol letter key, switch back to alphabet shift locked.
437         pressAndReleaseKey('!', SYMBOLS_UNSHIFTED, ALPHABET_SHIFT_LOCKED);
438 
439         // Alphabet shift locked -> "?123" key + letter -> alphabet shift locked.
440         // Press and slide from shift key, enter alphabet shifted.
441         pressAndSlideFromKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_SHIFT_LOCKED);
442         // Enter/release letter key, switch back to shift locked.
443         pressAndReleaseKey('Z', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
444     }
445 
446     // Sliding input in symbols.
testSlidingSymbols()447     public void testSlidingSymbols() {
448         // Symbols -> "=\<" key + letter -> symbols.
449         // Press/release "?123" key, enter into symbols.
450         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
451         // Press and slide from shift key, enter symols shifted.
452         pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
453         // Enter/release symbol shifted letter key, switch back to symbols.
454         pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_UNSHIFTED);
455 
456         // Symbols -> "ABC" key + letter -> Symbols.
457         // Press and slide from "ABC" key, enter alphabet.
458         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
459         // Enter/release letter key, switch back to symbols.
460         pressAndReleaseKey('a', ALPHABET_UNSHIFTED, SYMBOLS_UNSHIFTED);
461         // Press/release "ABC" key, switch to alphabet.
462         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
463 
464         // Alphabet shifted -> symbols -> "ABC" key + letter -> symbols ->
465         // alphabet.
466         // Load keyboard
467         loadKeyboard(ALPHABET_UNSHIFTED);
468         // Press/release shift key, enter alphabet shifted.
469         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
470         // Press/release "?123" key, enter into symbols.
471         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
472         // Press and slide from "ABC" key.
473         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
474         // Enter/release letter key, switch back to symbols.
475         pressAndReleaseKey('a', ALPHABET_UNSHIFTED, SYMBOLS_UNSHIFTED);
476         // Press/release "ABC" key, switch to alphabet (not alphabet shifted).
477         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
478 
479         // Alphabet shift locked -> symbols -> "ABC" key + letter -> symbols ->
480         // alphabet shift locked.
481         // Load keyboard
482         loadKeyboard(ALPHABET_UNSHIFTED);
483         // Long press shift key, enter alphabet shift locked.
484         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
485                 ALPHABET_SHIFT_LOCKED);
486         // Press/release "?123" key, enter into symbols.
487         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
488         // Press and slide from "ABC" key, enter alphabet shift locked.
489         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
490         // Enter/release letter key, switch back to symbols.
491         pressAndReleaseKey('A', ALPHABET_SHIFT_LOCKED, SYMBOLS_UNSHIFTED);
492         // Press/release "ABC" key, switch to alphabet shift locked.
493         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
494 
495         // Alphabet shift locked -> symbols -> "=\<" key + letter -> symbols ->
496         // alphabet shift locked.
497         // Load keyboard
498         loadKeyboard(ALPHABET_UNSHIFTED);
499         // Long press shift key, enter alphabet shift locked.
500         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
501                 ALPHABET_SHIFT_LOCKED);
502         // Press/release "?123" key, enter into symbols.
503         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
504         // Press and slide from "=\<" key, enter symbols shifted.
505         pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
506         // Enter/release symbols shift letter key, switch back to symbols.
507         pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_UNSHIFTED);
508         // Press/release "ABC" key, switch to alphabet shift locked.
509         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
510     }
511 
512     // Sliding input in symbols shifted.
testSlidingSymbolsShifted()513     public void testSlidingSymbolsShifted() {
514         // Symbols shifted -> "?123" + letter -> symbols shifted.
515         // Press/release "?123" key, enter into symbols.
516         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
517         // Press/release "=\<" key, enter into symbols shifted.
518         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
519         // Press and slide from shift key, enter symbols.
520         pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
521         // Enter/release symbol letter key, switch back to symbols shifted.
522         pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_SHIFTED);
523 
524         // Symbols shifted -> "ABC" key + letter -> symbols shifted.
525         // Press and slide from "ABC" key, enter alphabet.
526         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
527         // Enter/release letter key, switch back to symbols shifted.
528         pressAndReleaseKey('a', ALPHABET_UNSHIFTED, SYMBOLS_SHIFTED);
529         // Press/release "ABC" key, switch to alphabet.
530         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
531 
532         // Alphabet shifted -> symbols shifted -> "ABC" + letter -> symbols shifted ->
533         // alphabet.
534         // Load keyboard
535         loadKeyboard(ALPHABET_UNSHIFTED);
536         // Press/release shift key, enter alphabet shifted.
537         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
538         // Press/release "?123" key, enter into symbols.
539         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
540         // Press/release "=\<" key, enter into symbols shifted.
541         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
542         // Press and slide from "ABC" key.
543         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
544         // Enter/release letter key, switch back to symbols shifted.
545         pressAndReleaseKey('a', ALPHABET_UNSHIFTED, SYMBOLS_SHIFTED);
546         // Press/release "ABC" key, switch to alphabet (not alphabet shifted).
547         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
548 
549         // Alphabet shift locked -> symbols shifted -> "ABC" + letter -> symbols shifted ->
550         // alphabet shift locked.
551         // Load keyboard
552         loadKeyboard(ALPHABET_UNSHIFTED);
553         // Long press shift key, enter alphabet shift locked.
554         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
555                 ALPHABET_SHIFT_LOCKED);
556         // Press/release "?123" key, enter into symbols.
557         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
558         // Press/release "=\<" key, enter into symbols shifted.
559         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
560         // Press and slide from "ABC" key.
561         pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
562         // Enter/release letter key, switch back to symbols shifted.
563         pressAndReleaseKey('A', ALPHABET_SHIFT_LOCKED, SYMBOLS_SHIFTED);
564         // Press/release "ABC" key, switch to alphabet shift locked.
565         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
566 
567         // Alphabet shift locked -> symbols shifted -> "?123" + letter -> symbols shifted ->
568         // alphabet shift locked.
569         // Load keyboard
570         loadKeyboard(ALPHABET_UNSHIFTED);
571         // Long press shift key, enter alphabet shift locked.
572         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
573                 ALPHABET_SHIFT_LOCKED);
574         // Press/release "?123" key, enter into symbols.
575         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
576         // Press/release "=\<" key, enter into symbols shifted.
577         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
578         // Press and slide from "?123" key.
579         pressAndSlideFromKey(CODE_SHIFT, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
580         // Enter/release symbol letter key, switch back to symbols shifted.
581         pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_SHIFTED);
582         // Press/release "ABC" key, switch to alphabet shift locked.
583         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
584     }
585 
586     // Change focus to new text field.
testChangeFocus()587     public void testChangeFocus() {
588         // Press/release shift key.
589         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
590         // Change focus to new text field.
591         loadKeyboard(ALPHABET_UNSHIFTED);
592 
593         // Long press shift key, enter alphabet shift locked.
594         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
595                 ALPHABET_SHIFT_LOCKED);
596         // Change focus to new text field.
597         loadKeyboard(ALPHABET_UNSHIFTED);
598 
599         // Press/release "?123" key.
600         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
601         // Change focus to new text field.
602         loadKeyboard(ALPHABET_UNSHIFTED);
603 
604         // Press/release "?123" key.
605         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
606         // Press/release "=\<" key.
607         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
608         // Change focus to new text field.
609         loadKeyboard(ALPHABET_UNSHIFTED);
610     }
611 
612     // Change focus to auto caps text field.
testChangeFocusAutoCaps()613     public void testChangeFocusAutoCaps() {
614         // Set capitalize the first character of all words mode.
615         setAutoCapsMode(CAP_MODE_WORDS);
616         // Change focus to new text field.
617         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
618 
619         // Press/release shift key, enter alphabet.
620         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
621         // Change focus to new text field.
622         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
623 
624         // Long press shift key, enter alphabet shift locked.
625         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
626                 ALPHABET_SHIFT_LOCKED);
627         // Change focus to new text field.
628         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
629 
630         // Press/release "?123" key.
631         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
632         // Change focus to new text field.
633         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
634 
635         // Press/release "?123" key.
636         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
637         // Press/release "=\<" key.
638         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
639         // Change focus to new text field.
640         loadKeyboard(ALPHABET_AUTOMATIC_SHIFTED);
641     }
642 
643     // Change orientation.
testChangeOrientation()644     public void testChangeOrientation() {
645         // Alphabet -> rotate -> alphabet.
646         updateShiftState(ALPHABET_UNSHIFTED);
647         // Rotate device, remain in alphabet.
648         rotateDevice(ALPHABET_UNSHIFTED);
649 
650         // Alphabet shifted -> rotate -> alphabet shifted.
651         // Press/release shift key, enter alphabet shifted.
652         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
653         // Rotate device, remain in alphabet shifted.
654         rotateDevice(ALPHABET_MANUAL_SHIFTED);
655 
656         // Alphabet shift locked -> rotate -> alphabet shift locked.
657         // Long press shift key, enter alphabet shift locked.
658         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
659                 ALPHABET_SHIFT_LOCKED);
660         // Rotate device, remain in alphabet shift locked.
661         rotateDevice(ALPHABET_SHIFT_LOCKED);
662 
663         // Alphabet shift locked -> symbols -> rotate -> symbols ->
664         // Alphabet shift locked.
665         // Press/release "?123" key, enter symbols.
666         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
667         // Rotate device, remain in symbols,
668         rotateDevice(SYMBOLS_UNSHIFTED);
669         // Press/release "ABC" key, alphabet shift locked state should be maintained.
670         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
671 
672         // Alphabet shift locked -> symbols shifted -> rotate -> symbols shifted ->
673         // Alphabet shift locked.
674         // Press/release "?123" key, enter symbols.
675         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
676         // Press/release "=\<" key, enter symbols shifted.
677         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
678         // Rotate device, remain in symbols shifted.
679         rotateDevice(SYMBOLS_SHIFTED);
680         // Press/release "ABC" key, alphabet shift locked state should be maintained.
681         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
682 
683         // Alphabet shift locked -> symbols shifted -> alphabet shift locked -> rotate ->
684         // Alphabet shift locked -> symbols.
685         // Press/release "?123" key, enter symbols.
686         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
687         // Press/release "=\<" key, enter symbols shifted.
688         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
689         // Press/release "ABC" key, enter alphabet shift locked.
690         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
691         // Rotate device, remain in alphabet shift locked.
692         rotateDevice(ALPHABET_SHIFT_LOCKED);
693         // Press/release "?123" key, enter symbols (not symbols shifted).
694         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
695 
696         // Alphabet -> symbols shifted -> alphabet -> rotate ->
697         // Alphabet -> symbols.
698         loadKeyboard(ALPHABET_UNSHIFTED);
699         // Press/release "?123" key, enter symbols.
700         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
701         // Press/release "=\<" key, enter symbols shifted.
702         pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
703         // Press/release "ABC" key, enter alphabet.
704         pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
705         // Rotate device, remain in alphabet shift locked.
706         rotateDevice(ALPHABET_UNSHIFTED);
707         // Press/release "?123" key, enter symbols (not symbols shifted).
708         pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
709     }
710 
711     // Rapidly type shift key.
testRapidShiftTyping()712     public void testRapidShiftTyping() {
713         // Press/release shift key
714         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
715         // Rapidly press/release letter key.
716         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
717         // Rapidly press/release shift key.
718         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
719         // Rapidly press/release letter key.
720         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
721         // Rapidly press/release shift key.
722         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
723         // Rapidly press/release letter key.
724         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
725 
726         // Press/release shift key to enter alphabet manual shifted.
727         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
728         // Press/release shift key
729         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
730         // Rapidly press/release letter key.
731         secondPressAndReleaseKey('j', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
732         // Rapidly press/release shift key.
733         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
734         // Rapidly press/release letter key.
735         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
736         // Rapidly press/release shift key.
737         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
738         // Rapidly press/release letter key.
739         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
740 
741         // Long press shift key to enter alphabet shift locked.
742         longPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED,
743                 ALPHABET_SHIFT_LOCKED);
744         // Press/release shift key
745         pressAndReleaseKey(CODE_SHIFT, ALPHABET_SHIFT_LOCK_SHIFTED, ALPHABET_UNSHIFTED);
746         // Rapidly press/release letter key.
747         secondPressAndReleaseKey('j', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
748         // Rapidly press/release shift key.
749         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
750         // Rapidly press/release letter key.
751         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
752         // Rapidly press/release shift key.
753         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
754         // Rapidly press/release letter key.
755         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
756 
757         // Set capitalize the first character of all words mode.
758         setAutoCapsMode(CAP_MODE_WORDS);
759         // Press/release auto caps trigger letter to enter alphabet automatic shifted.
760         pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
761         // Press/release shift key
762         pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
763         // Rapidly press/release letter key.
764         secondPressAndReleaseKey('j', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
765         // Rapidly press/release shift key.
766         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
767         // Rapidly press/release letter key.
768         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
769         // Rapidly press/release shift key.
770         secondPressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
771         // Rapidly press/release letter key.
772         secondPressAndReleaseKey('J', ALPHABET_MANUAL_SHIFTED, ALPHABET_UNSHIFTED);
773     }
774 }
775