diff options
Diffstat (limited to 'accessible/tests/mochitest/actions')
-rw-r--r-- | accessible/tests/mochitest/actions/a11y.ini | 18 | ||||
-rw-r--r-- | accessible/tests/mochitest/actions/test_anchors.html | 150 | ||||
-rw-r--r-- | accessible/tests/mochitest/actions/test_aria.html | 202 | ||||
-rw-r--r-- | accessible/tests/mochitest/actions/test_controls.html | 109 | ||||
-rw-r--r-- | accessible/tests/mochitest/actions/test_general.html | 107 | ||||
-rw-r--r-- | accessible/tests/mochitest/actions/test_general.xul | 145 | ||||
-rw-r--r-- | accessible/tests/mochitest/actions/test_keys.html | 60 | ||||
-rw-r--r-- | accessible/tests/mochitest/actions/test_keys_menu.xul | 99 | ||||
-rw-r--r-- | accessible/tests/mochitest/actions/test_link.html | 147 | ||||
-rw-r--r-- | accessible/tests/mochitest/actions/test_media.html | 121 | ||||
-rw-r--r-- | accessible/tests/mochitest/actions/test_select.html | 105 | ||||
-rw-r--r-- | accessible/tests/mochitest/actions/test_tree.xul | 128 | ||||
-rw-r--r-- | accessible/tests/mochitest/actions/test_treegrid.xul | 197 |
13 files changed, 1588 insertions, 0 deletions
diff --git a/accessible/tests/mochitest/actions/a11y.ini b/accessible/tests/mochitest/actions/a11y.ini new file mode 100644 index 000000000..ca01f4104 --- /dev/null +++ b/accessible/tests/mochitest/actions/a11y.ini @@ -0,0 +1,18 @@ +[DEFAULT] +support-files = + !/accessible/tests/mochitest/*.js + !/dom/media/test/bug461281.ogg + +[test_anchors.html] +[test_aria.html] +[test_controls.html] +[test_general.html] +[test_general.xul] +[test_keys.html] +[test_keys_menu.xul] +[test_link.html] +[test_media.html] +skip-if = buildapp == 'mulet' +[test_select.html] +[test_tree.xul] +[test_treegrid.xul] diff --git a/accessible/tests/mochitest/actions/test_anchors.html b/accessible/tests/mochitest/actions/test_anchors.html new file mode 100644 index 000000000..5e8330683 --- /dev/null +++ b/accessible/tests/mochitest/actions/test_anchors.html @@ -0,0 +1,150 @@ +<html> + +<head> + <title>nsIAccessible actions testing for HTML links that + scroll the page to named anchors</title> + + <link rel="stylesheet" type="text/css" + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../events.js"></script> + <script type="application/javascript" + src="../actions.js"></script> + + <script type="application/javascript"> + //////////////////////////////////////////////////////////////////////////// + // Event checkers + + function scrollingChecker(aAcc) + { + this.type = EVENT_SCROLLING_START; + this.target = aAcc; + this.getID = function scrollingChecker_getID() + { + return "scrolling start handling for " + prettyName(aAcc); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Test + + // gA11yEventDumpID = "debug"; // debug stuff + //gA11yEventDumpToConsole = true; // debug stuff + + function doTest() + { + var actionsArray = [ + { + ID: "anchor1", + actionName: "jump", + actionIndex: 0, + events: CLICK_EVENTS, + eventSeq: [ + new scrollingChecker(getAccessible("bottom1")) + ] + }, + { // jump again (test for bug 437607) + ID: "anchor1", + actionName: "jump", + actionIndex: 0, + events: CLICK_EVENTS, + eventSeq: [ + new scrollingChecker(getAccessible("bottom1")) + ] + }, + { + ID: "anchor2", + actionName: "jump", + actionIndex: 0, + events: CLICK_EVENTS, + eventSeq: [ + new scrollingChecker(getAccessible("bottom2")) + ] + } + ]; + + testActions(actionsArray); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> + +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=506389" + title="Some same page links do not fire EVENT_SYSTEM_SCROLLINGSTART"> + Mozilla Bug 506389 + </a><br> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=437607" + title="Clicking the 'Skip to main content' link once works, second time fails to initiate a V cursor jump"> + Mozilla Bug 437607 + </a><br> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=519303" + title="Same page links to targets with content fires scrolling start accessible event on leaf text node"> + Mozilla Bug 519303 + </a> + + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <div id="debug"></div> + + <h1>This is a test page for anchors</h1> + This is a top anchor<a name="Top"> + </a><a id="anchor1" href="#bottom1">Link to anchor</a> + <a id="anchor2" href="#bottom2">Link to div</a> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br>This is some text in the middle<br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + This is some text. + This is a bottom anchor<a id="bottom1"></a> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <br><br><br><br><br><br><br><br><br><br> + <div id="bottom2">This is a div</div> +</body> +</html> diff --git a/accessible/tests/mochitest/actions/test_aria.html b/accessible/tests/mochitest/actions/test_aria.html new file mode 100644 index 000000000..c4eae812d --- /dev/null +++ b/accessible/tests/mochitest/actions/test_aria.html @@ -0,0 +1,202 @@ +<html> + +<head> + <title>nsIAccessible actions testing</title> + + <link rel="stylesheet" type="text/css" + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../events.js"></script> + <script type="application/javascript" + src="../actions.js"></script> + + <script type="application/javascript"> + function doTest() + { + var actionsArray = [ + { + ID: "clickable", + actionName: "click", + events: CLICK_EVENTS + }, + { + ID: "button", + actionName: "press", + events: CLICK_EVENTS + }, + { + ID: "checkbox_unchecked", + actionName: "check", + events: CLICK_EVENTS + }, + { + ID: "checkbox_checked", + actionName: "uncheck", + events: CLICK_EVENTS + }, + { + ID: "checkbox_mixed", + actionName: "cycle", + events: CLICK_EVENTS + }, + { + ID: "combobox_collapsed", + actionName: "open", + events: CLICK_EVENTS + }, + { + ID: "combobox_expanded", + actionName: "close", + events: CLICK_EVENTS + }, + { + ID: "link", + actionName: "jump", + events: CLICK_EVENTS + }, + { + ID: "menuitem", + actionName: "click", + events: CLICK_EVENTS + }, + { + ID: "menuitemcheckbox", + actionName: "click", + events: CLICK_EVENTS + }, + { + ID: "menuitemradio", + actionName: "click", + events: CLICK_EVENTS + }, + { + ID: "option", + actionName: "select", + events: CLICK_EVENTS + }, + { + ID: "radio", + actionName: "select", + events: CLICK_EVENTS + }, + { + ID: "switch_unchecked", + actionName: "check", + events: CLICK_EVENTS + }, + { + ID: "switch_checked", + actionName: "uncheck", + events: CLICK_EVENTS + }, + { + ID: "tab", + actionName: "switch", + events: CLICK_EVENTS + }, + { + ID: "textbox", + actionName: "activate", + events: CLICK_EVENTS + }, + { + ID: "treeitem", + actionName: "activate", + events: CLICK_EVENTS + }, + { + ID: "sortable", + actionName: "sort", + events: CLICK_EVENTS + }, + { + ID: "expandable", + actionName: "expand", + events: CLICK_EVENTS + }, + { + ID: "collapseable", + actionName: "collapse", + events: CLICK_EVENTS + } + ]; + testActions(actionsArray); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> + +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=410765" + title="nsIAccessible actions testing"> + Mozilla Bug 410765 + </a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <div id="clickable" onclick="">Clickable text</div> + + <div id="button" role="button">Button</div> + + <div id="checkbox_unchecked" role="checkbox">Checkbox</div> + + <div id="checkbox_checked" role="checkbox" aria-checked="true">Checkbox</div> + + <div id="checkbox_mixed" role="checkbox" aria-checked="mixed">Checkbox</div> + + <div id="combobox_collapsed" role="combobox"> + <div id="option" role="option">Option of collapsed combobox</div> + </div> + + <div id="combobox_expanded" role="combobox" aria-expanded="true"> + <div role="option">Option of expanded combobox</div> + </div> + + <div id="link" role="link">Link</div> + + <div role="menu"> + <div id="menuitem" role="menuitem">Menuitem</div> + <div id="menuitemcheckbox" role="menuitemcheckbox">Menuitem checkbox</div> + <div id="menuitemradio" role="menuitemradio">Menuitem radio</div> + </div> + + <div role="radiogroup"> + <div id="radio" role="radio">Radio</div> + </div> + + <div id="switch_unchecked" role="switch">Switch</div> + + <div id="switch_checked" role="switch" aria-checked="true">Switch</div> + + <div role="tablist"> + <div id="tab" role="tab">Tab</div> + </div> + + <div id="textbox" role="textbox">Textbox</div> + + <div role="tree"> + <div id="treeitem" role="treeitem">Treeitem</div> + </div> + + <div role="grid"> + <div id="sortable" role="columnheader" aria-sort="ascending"> + Columnheader + </div> + </div> + + <div id="expandable" aria-expanded="false">collapsed</div> + <div id="collapseable" aria-expanded="true">expanded</div> +</body> +</html> diff --git a/accessible/tests/mochitest/actions/test_controls.html b/accessible/tests/mochitest/actions/test_controls.html new file mode 100644 index 000000000..d6109a82f --- /dev/null +++ b/accessible/tests/mochitest/actions/test_controls.html @@ -0,0 +1,109 @@ +<html> + +<head> + <title>nsIAccessible actions testing for inputs</title> + + <link rel="stylesheet" type="text/css" + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../role.js"></script> + <script type="application/javascript" + src="../states.js"></script> + <script type="application/javascript" + src="../events.js"></script> + <script type="application/javascript" + src="../actions.js"></script> + + <script type="application/javascript"> + function doTest() + { + var actionsArray = [ + { + ID: "button", + actionName: "press", + events: CLICK_EVENTS + }, + { + ID: "input_button", + actionName: "press", + events: CLICK_EVENTS + }, + { + ID: "checkbox_unchecked", + actionName: "check", + events: CLICK_EVENTS + }, + { + ID: "checkbox_checked", + actionName: "uncheck", + events: CLICK_EVENTS + }, + { + ID: "checkbox_mixed", + actionName: "cycle", + events: CLICK_EVENTS + }, + { + ID: "radio", + actionName: "select", + events: CLICK_EVENTS + }, + { + ID: "textarea", + actionName: "activate", + events: FOCUS_EVENT + }, + { + ID: "textinput", + actionName: "activate", + events: FOCUS_EVENT + } + + ]; + document.getElementById("checkbox_mixed").indeterminate = true; + + testActions(actionsArray); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> + +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=477975" + title="nsIAccessible actions testing"> + Mozilla Bug 477975 + </a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <button id="button">Button</button> + + <input id="input_button" type="button" value="normal"> + + <input id="checkbox_unchecked" type="checkbox">Checkbox</input> + + <input id="checkbox_checked" type="checkbox" checked="true">Checkbox</input> + + <input id="checkbox_mixed" type="checkbox">Checkbox</input> + + <fieldset> + <input id="radio" type="radio">Radio</input> + </fieldset> + + <textarea id="textarea" placeholder="What's happening?"></textarea> + + <input id="textinput" type="text"> +</body> +</html> diff --git a/accessible/tests/mochitest/actions/test_general.html b/accessible/tests/mochitest/actions/test_general.html new file mode 100644 index 000000000..5b9a18dab --- /dev/null +++ b/accessible/tests/mochitest/actions/test_general.html @@ -0,0 +1,107 @@ +<html> + +<head> + <title>nsIAccessible actions testing on HTML elements</title> + + <link rel="stylesheet" type="text/css" + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../events.js"></script> + <script type="application/javascript" + src="../actions.js"></script> + + <script type="application/javascript"> + function doTest() + { + var actionsArray = [ + { + ID: "li_clickable1", + actionName: "click", + events: CLICK_EVENTS + }, + { + ID: "li_clickable2", + actionName: "click", + events: CLICK_EVENTS + }, + { + ID: "li_clickable3", + actionName: "click", + events: CLICK_EVENTS + }, + { + ID: "onclick_img", + actionName: "click", + events: CLICK_EVENTS + }, + { + ID: "label1", + actionName: "click", + events: CLICK_EVENTS + } + + ]; + + testActions(actionsArray); + + is(getAccessible("label1").firstChild.actionCount, 1, "label text should have 1 action"); + + getAccessible("onclick_img").takeFocus(); + is(getAccessible("link1").actionCount, 1, "links should have one action"); + is(getAccessible("link2").actionCount, 1, "link with onclick handler should have 1 action"); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> + +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=523789" + title="nsHTMLLiAccessible shouldn't be inherited from linkable accessible"> + Mozilla Bug 523789 + </a><br> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=423409" + title="Expose click action if mouseup and mousedown are registered"> + Mozilla Bug 423409 + </a> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=659620" + title="hang when trying to edit a page on wikimo with NVDA running"> + Mozilla Bug 659620 + </a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <ul> + <li id="li_clickable1" onclick="">Clickable list item</li> + <li id="li_clickable2" onmousedown="">Clickable list item</li> + <li id="li_clickable3" onmouseup="">Clickable list item</li> + </ul> + + <!-- linkable accessibles --> + <img id="onclick_img" onclick="" src="../moz.png"> + + <a id="link1" href="www">linkable textleaf accessible</a> + <div id="link2" onclick="">linkable textleaf accessible</div> + + <div> + <label for="TextBox_t2" id="label1"> + <span>Explicit</span> + </label> + <input name="in2" id="TextBox_t2" type="text" maxlength="17"> + </div> + +</body> +</html> diff --git a/accessible/tests/mochitest/actions/test_general.xul b/accessible/tests/mochitest/actions/test_general.xul new file mode 100644 index 000000000..14d8bb0d0 --- /dev/null +++ b/accessible/tests/mochitest/actions/test_general.xul @@ -0,0 +1,145 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" + type="text/css"?> +<?xml-stylesheet href="../nsIAccessible_name.css" + type="text/css"?> + + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="nsIAccessible actions testing"> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> + + <script type="application/javascript" + src="../common.js" /> + <script type="application/javascript" + src="../events.js" /> + <script type="application/javascript" + src="../actions.js" /> + + <script type="application/javascript"> + <![CDATA[ + //gA11yEventDumpToConsole = true; + //enableLogging("tree,verbose"); // debug + + if (navigator.platform.startsWith("Mac")) { + SimpleTest.expectAssertions(0, 1); + } else { + SimpleTest.expectAssertions(0, 1); + } + + function doTest() + { + var actionsArray = [ + { + ID: "menu", + actionName: "click", + events: CLICK_EVENTS, + // Wait for focus event, it guarantees us the submenu tree is created, + // that's necessary for next test. + eventSeq: [ + new invokerChecker(EVENT_FOCUS, getNode("menu")) + ] + }, + { + ID: "submenu", + actionName: "click", + events: CLICK_EVENTS + }, + { + ID: "menuitem", + actionName: "click", + events: XUL_EVENTS + }, + { + ID: "button", + actionName: "press", + events: XUL_EVENTS + }, + { + ID: "buttonmenu", + actionName: "press", + events: CLICK_EVENTS + }, + { + ID: "name_entry_label", + actionName: "click", + events: CLICK_EVENTS + }, + { + ID: "labelWithPopup", + actionName: "click", + events: CLICK_EVENTS + }/*, // XXX: bug 490288 + { + ID: "buttonmenu_item", + actionName: "click", + events: CLICK_EVENTS + }*/ + ]; + + is(getAccessible("name_entry_label").firstChild.actionCount, 1, "label text should have 1 action"); + + testActions(actionsArray); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + ]]> + </script> + + <hbox flex="1" style="overflow: auto;"> + <body xmlns="http://www.w3.org/1999/xhtml"> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=410765" + title="nsIAccessible actions testing"> + Mozilla Bug 410765 + </a> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=504252" + title="Expose STATE_HASPOPUP on XUL elements that have an @popup attribute"> + Mozilla Bug 504252 + </a><br/> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + </body> + + <vbox flex="1"> + <menubar> + <menu label="menu" id="menu"> + <menupopup> + <menuitem label="menu item" id="menuitem"/> + <menu label="submenu" id="submenu"> + <menupopup> + <menuitem label="menu item"/> + </menupopup> + </menu> + </menupopup> + </menu> + </menubar> + + <button label="button" id="button"/> + + <button type="menu" id="buttonmenu" label="button"> + <menupopup> + <menuitem label="item1" id="buttonmenu_item"/> + <menuitem label="item1"/> + </menupopup> + </button> + + <label id="labelWithPopup" value="file name" + popup="fileContext" + tabindex="0"/> + <hbox> + <label id="name_entry_label" value="Name" control="name_entry"/> + <textbox id="name_entry"/> + </hbox> + </vbox> + </hbox> +</window> + diff --git a/accessible/tests/mochitest/actions/test_keys.html b/accessible/tests/mochitest/actions/test_keys.html new file mode 100644 index 000000000..2feebcadb --- /dev/null +++ b/accessible/tests/mochitest/actions/test_keys.html @@ -0,0 +1,60 @@ +<html> + +<head> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> + <title>Keyboard shortcuts tests</title> + <link rel="stylesheet" type="text/css" + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + + <script type="application/javascript"> + function testAcessKey(aAccOrElmOrID, aKey) + { + var acc = getAccessible(aAccOrElmOrID); + if (!acc) + return; + + is(acc.accessKey, aKey, + "Wrong keyboard shortcut on " + prettyName(aAccOrElmOrID)); + } + + function doTest() + { + testAcessKey("input1", ""); + testAcessKey("input2", MAC ? "⌃⌥b" : "Alt+Shift+b"); + testAcessKey("link", MAC ? "⌃⌥l" : "Alt+Shift+l"); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> + +</head> + +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=381599" + title="Inverse relations cache"> + Mozilla Bug 381599 + </a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <label accesskey="a"> + <input id="input1"/> + </label> + <label accesskey="b" for="input2"> + <input id="input2"/> + <a id="link" accesskey="l">link</a> +</body> +</html> diff --git a/accessible/tests/mochitest/actions/test_keys_menu.xul b/accessible/tests/mochitest/actions/test_keys_menu.xul new file mode 100644 index 000000000..b63b6fab1 --- /dev/null +++ b/accessible/tests/mochitest/actions/test_keys_menu.xul @@ -0,0 +1,99 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" + type="text/css"?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="Accessible XUL access keys and shortcut keys tests"> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> + + <script type="application/javascript" + src="../common.js" /> + <script type="application/javascript" + src="../events.js" /> + + <script type="application/javascript"> + <![CDATA[ + function openMenu(aMenuID, aMenuitemID) + { + this.menuNode = getNode(aMenuID), + this.menuitemNode = getNode(aMenuitemID), + + this.eventSeq = [ + new invokerChecker(EVENT_FOCUS, this.menuNode) + ]; + + this.invoke = function openMenu_invoke() + { + // Show menu. + this.menuNode.open = true; + } + + this.finalCheck = function openMenu_finalCheck() + { + var menu = getAccessible(aMenuID); + is(menu.accessKey, (MAC ? "u" : "Alt+u"), + "Wrong accesskey on " + prettyName(this.menuitemNode)); + + var menuitem = getAccessible(aMenuitemID); + is(menuitem.accessKey, "p", + "Wrong accesskey on " + prettyName(this.menuitemNode)); + is(menuitem.keyboardShortcut, (MAC ? "⌃l" : "Ctrl+l"), + "Wrong keyboard shortcut on " + prettyName(this.menuitemNode)); + } + + this.getID = function openMenu_getID() + { + return "menuitem accesskey and shortcut test " + + prettyName(this.menuItemNode); + } + } + + var gQueue = null; + function doTest() + { + gQueue = new eventQueue(); + gQueue.push(new openMenu("menu", "menuitem")); + gQueue.invoke(); // Will call SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + ]]> + </script> + + <hbox flex="1" style="overflow: auto;"> + <body xmlns="http://www.w3.org/1999/xhtml"> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=672092" + title="Reorganize access key and keyboard shortcut handling code"> + Mozilla Bug 672092 + </a><br/> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + </body> + + <vbox flex="1"> + <keyset> + <key key="l" modifiers="control" id="key1"/> + </keyset> + + <menubar> + <menu label="menu" id="menu" accesskey="u"> + <menupopup> + <menuitem accesskey="p" key="key1" label="item1" id="menuitem"/> + </menupopup> + </menu> + </menubar> + + <vbox id="debug"/> + </vbox> + </hbox> + +</window> + diff --git a/accessible/tests/mochitest/actions/test_link.html b/accessible/tests/mochitest/actions/test_link.html new file mode 100644 index 000000000..dc96951d1 --- /dev/null +++ b/accessible/tests/mochitest/actions/test_link.html @@ -0,0 +1,147 @@ +<html> + +<head> + <title>nsIAccessible actions testing on HTML links (HTML:a)</title> + + <link rel="stylesheet" type="text/css" + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../events.js"></script> + <script type="application/javascript" + src="../actions.js"></script> + + <script type="application/javascript"> + function getAnchorTargetDocumentAcc() + { + var thisTabDocAcc = getTabDocAccessible(); + var thisDocTabPanelAcc = thisTabDocAcc.parent.parent; + var tabPanelsAcc = thisDocTabPanelAcc.parent; + var newDocTabPanelAcc = tabPanelsAcc.firstChild; + var nextAcc = newDocTabPanelAcc; + + while (nextAcc = nextAcc.nextSibling) { + // Find the last accessible for a browser with about:mozilla loaded. + if (nextAcc.firstChild.DOMNode.currentURI.spec == "about:mozilla") { + newDocTabPanelAcc = nextAcc; + } + } + + return newDocTabPanelAcc.firstChild.firstChild; + } + + function linkChecker(aID) + { + this.type = EVENT_DOCUMENT_LOAD_COMPLETE; + this.__defineGetter__("target", getAnchorTargetDocumentAcc); + + this.check = function linkChecker_check() + { + var anchorTargetWindow = + getAccessible(getAnchorTargetDocumentAcc(), [nsIAccessibleDocument]). + window; + anchorTargetWindow.close(); + } + + this.getID = function linkChecker_getID() + { + return "link '" + aID + "' states check "; + } + } + + //gA11yEventDumpToConsole = true; + //enableLogging("tree,eventTree,verbose"); + + function doTest() + { + var actionsArray = [ + { + ID: "link1", + actionName: "jump", + events: CLICK_EVENTS, + eventSeq: [ + new linkChecker("link1") + ] + }, + { + ID: "img1", + targetID: "link1", + actionName: "jump", + events: CLICK_EVENTS, + eventSeq: [ + new linkChecker("link1") + ] + }, + { + ID: "link2", + actionName: "click", + events: CLICK_EVENTS + }, + { + ID: "img2", + targetID: "link2", + actionName: "jump", + events: CLICK_EVENTS + }, + { + ID: "link3", + actionName: "click", + events: CLICK_EVENTS + }, + { + ID: "img3", + targetID: "link3", + actionName: "jump", + events: CLICK_EVENTS + }, + { + ID: "link4", + actionName: "click", + events: CLICK_EVENTS + }, + { + ID: "img4", + targetID: "link4", + actionName: "jump", + events: CLICK_EVENTS + } + ]; + testActions(actionsArray); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> + +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=423409" + title="Expose click action if mouseup and mousedown are registered"> + Mozilla Bug 423409 + </a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <a href="about:mozilla" id="link1" target="_blank"> + <img src="../moz.png" id="img1"> + </a> + <a id="link2" onmousedown=""> + <img src="../moz.png" id="img2"> + </a> + <a id="link3" onclick=""> + <img src="../moz.png" id="img3"> + </a> + <a id="link4" onmouseup=""> + <img src="../moz.png" id="img4"> + </a> +</body> +</html> diff --git a/accessible/tests/mochitest/actions/test_media.html b/accessible/tests/mochitest/actions/test_media.html new file mode 100644 index 000000000..beb014ebc --- /dev/null +++ b/accessible/tests/mochitest/actions/test_media.html @@ -0,0 +1,121 @@ +<!DOCTYPE html> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=483573 +--> +<head> + <title>HTML5 audio/video tests</title> + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../events.js"></script> + <script type="application/javascript" + src="../actions.js"></script> + <script type="application/javascript" + src="../role.js"></script> + <script type="application/javascript" + src="../states.js"></script> + + <script type="application/javascript"> + + // gA11yEventDumpID = "eventDump"; + //gA11yEventDumpToConsole = true; // debug stuff + + function focusChecker(aAcc) + { + this.type = EVENT_FOCUS; + this.target = aAcc; + this.getID = function focusChecker_getID() + { + return "focus handling"; + } + this.check = function focusChecker_check(aEvent) + { + testStates(this.target, STATE_FOCUSED); + } + } + + function nameChecker(aAcc, aName) + { + this.type = EVENT_NAME_CHANGE; + this.target = aAcc; + this.getID = function nameChecker_getID() + { + return "name change handling"; + }, + this.check = function nameChecker_check(aEvent) + { + is(aEvent.accessible.name, aName, + "Wrong name of " + prettyName(aEvent.accessible) + " on focus"); + } + } + + function doTest() + { + ////////////////////////////////////////////////////////////////////////// + // test actions of audio controls + + todo(false, "Focus test are disabled until bug 494175 is fixed."); + + var audioElm = getAccessible("audio"); + var playBtn = audioElm.firstChild; + var scrubber = playBtn.nextSibling.nextSibling.nextSibling; + var muteBtn = audioElm.lastChild.previousSibling; + + var actions = [ + { + ID: muteBtn, + actionName: "press", + events: CLICK_EVENTS, + eventSeq: [ + // new focusChecker(muteBtn), + new nameChecker(muteBtn, "Unmute"), + ] + }, + // { + // ID: scrubber, + // actionName: "activate", + // events: null, + // eventSeq: [ + // new focusChecker(scrubber) + // ] + // }, + { + ID: playBtn, + actionName: "press", + events: CLICK_EVENTS, + eventSeq: [ + // new focusChecker(playBtn), + new nameChecker(playBtn, "Pause"), + ] + } + ]; + + testActions(actions); // Will call SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> +<body> + + <a target="_blank" + title="Expose HTML5 video and audio elements' embedded controls through accessibility APIs" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=483573">Mozilla Bug 483573</a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <audio id="audio" src="../bug461281.ogg" + controls="true"></audio> + + <div id="eventDump"></div> +</body> +</html> diff --git a/accessible/tests/mochitest/actions/test_select.html b/accessible/tests/mochitest/actions/test_select.html new file mode 100644 index 000000000..1a6c89619 --- /dev/null +++ b/accessible/tests/mochitest/actions/test_select.html @@ -0,0 +1,105 @@ +<html> + +<head> + <title>nsIAccessible actions testing for HTML select</title> + + <link rel="stylesheet" type="text/css" + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../role.js"></script> + <script type="application/javascript" + src="../states.js"></script> + <script type="application/javascript" + src="../events.js"></script> + <script type="application/javascript" + src="../actions.js"></script> + + <script type="application/javascript"> + //gA11yEventDumpToConsole = true; // debugging + function doTest() + { + var actionsArray = [ + { + ID: "lb_apple", + actionIndex: 0, + actionName: "select", + events: CLICK_EVENTS, + eventSeq: [ + new focusChecker("lb_apple") + ] + }, + { + ID: "combobox", + actionIndex: 0, + actionName: "open", + events: CLICK_EVENTS, + eventSeq: [ + new focusChecker("cb_orange") + ] + }, + { + ID: "cb_apple", + actionIndex: 0, + actionName: "select", + events: CLICK_EVENTS, + eventSeq: [ + new focusChecker("combobox") + ] + }, + { + ID: "combobox", + actionIndex: 0, + actionName: "open", + events: CLICK_EVENTS, + eventSeq: [ + new focusChecker("cb_apple") + ] + }, + { + ID: "combobox", + actionIndex: 0, + actionName: "close", + events: CLICK_EVENTS, + eventSeq: [ + new focusChecker("combobox") + ] + } + ]; + + testActions(actionsArray); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> + +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958" + title="Rework accessible focus handling"> + Mozilla Bug 673958 + </a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <select id="listbox" size="2"> + <option id="lb_orange">orange</option> + <option id="lb_apple">apple</option> + </select> + + <select id="combobox"> + <option id="cb_orange">orange</option> + <option id="cb_apple">apple</option> + </select> +</body> +</html> diff --git a/accessible/tests/mochitest/actions/test_tree.xul b/accessible/tests/mochitest/actions/test_tree.xul new file mode 100644 index 000000000..3958ed2fb --- /dev/null +++ b/accessible/tests/mochitest/actions/test_tree.xul @@ -0,0 +1,128 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" + type="text/css"?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="Accessible XUL tree actions tests"> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> + + <script type="application/javascript" + src="../treeview.js" /> + + <script type="application/javascript" + src="../common.js" /> + <script type="application/javascript" + src="../role.js" /> + <script type="application/javascript" + src="../states.js" /> + <script type="application/javascript" + src="../events.js" /> + <script type="application/javascript" + src="../actions.js" /> + + <script type="application/javascript"> + <![CDATA[ + //////////////////////////////////////////////////////////////////////////// + // Accessible tree testers + + function stateFocusChecker(aAcc, aStates) + { + this.__proto__ = new focusChecker(aAcc); + + this.check = function focusChecker_check(aEvent) + { + var states = aStates ? aStates : 0; + testStates(this.target, STATE_FOCUSED | STATE_SELECTED | states); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Test + + // gA11yEventDumpID = "debug"; + //gA11yEventDumpToConsole = true; // debug + + function doTest() + { + var treeNode = getNode("tree"); + + var treeBodyNode = treeNode.boxObject.treeBody; + + var tree = getAccessible(treeNode); + var expandedTreeItem = tree.getChildAt(2); + var collapsedTreeItem = tree.getChildAt(5); + + var actions = [ + { + ID: expandedTreeItem, + actionName: "activate", + actionIndex: 0, + events: CLICK_EVENTS, + targetID: treeBodyNode, + eventSeq: [ + new stateFocusChecker(expandedTreeItem, STATE_EXPANDED) + ] + }, + { + ID: collapsedTreeItem, + actionName: "expand", + actionIndex: 1, + events: CLICK_EVENTS, + targetID: treeBodyNode, + checkOnClickEvent: function check(aEvent) + { + testStates(this.ID, STATE_EXPANDED); + } + }, + { + ID: collapsedTreeItem, + actionName: "collapse", + actionIndex: 1, + events: CLICK_EVENTS, + targetID: treeBodyNode, + checkOnClickEvent: function check(aEvent) + { + testStates(this.ID, STATE_COLLAPSED); + } + } + ]; + + testActions(actions); // Will call SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yXULTreeLoadEvent(doTest, "tree", new nsTreeTreeView()); + ]]> + </script> + + <hbox flex="1" style="overflow: auto;"> + <body xmlns="http://www.w3.org/1999/xhtml"> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727" + title="Reorganize implementation of XUL tree accessibility"> + Mozilla Bug 503727 + </a><br/> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + </body> + + <vbox flex="1"> + <tree id="tree" flex="1" minheight="100px"> + <treecols> + <treecol id="col" flex="1" primary="true" label="column"/> + </treecols> + <treechildren/> + </tree> + + <vbox id="debug"/> + </vbox> + </hbox> + +</window> + diff --git a/accessible/tests/mochitest/actions/test_treegrid.xul b/accessible/tests/mochitest/actions/test_treegrid.xul new file mode 100644 index 000000000..0bfb3d662 --- /dev/null +++ b/accessible/tests/mochitest/actions/test_treegrid.xul @@ -0,0 +1,197 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" + type="text/css"?> +<?xml-stylesheet href="../treeview.css" + type="text/css"?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="Accessible XUL tree actions tests"> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> + + <script type="application/javascript" + src="../treeview.js" /> + + <script type="application/javascript" + src="../common.js" /> + <script type="application/javascript" + src="../role.js" /> + <script type="application/javascript" + src="../states.js" /> + <script type="application/javascript" + src="../events.js" /> + <script type="application/javascript" + src="../actions.js" /> + + <script type="application/javascript"> + <![CDATA[ + //////////////////////////////////////////////////////////////////////////// + // Accessible tree testers + + function focusChecker(aAcc, aStates) + { + this.type = EVENT_FOCUS; + this.target = aAcc; + this.getID = function focusChecker_getID() + { + return "focus handling"; + } + this.check = function focusChecker_check(aEvent) + { + var states = aStates ? aStates : 0; + testStates(this.target, STATE_FOCUSED | STATE_SELECTED | states); + } + } + + function stateChangeChecker(aAcc, aIsEnabled) + { + this.type = EVENT_STATE_CHANGE; + this.target = aAcc; + this.getID = function stateChangeChecker_getID() + { + return "state change handling"; + } + this.check = function stateChangeChecker_check(aEvent) + { + if (aIsEnabled) + testStates(this.target, STATE_CHECKED); + else + testStates(this.target, STATE_CHECKABLE, 0, STATE_CHECKED); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Test + + function doTestActions() + { + var treeNode = getNode("tabletree"); + + var treeBodyNode = treeNode.boxObject.treeBody; + treeNode.focus(); + + var tree = getAccessible(treeNode); + + var expandedTreeItem = tree.getChildAt(2); + var collapsedTreeItem = tree.getChildAt(5); + var cycleCell = expandedTreeItem.getChildAt(0); + var checkableCell = expandedTreeItem.getChildAt(3); + + var actions = [ + { + ID: expandedTreeItem, + actionName: "activate", + actionIndex: 0, + events: CLICK_EVENTS, + targetID: treeBodyNode, + eventSeq: [ + new focusChecker(expandedTreeItem, STATE_EXPANDED) + ] + }, + { + ID: collapsedTreeItem, + actionName: "expand", + actionIndex: 1, + events: CLICK_EVENTS, + targetID: treeBodyNode, + check: function check(aEvent) + { + testStates(this.ID, STATE_EXPANDED); + } + }, + { + ID: collapsedTreeItem, + actionName: "collapse", + actionIndex: 1, + events: CLICK_EVENTS, + targetID: treeBodyNode, + check: function check(aEvent) + { + testStates(this.ID, STATE_COLLAPSED); + } + }, + { + ID: cycleCell, + actionName: "cycle", + actionIndex: 0, + events: CLICK_EVENTS, + targetID: treeBodyNode + }, + { + ID: checkableCell, + actionName: "uncheck", + actionIndex: 0, + events: CLICK_EVENTS, + targetID: treeBodyNode, + eventSeq: [ + new stateChangeChecker(checkableCell, false) + ] + }, + { + ID: checkableCell, + actionName: "check", + actionIndex: 0, + events: CLICK_EVENTS, + targetID: treeBodyNode, + eventSeq: [ + new stateChangeChecker(checkableCell, true) + ] + } + ]; + + testActions(actions); // Will call SimpleTest.finish(); + } + + // gA11yEventDumpID = "debug"; + + function doTest() + { + var treeNode = getNode("tabletree"); + waitForEvent(EVENT_REORDER, treeNode, doTestActions); + treeNode.view = new nsTreeTreeView(); + } + + function test1() + { + getNode("tabletree").view.setCellValue(0, boxObj.columns.firstColumn, "false"); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + ]]> + </script> + + <hbox flex="1" style="overflow: auto;"> + <body xmlns="http://www.w3.org/1999/xhtml"> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727" + title="Reorganize implementation of XUL tree accessibility"> + Mozilla Bug 503727 + </a><br/> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + </body> + + <vbox flex="1"> + <tree id="tabletree" flex="1" editable="true"> + <treecols> + <treecol id="tabletree_col1" cycler="true" label="cycler"/> + <treecol id="tabletree_col2" flex="1" primary="true" label="column1"/> + <treecol id="tabletree_col3" flex="1" label="column2"/> + <treecol id="tabletree_col4" flex="1" label="checker" + type="checkbox" editable="true"/> + </treecols> + <treechildren/> + </tree> + + <vbox id="debug"/> + <button oncommand="test1();" label="uncheck"/> + </vbox> + </hbox> + +</window> |