diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /accessible/tests/mochitest/pivot | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/tests/mochitest/pivot')
5 files changed, 473 insertions, 0 deletions
diff --git a/accessible/tests/mochitest/pivot/a11y.ini b/accessible/tests/mochitest/pivot/a11y.ini new file mode 100644 index 0000000000..8add460947 --- /dev/null +++ b/accessible/tests/mochitest/pivot/a11y.ini @@ -0,0 +1,8 @@ +[DEFAULT] +support-files = + doc_virtualcursor.html + doc_virtualcursor_text.html + !/accessible/tests/mochitest/*.js + +[test_virtualcursor.html] +[test_virtualcursor_text.html] diff --git a/accessible/tests/mochitest/pivot/doc_virtualcursor.html b/accessible/tests/mochitest/pivot/doc_virtualcursor.html new file mode 100644 index 0000000000..a456f2dfcd --- /dev/null +++ b/accessible/tests/mochitest/pivot/doc_virtualcursor.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html> +<head> + <title>Pivot test document</title> + <meta charset="utf-8" /> +</head> +<body> + <h1 id="heading-1-1">Main Title</h1> + <h2 id="heading-2-1" aria-hidden="true">First Section Title</h2> + <p id="paragraph-1"> + Lorem ipsum <strong>dolor</strong> sit amet. Integer vitae urna + leo, id <a href="#">semper</a> nulla. + </p> + <h2 id="heading-2-2" aria-hidden="undefined">Second Section Title</h2> + <p id="paragraph-2" aria-hidden=""> + Sed accumsan luctus lacus, vitae mollis arcu tristique vulputate.</p> + <p id="paragraph-3" aria-hidden="true"> + <a href="#" id="hidden-link">Maybe</a> it was the other <i>George Michael</i>. + You know, the <a href="#">singer-songwriter</a>. + </p> + <p style="opacity: 0;" id="paragraph-4"> + This is completely transparent + </p> + <iframe + src="data:text/html,<html><body>An <i>embedded</i> document.</body></html>"> + </iframe> + <div id="hide-me">Hide me</div> + <p id="links" aria-hidden="false"> + <a href="http://mozilla.org" title="Link 1 title">Link 1</a> + <a href="http://mozilla.org" title="Link 2 title">Link 2</a> + <a href="http://mozilla.org" title="Link 3 title">Link 3</a> + </p> + <ul> + <li>Hello<span> </span></li> + <li>World</li> + </ul> +</body> +</html> diff --git a/accessible/tests/mochitest/pivot/doc_virtualcursor_text.html b/accessible/tests/mochitest/pivot/doc_virtualcursor_text.html new file mode 100644 index 0000000000..a0565058d9 --- /dev/null +++ b/accessible/tests/mochitest/pivot/doc_virtualcursor_text.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html> +<head> + <title>Pivot test document</title> + <meta charset="utf-8" /> +</head> +<body> + <div id="start-block">This is the very beginning.</div> + <p id="paragraph-1"> + This <b>is</b> <a id="p1-link-1" href="#">the</a> test of text. + </p> + <div id="section-1">A <a id="s1-link-1" href="#">multiword link</a> is here. <a id="s1-link-2" href="#">We</a> will traverse</div> + <div id="section-2">into, out, and between the subtrees.</div> + <p id="paragraph-2">Singularity.</p> + <table> + <tr> + <td id="cell-1">Magical</td> + <td id="cell-2">unicorns</td> + </tr> + <tr> + <td id="cell-3">and wizards</td> + <td id="cell-4">really exist.</td> + </tr> + </table> + <div id="section-3">Endless fun!</div> + <p id="paragraph-3">Objects<a id="p3-link-1" href="#">adjacent</a>to <a id="p3-link-2" href="#">each</a><a id="p3-link-3" href="#">other</a> should be separate.</p> + <p id="paragraph-4">Hello <strong>real</strong><a href="#"> world</p> + <a href="#" id="image-desc-link"> + <img src="../moz.png" alt="">Hello + </a> + <p id="image-end-line"> + a<img src="../moz.png" alt="b"><br> + c + </p> + <div id="end-block">End!</div> +</body> +</html> diff --git a/accessible/tests/mochitest/pivot/test_virtualcursor.html b/accessible/tests/mochitest/pivot/test_virtualcursor.html new file mode 100644 index 0000000000..9f3225fcf6 --- /dev/null +++ b/accessible/tests/mochitest/pivot/test_virtualcursor.html @@ -0,0 +1,119 @@ +<!DOCTYPE html> +<html> +<head> + <title>Tests pivot functionality in virtual cursors</title> + <meta charset="utf-8" /> + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"> + </script> + <script src="chrome://mochikit/content/chrome-harness.js"> + </script> + + <script type="application/javascript" src="../common.js"></script> + <script type="application/javascript" src="../browser.js"></script> + <script type="application/javascript" src="../events.js"></script> + <script type="application/javascript" src="../role.js"></script> + <script type="application/javascript" src="../states.js"></script> + <script type="application/javascript" src="../pivot.js"></script> + <script type="application/javascript" src="../layout.js"></script> + + <script type="application/javascript"> + var gBrowserWnd = null; + var gQueue = null; + + function doTest() { + var rootAcc = getAccessible(browserDocument(), [nsIAccessibleDocument]); + ok(rootAcc.virtualCursor, + "root document does not have virtualCursor"); + + var doc = currentTabDocument(); + var docAcc = getAccessible(doc, [nsIAccessibleDocument]); + + // Test that embedded documents have their own virtual cursor. + is(docAcc.childDocumentCount, 1, "Expecting one child document"); + ok(docAcc.getChildDocumentAt(0).virtualCursor, + "child document does not have virtualCursor"); + + gQueue = new eventQueue(); + + gQueue.onFinish = function onFinish() { + closeBrowserWindow(); + }; + + queueTraversalSequence(gQueue, docAcc, HeadersTraversalRule, null, + ["heading-1-1", "heading-2-2"]); + + queueTraversalSequence( + gQueue, docAcc, ObjectTraversalRule, null, + ["Main Title", "Lorem ipsum ", + "dolor", " sit amet. Integer vitae urna leo, id ", + "semper", " nulla. ", "Second Section Title", + "Sed accumsan luctus lacus, vitae mollis arcu tristique vulputate.", + "An ", "embedded", " document.", "Hide me", "Link 1", "Link 2", + "Link 3", "Hello", "World"]); + + // Just a random smoke test to see if our setTextRange works. + gQueue.push( + new setVCRangeInvoker( + docAcc, + getAccessible(doc.getElementById("paragraph-2"), nsIAccessibleText), + [2, 6])); + + gQueue.push(new removeVCPositionInvoker( + docAcc, doc.getElementById("hide-me"))); + + gQueue.push(new removeVCRootInvoker( + doc.getElementById("links"))); + + var [x, y] = getBounds(getAccessible(doc.getElementById("heading-1-1"))); + gQueue.push(new moveVCCoordInvoker(docAcc, x + 1, y + 1, true, + HeadersTraversalRule, "heading-1-1")); + + // Already on the point, so we should not get a move event. + gQueue.push(new moveVCCoordInvoker(docAcc, x + 1, y + 1, true, + HeadersTraversalRule, false)); + + // Attempting a coordinate outside any header, should not move. + gQueue.push(new moveVCCoordInvoker(docAcc, x - 1, y - 1, true, + HeadersTraversalRule, false)); + + // Attempting a coordinate outside any header, should move to null + gQueue.push(new moveVCCoordInvoker(docAcc, x - 1, y - 1, false, + HeadersTraversalRule, null)); + + queueTraversalSequence( + gQueue, docAcc, ObjectTraversalRule, + getAccessible(doc.getElementById("paragraph-1")), + ["Lorem ipsum ", "dolor", " sit amet. Integer vitae urna leo, id ", + "semper", " nulla. "]); + + gQueue.push(new setModalRootInvoker(docAcc, docAcc.parent, + NS_ERROR_INVALID_ARG)); + + gQueue.push(new setVCPosInvoker(docAcc, "moveNext", ObjectTraversalRule, "dolor")); + + gQueue.invoke(); + } + + SimpleTest.waitForExplicitFinish(); + addLoadEvent(function() { + /* We open a new browser because we need to test with a top-level content + document. */ + openBrowserWindow( + doTest, + getRootDirectory(window.location.href) + "doc_virtualcursor.html"); + }); + </script> +</head> +<body id="body"> + + <a target="_blank" + title="Introduce virtual cursor/soft focus functionality to a11y API" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=698823">Mozilla Bug 698823</a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> +</body> +</html> diff --git a/accessible/tests/mochitest/pivot/test_virtualcursor_text.html b/accessible/tests/mochitest/pivot/test_virtualcursor_text.html new file mode 100644 index 0000000000..23d46f3fe6 --- /dev/null +++ b/accessible/tests/mochitest/pivot/test_virtualcursor_text.html @@ -0,0 +1,271 @@ +<!DOCTYPE html> +<html> +<head> + <title>Tests pivot functionality in virtual cursors</title> + <meta charset="utf-8" /> + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"> + </script> + <script src="chrome://mochikit/content/chrome-harness.js"> + </script> + + <script type="application/javascript" src="../common.js"></script> + <script type="application/javascript" src="../text.js"></script> + <script type="application/javascript" src="../browser.js"></script> + <script type="application/javascript" src="../events.js"></script> + <script type="application/javascript" src="../role.js"></script> + <script type="application/javascript" src="../states.js"></script> + <script type="application/javascript" src="../pivot.js"></script> + <script type="application/javascript" src="../layout.js"></script> + + <script type="application/javascript"> + var gBrowserWnd = null; + var gQueue = null; + + function doTest() { + var doc = currentTabDocument(); + var docAcc = getAccessible(doc, [nsIAccessibleDocument]); + + gQueue = new eventQueue(); + + gQueue.onFinish = function onFinish() { + closeBrowserWindow(); + }; + + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("paragraph-1")))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 4], + getAccessible(doc.getElementById("paragraph-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", CHAR_BOUNDARY, [4, 5], + getAccessible(doc.getElementById("paragraph-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", CHAR_BOUNDARY, [3, 4], + getAccessible(doc.getElementById("paragraph-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [5, 7], + getAccessible(doc.getElementById("paragraph-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 3], + getAccessible(doc.getElementById("p1-link-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [10, 14], + getAccessible(doc.getElementById("paragraph-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 3], + getAccessible(doc.getElementById("p1-link-1"), nsIAccessibleText))); + // set user input to false, and see if it works + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [5, 7], + getAccessible(doc.getElementById("paragraph-1"), nsIAccessibleText)), + false); + + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("section-1")))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 1], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 9], + getAccessible(doc.getElementById("s1-link-1"), nsIAccessibleText))); + // set user input to false, and see if it works + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [10, 14], + getAccessible(doc.getElementById("s1-link-1"), nsIAccessibleText), + false)); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [4, 6], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [7, 12], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 2], + getAccessible(doc.getElementById("s1-link-2"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [15, 19], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [20, 28], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 5], + getAccessible(doc.getElementById("section-2"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [6, 10], + getAccessible(doc.getElementById("section-2"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 5], + getAccessible(doc.getElementById("section-2"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [20, 28], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [15, 19], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 2], + getAccessible(doc.getElementById("s1-link-2"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [7, 12], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [4, 6], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [10, 14], + getAccessible(doc.getElementById("s1-link-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 9], + getAccessible(doc.getElementById("s1-link-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 1], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + + gQueue.push(new setVCRangeInvoker(docAcc, getAccessible(doc.getElementById("s1-link-1")), [0, 0])); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", CHAR_BOUNDARY, [1, 2], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", CHAR_BOUNDARY, [0, 1], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", CHAR_BOUNDARY, [1, 2], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", CHAR_BOUNDARY, [0, 1], + getAccessible(doc.getElementById("s1-link-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", CHAR_BOUNDARY, [1, 2], + getAccessible(doc.getElementById("s1-link-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [2, 9], + getAccessible(doc.getElementById("s1-link-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [10, 14], + getAccessible(doc.getElementById("s1-link-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", CHAR_BOUNDARY, [3, 4], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", CHAR_BOUNDARY, [13, 14], + getAccessible(doc.getElementById("s1-link-1"), nsIAccessibleText))); + + gQueue.push(new setVCRangeInvoker(docAcc, getAccessible(doc.getElementById("section-2")), [0, 0])); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", CHAR_BOUNDARY, [27, 28], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", CHAR_BOUNDARY, [0, 1], + getAccessible(doc.getElementById("section-2"), nsIAccessibleText))); + + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("paragraph-2")))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 12], + getAccessible(doc.getElementById("paragraph-2"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 7], + getAccessible(doc.getElementById("cell-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 8], + getAccessible(doc.getElementById("cell-2"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 3], + getAccessible(doc.getElementById("cell-3"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [4, 11], + getAccessible(doc.getElementById("cell-3"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 6], + getAccessible(doc.getElementById("cell-4"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [7, 13], + getAccessible(doc.getElementById("cell-4"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 7], + getAccessible(doc.getElementById("section-3"), nsIAccessibleText))); + + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("section-3")))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 7], + getAccessible(doc.getElementById("section-3"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [7, 13], + getAccessible(doc.getElementById("cell-4"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 6], + getAccessible(doc.getElementById("cell-4"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [4, 11], + getAccessible(doc.getElementById("cell-3"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 3], + getAccessible(doc.getElementById("cell-3"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 8], + getAccessible(doc.getElementById("cell-2"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 7], + getAccessible(doc.getElementById("cell-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 12], + getAccessible(doc.getElementById("paragraph-2"), nsIAccessibleText))); + + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("paragraph-3")))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 7], + getAccessible(doc.getElementById("paragraph-3"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 8], + getAccessible(doc.getElementById("p3-link-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [8, 10], + getAccessible(doc.getElementById("paragraph-3"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 4], + getAccessible(doc.getElementById("p3-link-2"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 5], + getAccessible(doc.getElementById("p3-link-3"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [14, 20], + getAccessible(doc.getElementById("paragraph-3"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 5], + getAccessible(doc.getElementById("p3-link-3"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 4], + getAccessible(doc.getElementById("p3-link-2"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [8, 10], + getAccessible(doc.getElementById("paragraph-3"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 8], + getAccessible(doc.getElementById("p3-link-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 7], + getAccessible(doc.getElementById("paragraph-3"), nsIAccessibleText))); + + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("s1-link-2")))); + // Start with the pivot in the middle of the paragraph + gQueue.push(new setVCPosInvoker(docAcc, "moveNext", ObjectTraversalRule, " will traverse")); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [15, 19], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [0, 2], + getAccessible(doc.getElementById("s1-link-2"), nsIAccessibleText))); + + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("end-block")))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 4], + getAccessible(doc.getElementById("end-block"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, null, false)); + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("start-block")))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 4], + getAccessible(doc.getElementById("start-block"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, null, false)); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, null, false)); + gQueue.push(new setVCRangeInvoker(docAcc, getAccessible(doc.getElementById("start-block")), [0, 0])); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, null, false)); + + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("paragraph-3")).firstChild)); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [0, 7], + getAccessible(doc.getElementById("paragraph-3"), nsIAccessibleText))); + + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("s1-link-1")).nextSibling)); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [4, 6], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("paragraph-4")).firstChild.nextSibling)); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", WORD_BOUNDARY, [6, 10], + getAccessible(doc.getElementById("paragraph-4"), nsIAccessibleText))); + + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("section-1")))); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [20, 28], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("section-1")).lastChild)); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", WORD_BOUNDARY, [20, 28], + getAccessible(doc.getElementById("section-1"), nsIAccessibleText))); + + gQueue.push(new setVCPosInvoker(docAcc, null, null, + getAccessible(doc.getElementById("image-desc-link")))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", CHAR_BOUNDARY, [0, 1], + getAccessible(doc.getElementById("image-desc-link"), nsIAccessibleText))); + gQueue.push(new setVCTextInvoker(docAcc, "moveNextByText", CHAR_BOUNDARY, [1, 2], + getAccessible(doc.getElementById("image-desc-link"), nsIAccessibleText))); + + gQueue.push(new setVCRangeInvoker(docAcc, getAccessible(doc.getElementById("image-end-line")), [3, 3])); + gQueue.push(new setVCTextInvoker(docAcc, "movePreviousByText", LINE_BOUNDARY, [0, 2], + getAccessible(doc.getElementById("image-end-line"), nsIAccessibleText))); + + gQueue.invoke(); + } + + SimpleTest.waitForExplicitFinish(); + addLoadEvent(function() { + /* We open a new browser because we need to test with a top-level content + document. */ + openBrowserWindow( + doTest, + getRootDirectory(window.location.href) + "doc_virtualcursor_text.html"); + }); + </script> +</head> +<body id="body"> + + <a target="_blank" + title="Support Movement By Granularity" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=886076">Mozilla Bug 886076</a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> +</body> +</html> |