accessible/tests/mochitest/hittest/test_menu.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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"?>
     6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     7         title="Hit testing for XUL menus">
     9   <script type="application/javascript"
    10           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    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" />
    23   <script type="application/javascript">
    24   <![CDATA[
    25     function openMenu(aMenuID, aMenuPopupID, aMenuItemID)
    26     {
    27       this.menuNode = getNode(aMenuID);
    29       this.eventSeq = [
    30         new invokerChecker(EVENT_FOCUS, this.menuNode)
    31       ];
    33       this.invoke = function openMenu_invoke()
    34       {
    35         this.menuNode.open = true;
    36       }
    38       this.finalCheck = function openMenu_finalCheck()
    39       {
    40         hitTest(aMenuPopupID, aMenuItemID, aMenuItemID);
    41       }
    43       this.getID = function openMenu_invoke()
    44       {
    45         return "open menu '" + aMenuID + "' and do hit testing";
    46       }
    47     }
    49     function closeMenu(aID, aSubID, aSub2ID)
    50     {
    51       this.menuNode = getNode(aID);
    53       this.eventSeq = [
    54         new invokerChecker(EVENT_FOCUS, document)
    55       ];
    57       this.invoke = function openMenu_invoke()
    58       {
    59         this.menuNode.open = false;
    60       }
    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       }
    69       this.getID = function openMenu_invoke()
    70       {
    71         return "open menu and test states";
    72       }
    73     }
    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       }
    84       getNode("mi_file1").scrollIntoView(true);
    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     }
    93     SimpleTest.waitForExplicitFinish();
    94     addA11yLoadEvent(doTest);
    95   ]]>
    96   </script>
    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>
   106       <p id="display"></p>
   107       <div id="content" style="display: none">
   108       </div>
   109       <pre id="test">
   110       </pre>
   111     </body>
   113     <vbox flex="1">
   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>
   133 </window>

mercurial