Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 3 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
michael@0 | 4 | type="text/css"?> |
michael@0 | 5 | <?xml-stylesheet href="../treeview.css" |
michael@0 | 6 | type="text/css"?> |
michael@0 | 7 | |
michael@0 | 8 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 9 | title="Accessible XUL tree states tests"> |
michael@0 | 10 | |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
michael@0 | 13 | |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../treeview.js" /> |
michael@0 | 16 | |
michael@0 | 17 | <script type="application/javascript" |
michael@0 | 18 | src="../common.js" /> |
michael@0 | 19 | <script type="application/javascript" |
michael@0 | 20 | src="../role.js" /> |
michael@0 | 21 | <script type="application/javascript" |
michael@0 | 22 | src="../states.js" /> |
michael@0 | 23 | <script type="application/javascript" |
michael@0 | 24 | src="../events.js" /> |
michael@0 | 25 | |
michael@0 | 26 | <script type="application/javascript"> |
michael@0 | 27 | <![CDATA[ |
michael@0 | 28 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 29 | // Test |
michael@0 | 30 | |
michael@0 | 31 | /** |
michael@0 | 32 | * Event queue invoker object to test accessible states for XUL tree |
michael@0 | 33 | * accessible. |
michael@0 | 34 | */ |
michael@0 | 35 | function statesChecker(aTreeID, aView) |
michael@0 | 36 | { |
michael@0 | 37 | this.DOMNode = getNode(aTreeID); |
michael@0 | 38 | |
michael@0 | 39 | this.invoke = function statesChecker_invoke() |
michael@0 | 40 | { |
michael@0 | 41 | this.DOMNode.treeBoxObject.view = aView; |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | this.check = function statesChecker_check() |
michael@0 | 45 | { |
michael@0 | 46 | var tree = getAccessible(this.DOMNode); |
michael@0 | 47 | |
michael@0 | 48 | // tree states |
michael@0 | 49 | testStates(tree, STATE_READONLY); |
michael@0 | 50 | |
michael@0 | 51 | if (this.DOMNode.getAttribute("seltype") != "single") |
michael@0 | 52 | testStates(tree, STATE_MULTISELECTABLE); |
michael@0 | 53 | else |
michael@0 | 54 | testStates(tree, 0, 0, STATE_MULTISELECTABLE); |
michael@0 | 55 | |
michael@0 | 56 | // tree item states |
michael@0 | 57 | var expandedItem = tree.getChildAt(2); |
michael@0 | 58 | testStates(expandedItem, |
michael@0 | 59 | STATE_SELECTABLE | STATE_FOCUSABLE | STATE_EXPANDED); |
michael@0 | 60 | |
michael@0 | 61 | var collapsedItem = tree.getChildAt(5); |
michael@0 | 62 | testStates(collapsedItem, |
michael@0 | 63 | STATE_SELECTABLE | STATE_FOCUSABLE | STATE_COLLAPSED); |
michael@0 | 64 | |
michael@0 | 65 | // cells states if any |
michael@0 | 66 | var cells = collapsedItem.children; |
michael@0 | 67 | if (cells && cells.length) { |
michael@0 | 68 | for (var idx = 0; idx < cells.length; idx++) { |
michael@0 | 69 | var cell = cells.queryElementAt(idx, nsIAccessible); |
michael@0 | 70 | testStates(cell, STATE_SELECTABLE); |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | var checkboxCell = cells.queryElementAt(3, nsIAccessible); |
michael@0 | 74 | testStates(checkboxCell, STATE_CHECKABLE | STATE_CHECKED); |
michael@0 | 75 | } |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | this.getID = function statesChecker_getID() |
michael@0 | 79 | { |
michael@0 | 80 | return "tree processor for " + prettyName(aTreeID); |
michael@0 | 81 | } |
michael@0 | 82 | } |
michael@0 | 83 | |
michael@0 | 84 | gA11yEventDumpToConsole = true; // debug stuff |
michael@0 | 85 | |
michael@0 | 86 | var gQueue = null; |
michael@0 | 87 | |
michael@0 | 88 | function doTest() |
michael@0 | 89 | { |
michael@0 | 90 | gQueue = new eventQueue(EVENT_REORDER); |
michael@0 | 91 | gQueue.push(new statesChecker("tree", new nsTreeTreeView())); |
michael@0 | 92 | gQueue.push(new statesChecker("treesingle", new nsTreeTreeView())); |
michael@0 | 93 | gQueue.push(new statesChecker("tabletree", new nsTreeTreeView())); |
michael@0 | 94 | |
michael@0 | 95 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 96 | } |
michael@0 | 97 | |
michael@0 | 98 | if (MAC && (navigator.userAgent.indexOf("Mac OS X 10.6") != -1)) { |
michael@0 | 99 | todo(false, |
michael@0 | 100 | "Re-enable on Mac OS 10.6 after fixing bug 845095 - intermittent orange"); |
michael@0 | 101 | } else { |
michael@0 | 102 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 103 | addA11yLoadEvent(doTest); |
michael@0 | 104 | } |
michael@0 | 105 | ]]> |
michael@0 | 106 | </script> |
michael@0 | 107 | |
michael@0 | 108 | <hbox flex="1" style="overflow: auto;"> |
michael@0 | 109 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 110 | <a target="_blank" |
michael@0 | 111 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727" |
michael@0 | 112 | title="Reorganize implementation of XUL tree accessibility"> |
michael@0 | 113 | Mozilla Bug 503727 |
michael@0 | 114 | </a><br/> |
michael@0 | 115 | <p id="display"></p> |
michael@0 | 116 | <div id="content" style="display: none"> |
michael@0 | 117 | </div> |
michael@0 | 118 | <pre id="test"> |
michael@0 | 119 | </pre> |
michael@0 | 120 | </body> |
michael@0 | 121 | |
michael@0 | 122 | <vbox flex="1"> |
michael@0 | 123 | <tree id="tree" flex="1"> |
michael@0 | 124 | <treecols> |
michael@0 | 125 | <treecol id="col" flex="1" primary="true" label="column"/> |
michael@0 | 126 | </treecols> |
michael@0 | 127 | <treechildren/> |
michael@0 | 128 | </tree> |
michael@0 | 129 | |
michael@0 | 130 | <tree id="treesingle" flex="1" seltype="single"> |
michael@0 | 131 | <treecols> |
michael@0 | 132 | <treecol id="col_single" flex="1" primary="true" label="column"/> |
michael@0 | 133 | </treecols> |
michael@0 | 134 | <treechildren/> |
michael@0 | 135 | </tree> |
michael@0 | 136 | |
michael@0 | 137 | <tree id="tabletree" flex="1" editable="true"> |
michael@0 | 138 | <treecols> |
michael@0 | 139 | <treecol id="tabletree_col1" cycler="true" label="cycler"/> |
michael@0 | 140 | <treecol id="tabletree_col2" flex="1" primary="true" label="column1"/> |
michael@0 | 141 | <treecol id="tabletree_col3" flex="1" label="column2"/> |
michael@0 | 142 | <treecol id="tabletree_col4" flex="1" label="checker" |
michael@0 | 143 | type="checkbox" editable="true"/> |
michael@0 | 144 | </treecols> |
michael@0 | 145 | <treechildren/> |
michael@0 | 146 | </tree> |
michael@0 | 147 | |
michael@0 | 148 | <vbox id="debug"/> |
michael@0 | 149 | </vbox> |
michael@0 | 150 | </hbox> |
michael@0 | 151 | |
michael@0 | 152 | </window> |
michael@0 | 153 |