Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs

Issue 2948173004: Fix end of line announcements (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 455
456 // Negative cases. 456 // Negative cases.
457 assertFalse(rootRange.contentEquals(regionRange)); 457 assertFalse(rootRange.contentEquals(regionRange));
458 assertFalse(rootRange.contentEquals(staticTextRange)); 458 assertFalse(rootRange.contentEquals(staticTextRange));
459 assertFalse(rootRange.contentEquals(inlineTextBoxRange)); 459 assertFalse(rootRange.contentEquals(inlineTextBoxRange));
460 assertFalse(regionRange.contentEquals(rootRange)); 460 assertFalse(regionRange.contentEquals(rootRange));
461 assertFalse(staticTextRange.contentEquals(rootRange)); 461 assertFalse(staticTextRange.contentEquals(rootRange));
462 assertFalse(inlineTextBoxRange.contentEquals(rootRange)); 462 assertFalse(inlineTextBoxRange.contentEquals(rootRange));
463 }); 463 });
464 }); 464 });
465
466 TEST_F('CursorsTest', 'DeepEquivalency', function() {
467 this.runWithLoadedTree(function() {/*!
468 <p style="word-spacing:100000px">this is a test</p>
469 */}, function(root) {
470 var textNode = root.find({role: RoleType.STATIC_TEXT});
471
472 var text = new cursors.Cursor(textNode, 2);
473 deep = text.deepEquivalent;
474 assertEquals('this ', deep.node.name);
475 assertEquals(RoleType.INLINE_TEXT_BOX, deep.node.role);
476 assertEquals(2, deep.index);
477
478 text = new cursors.Cursor(textNode, 5);
479 deep = text.deepEquivalent;
480 assertEquals('is ', deep.node.name);
481 assertEquals(RoleType.INLINE_TEXT_BOX, deep.node.role);
482 assertEquals(0, deep.index);
483
484 text = new cursors.Cursor(textNode, 7);
485 deep = text.deepEquivalent;
486 assertEquals('is ', deep.node.name);
487 assertEquals(RoleType.INLINE_TEXT_BOX, deep.node.role);
488 assertEquals(2, deep.index);
489
490 text = new cursors.Cursor(textNode, 8);
491 deep = text.deepEquivalent;
492 assertEquals('a ', deep.node.name);
493 assertEquals(RoleType.INLINE_TEXT_BOX, deep.node.role);
494 assertEquals(0, deep.index);
495
496 text = new cursors.Cursor(textNode, 11);
497 deep = text.deepEquivalent;
498 assertEquals('test', deep.node.name);
499 assertEquals(RoleType.INLINE_TEXT_BOX, deep.node.role);
500 assertEquals(1, deep.index);
501
502 // This is the only selection that can be placed at the length of the node's
503 // text. This only happens at the end of a line.
504 text = new cursors.Cursor(textNode, 14);
505 deep = text.deepEquivalent;
506 assertEquals('test', deep.node.name);
507 assertEquals(RoleType.INLINE_TEXT_BOX, deep.node.role);
508 assertEquals(4, deep.index);
509
510 // However, any offset larger is invalid.
511 text = new cursors.Cursor(textNode, 15);
512 deep = text.deepEquivalent;
513 assertTrue(text.equals(deep));
514 });
515 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698