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