1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/hittest/test_menu.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,134 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 1.7 + type="text/css"?> 1.8 + 1.9 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.10 + title="Hit testing for XUL menus"> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 1.14 + 1.15 + <script type="application/javascript" 1.16 + src="../common.js" /> 1.17 + <script type="application/javascript" 1.18 + src="../role.js" /> 1.19 + <script type="application/javascript" 1.20 + src="../states.js" /> 1.21 + <script type="application/javascript" 1.22 + src="../layout.js" /> 1.23 + <script type="application/javascript" 1.24 + src="../events.js" /> 1.25 + 1.26 + <script type="application/javascript"> 1.27 + <![CDATA[ 1.28 + function openMenu(aMenuID, aMenuPopupID, aMenuItemID) 1.29 + { 1.30 + this.menuNode = getNode(aMenuID); 1.31 + 1.32 + this.eventSeq = [ 1.33 + new invokerChecker(EVENT_FOCUS, this.menuNode) 1.34 + ]; 1.35 + 1.36 + this.invoke = function openMenu_invoke() 1.37 + { 1.38 + this.menuNode.open = true; 1.39 + } 1.40 + 1.41 + this.finalCheck = function openMenu_finalCheck() 1.42 + { 1.43 + hitTest(aMenuPopupID, aMenuItemID, aMenuItemID); 1.44 + } 1.45 + 1.46 + this.getID = function openMenu_invoke() 1.47 + { 1.48 + return "open menu '" + aMenuID + "' and do hit testing"; 1.49 + } 1.50 + } 1.51 + 1.52 + function closeMenu(aID, aSubID, aSub2ID) 1.53 + { 1.54 + this.menuNode = getNode(aID); 1.55 + 1.56 + this.eventSeq = [ 1.57 + new invokerChecker(EVENT_FOCUS, document) 1.58 + ]; 1.59 + 1.60 + this.invoke = function openMenu_invoke() 1.61 + { 1.62 + this.menuNode.open = false; 1.63 + } 1.64 + 1.65 + this.finalCheck = function openMenu_finalCheck() 1.66 + { 1.67 + testStates(aID, 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN); 1.68 + testStates(aSubID, STATE_INVISIBLE, 0, STATE_OFFSCREEN); 1.69 + testStates(aSub2ID, STATE_INVISIBLE, 0, STATE_OFFSCREEN); 1.70 + } 1.71 + 1.72 + this.getID = function openMenu_invoke() 1.73 + { 1.74 + return "open menu and test states"; 1.75 + } 1.76 + } 1.77 + 1.78 + var gQueue = null; 1.79 + function doTest() 1.80 + { 1.81 + if (LINUX) { 1.82 + ok(true, "No tests is running on Linux"); 1.83 + SimpleTest.finish(); 1.84 + return; 1.85 + } 1.86 + 1.87 + getNode("mi_file1").scrollIntoView(true); 1.88 + 1.89 + gQueue = new eventQueue(); 1.90 + gQueue.push(new openMenu("mi_file1", "mp_file1", "mi_file1.1")); 1.91 + gQueue.push(new openMenu("mi_file1.2", "mp_file1.2", "mi_file1.2.1")); 1.92 + gQueue.push(new closeMenu("mi_file1", "mi_file1.1", "mi_file1.2.1")); 1.93 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.94 + } 1.95 + 1.96 + SimpleTest.waitForExplicitFinish(); 1.97 + addA11yLoadEvent(doTest); 1.98 + ]]> 1.99 + </script> 1.100 + 1.101 + <hbox flex="1" style="overflow: auto;"> 1.102 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.103 + <a target="_blank" 1.104 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=670087" 1.105 + title="AccessibleObjectFromPoint returns incorrect accessible for popup menus"> 1.106 + Bug 670087 1.107 + </a> 1.108 + 1.109 + <p id="display"></p> 1.110 + <div id="content" style="display: none"> 1.111 + </div> 1.112 + <pre id="test"> 1.113 + </pre> 1.114 + </body> 1.115 + 1.116 + <vbox flex="1"> 1.117 + 1.118 + <menubar> 1.119 + <menu label="File" id="mi_file1"> 1.120 + <menupopup id="mp_file1"> 1.121 + <menuitem label="SubFile" id="mi_file1.1"/> 1.122 + <menu label="SubFile2" id="mi_file1.2"> 1.123 + <menupopup style="max-height: 5em;" id="mp_file1.2"> 1.124 + <menuitem label="SubSubFile" id="mi_file1.2.1"/> 1.125 + <menuitem label="SubSubFile2" id="mi_file1.2.2"/> 1.126 + <menuitem label="SubSubFile3" id="mi_file1.2.3"/> 1.127 + <menuitem label="SubSubFile4" id="mi_file1.2.4"/> 1.128 + </menupopup> 1.129 + </menu> 1.130 + </menupopup> 1.131 + </menu> 1.132 + </menubar> 1.133 + </vbox> 1.134 + </hbox> 1.135 + 1.136 +</window> 1.137 +