| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Include test fixture. | 5 // Include test fixture. |
| 6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']); | 6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']); |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Test fixture for cvox2.cursors. | 9 * Test fixture for cvox2.cursors. |
| 10 * @constructor | 10 * @constructor |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 assertEquals('inlineTextBox', secondLine.role); | 368 assertEquals('inlineTextBox', secondLine.role); |
| 369 assertEquals('diff ', secondLine.name); | 369 assertEquals('diff ', secondLine.name); |
| 370 | 370 |
| 371 var secondLineCursor = new cursors.Cursor(secondLine, -1); | 371 var secondLineCursor = new cursors.Cursor(secondLine, -1); |
| 372 assertEquals(-1, secondLineCursor.selectionIndex_); | 372 assertEquals(-1, secondLineCursor.selectionIndex_); |
| 373 secondLineCursor = new cursors.Cursor(secondLine, 0); | 373 secondLineCursor = new cursors.Cursor(secondLine, 0); |
| 374 secondLineCursor.index = 0; | 374 secondLineCursor.index = 0; |
| 375 assertEquals(6, secondLineCursor.selectionIndex_); | 375 assertEquals(6, secondLineCursor.selectionIndex_); |
| 376 }); | 376 }); |
| 377 }); | 377 }); |
| 378 |
| 379 TEST_F('CursorsTest', 'ExhaustSelection', function() { |
| 380 this.runWithLoadedTree(function() {/*! |
| 381 <p style="max-width: 100px"> |
| 382 A new version of the ChromeVox screen |
| 383 reader on Chrome OS, currently known as “ChromeVox Next,” is |
| 384 available for beta testing. |
| 385 </p> |
| 386 */}, |
| 387 function(root) { |
| 388 var node = root.firstChild.firstChild; |
| 389 var range = new cursors.Range( |
| 390 new cursors.Cursor(node, 0), |
| 391 new cursors.Cursor(node, node.name.length)); |
| 392 var length = range.end.selectionIndex_; |
| 393 var rev = function(start, end) { |
| 394 if (start == end && end == (length - 1)) |
| 395 return; |
| 396 |
| 397 if (start == length - 1) { |
| 398 start = 0; |
| 399 end++; |
| 400 }else { |
| 401 start++; |
| 402 } |
| 403 |
| 404 this.listenOnce(root, 'textSelectionChanged', function() { |
| 405 console.log('Received selection: '+root.anchorOffset + ' ' + root.focusO
ffset); |
| 406 rev(start, end); |
| 407 }, true); |
| 408 |
| 409 range.start.index_ = start; |
| 410 range.end.index_ = end; |
| 411 |
| 412 console.log('Waiting for textSelectionChanged on: ' + start + ' ' + end); |
| 413 range.select(); |
| 414 }.bind(this); |
| 415 |
| 416 rev(-1, 0); |
| 417 }); |
| 418 }); |
| OLD | NEW |