Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2013 The Chromium Authors. All rights reserved. | 2 * Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Tester for lonpress typing accents. | 8 * Tester for lonpress typing accents. |
| 9 */ | 9 */ |
| 10 function LongPressTypingTester(layout) { | 10 function LongPressTypingTester(layout) { |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 charValue: unicodeValue, | 298 charValue: unicodeValue, |
| 299 keyCode: 0x41, | 299 keyCode: 0x41, |
| 300 modifiers: Modifier.NONE | 300 modifiers: Modifier.NONE |
| 301 }); | 301 }); |
| 302 key.down(mockEvent); | 302 key.down(mockEvent); |
| 303 key.out(mockEvent); | 303 key.out(mockEvent); |
| 304 mockTypeCharacter('s', 0x53, Modifier.NONE); | 304 mockTypeCharacter('s', 0x53, Modifier.NONE); |
| 305 }; | 305 }; |
| 306 onKeyboardReady('testFingerOutType', runTest, testDoneCallback); | 306 onKeyboardReady('testFingerOutType', runTest, testDoneCallback); |
| 307 } | 307 } |
| 308 | |
| 309 /** | |
| 310 * Tests that flicking upwards on a key with hintText types the hint text. | |
| 311 * @param {Function} testDoneCallback The callback function on completion. | |
| 312 */ | |
| 313 function testSwipeFlick(testDoneCallback) { | |
| 314 var mockEvent = function(x, y, target) { | |
| 315 return { | |
| 316 pointerId: 1, | |
| 317 isPrimary: true, | |
| 318 screenX: x, | |
| 319 screenY: y, | |
| 320 target: target | |
| 321 }; | |
| 322 } | |
| 323 var runTest = function() { | |
| 324 var key = findKey('.'); | |
| 325 var send = chrome.virtualKeyboardPrivate.sendKeyEvent; | |
| 326 // Test flick on the '.', expect '?' to appear. | |
| 327 send.addExpectation({ | |
| 328 type: 'keydown', | |
| 329 charValue: '?'.charCodeAt(0), | |
| 330 keyCode: 0xBF, | |
| 331 modifiers: Modifier.SHIFT | |
| 332 }); | |
| 333 send.addExpectation({ | |
| 334 type: 'keyup', | |
| 335 charValue: '?'.charCodeAt(0), | |
| 336 keyCode: 0xBF, | |
| 337 modifiers: Modifier.SHIFT | |
| 338 }); | |
| 339 var height = key.clientHeight; | |
| 340 $('keyboard').updateSwipeTracker(mockEvent(0, -height/2, key)); | |
|
kevers
2013/12/02 21:04:36
Can you use a pointer down and move in place of a
rsadam
2013/12/03 15:56:33
Done.
| |
| 341 $('keyboard').up(mockEvent(0, -height, key)); | |
| 342 | |
| 343 // Test long flick. Should not have any output. | |
| 344 $('keyboard').updateSwipeTracker(mockEvent(0, -height/2, key)); | |
| 345 $('keyboard').updateSwipeTracker(mockEvent(0, -2*height, key)); | |
| 346 $('keyboard').up(mockEvent(0, -2*height, key)); | |
| 347 | |
| 348 // Test composed swipe and flick. Should not have any output. | |
| 349 var move = chrome.virtualKeyboardPrivate.moveCursor; | |
| 350 move.addExpectation(SwipeDirection.RIGHT, | |
| 351 Modifier.CONTROL & Modifier.SHIFT); | |
| 352 var width = key.clientWidth; | |
| 353 $('keyboard').updateSwipeTracker(mockEvent(0, -height/2, key)); | |
| 354 $('keyboard').updateSwipeTracker(mockEvent(width, -height/2, key)); | |
| 355 $('keyboard').up(mockEvent(width, -height/2, key)); | |
| 356 }; | |
| 357 onKeyboardReady('testSwipeFlick', runTest, testDoneCallback); | |
| 358 } | |
| OLD | NEW |