accessible/tests/mochitest/hittest/test_menu.xul

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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
michael@0 6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 7 title="Hit testing for XUL menus">
michael@0 8
michael@0 9 <script type="application/javascript"
michael@0 10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
michael@0 11
michael@0 12 <script type="application/javascript"
michael@0 13 src="../common.js" />
michael@0 14 <script type="application/javascript"
michael@0 15 src="../role.js" />
michael@0 16 <script type="application/javascript"
michael@0 17 src="../states.js" />
michael@0 18 <script type="application/javascript"
michael@0 19 src="../layout.js" />
michael@0 20 <script type="application/javascript"
michael@0 21 src="../events.js" />
michael@0 22
michael@0 23 <script type="application/javascript">
michael@0 24 <![CDATA[
michael@0 25 function openMenu(aMenuID, aMenuPopupID, aMenuItemID)
michael@0 26 {
michael@0 27 this.menuNode = getNode(aMenuID);
michael@0 28
michael@0 29 this.eventSeq = [
michael@0 30 new invokerChecker(EVENT_FOCUS, this.menuNode)
michael@0 31 ];
michael@0 32
michael@0 33 this.invoke = function openMenu_invoke()
michael@0 34 {
michael@0 35 this.menuNode.open = true;
michael@0 36 }
michael@0 37
michael@0 38 this.finalCheck = function openMenu_finalCheck()
michael@0 39 {
michael@0 40 hitTest(aMenuPopupID, aMenuItemID, aMenuItemID);
michael@0 41 }
michael@0 42
michael@0 43 this.getID = function openMenu_invoke()
michael@0 44 {
michael@0 45 return "open menu '" + aMenuID + "' and do hit testing";
michael@0 46 }
michael@0 47 }
michael@0 48
michael@0 49 function closeMenu(aID, aSubID, aSub2ID)
michael@0 50 {
michael@0 51 this.menuNode = getNode(aID);
michael@0 52
michael@0 53 this.eventSeq = [
michael@0 54 new invokerChecker(EVENT_FOCUS, document)
michael@0 55 ];
michael@0 56
michael@0 57 this.invoke = function openMenu_invoke()
michael@0 58 {
michael@0 59 this.menuNode.open = false;
michael@0 60 }
michael@0 61
michael@0 62 this.finalCheck = function openMenu_finalCheck()
michael@0 63 {
michael@0 64 testStates(aID, 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN);
michael@0 65 testStates(aSubID, STATE_INVISIBLE, 0, STATE_OFFSCREEN);
michael@0 66 testStates(aSub2ID, STATE_INVISIBLE, 0, STATE_OFFSCREEN);
michael@0 67 }
michael@0 68
michael@0 69 this.getID = function openMenu_invoke()
michael@0 70 {
michael@0 71 return "open menu and test states";
michael@0 72 }
michael@0 73 }
michael@0 74
michael@0 75 var gQueue = null;
michael@0 76 function doTest()
michael@0 77 {
michael@0 78 if (LINUX) {
michael@0 79 ok(true, "No tests is running on Linux");
michael@0 80 SimpleTest.finish();
michael@0 81 return;
michael@0 82 }
michael@0 83
michael@0 84 getNode("mi_file1").scrollIntoView(true);
michael@0 85
michael@0 86 gQueue = new eventQueue();
michael@0 87 gQueue.push(new openMenu("mi_file1", "mp_file1", "mi_file1.1"));
michael@0 88 gQueue.push(new openMenu("mi_file1.2", "mp_file1.2", "mi_file1.2.1"));
michael@0 89 gQueue.push(new closeMenu("mi_file1", "mi_file1.1", "mi_file1.2.1"));
michael@0 90 gQueue.invoke(); // Will call SimpleTest.finish();
michael@0 91 }
michael@0 92
michael@0 93 SimpleTest.waitForExplicitFinish();
michael@0 94 addA11yLoadEvent(doTest);
michael@0 95 ]]>
michael@0 96 </script>
michael@0 97
michael@0 98 <hbox flex="1" style="overflow: auto;">
michael@0 99 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 100 <a target="_blank"
michael@0 101 href="https://bugzilla.mozilla.org/show_bug.cgi?id=670087"
michael@0 102 title="AccessibleObjectFromPoint returns incorrect accessible for popup menus">
michael@0 103 Bug 670087
michael@0 104 </a>
michael@0 105
michael@0 106 <p id="display"></p>
michael@0 107 <div id="content" style="display: none">
michael@0 108 </div>
michael@0 109 <pre id="test">
michael@0 110 </pre>
michael@0 111 </body>
michael@0 112
michael@0 113 <vbox flex="1">
michael@0 114
michael@0 115 <menubar>
michael@0 116 <menu label="File" id="mi_file1">
michael@0 117 <menupopup id="mp_file1">
michael@0 118 <menuitem label="SubFile" id="mi_file1.1"/>
michael@0 119 <menu label="SubFile2" id="mi_file1.2">
michael@0 120 <menupopup style="max-height: 5em;" id="mp_file1.2">
michael@0 121 <menuitem label="SubSubFile" id="mi_file1.2.1"/>
michael@0 122 <menuitem label="SubSubFile2" id="mi_file1.2.2"/>
michael@0 123 <menuitem label="SubSubFile3" id="mi_file1.2.3"/>
michael@0 124 <menuitem label="SubSubFile4" id="mi_file1.2.4"/>
michael@0 125 </menupopup>
michael@0 126 </menu>
michael@0 127 </menupopup>
michael@0 128 </menu>
michael@0 129 </menubar>
michael@0 130 </vbox>
michael@0 131 </hbox>
michael@0 132
michael@0 133 </window>
michael@0 134

mercurial