tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_general.html (3903B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4  <title>nsIAccessible::childAtPoint() tests</title>
      5  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
      6 
      7  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
      8  <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
      9 
     10  <script type="application/javascript"
     11          src="../common.js"></script>
     12  <script type="application/javascript"
     13          src="../layout.js"></script>
     14  <script type="application/javascript"
     15          src="../events.js"></script>
     16 
     17  <script type="application/javascript">
     18    function doPreTest() {
     19      waitForImageMap("imgmap", doTest);
     20    }
     21 
     22    function doTest() {
     23      // Not specific case, child and deepchild testing.
     24      var list = getAccessible("list");
     25      var listitem = getAccessible("listitem");
     26      var image = getAccessible("image");
     27 if (!MAC) {
     28      testChildAtPoint(list, 1, 1, listitem, image.firstChild);
     29 } else {
     30      todo(false, "Bug 746974 - children must match on all platforms, disable failing test on Mac");
     31 }
     32 
     33      // ::MustPrune case (in this case childAtPoint doesn't look inside a
     34      // textbox), point is inside of textbox.
     35      var txt = getAccessible("txt");
     36      testChildAtPoint(txt, 1, 1, txt, txt);
     37 
     38      // ::MustPrune case, point is outside of textbox accessible but is in
     39      // document.
     40      testChildAtPoint(txt, -1, 1, null, null);
     41 
     42      // ::MustPrune case, point is outside of root accessible.
     43      testChildAtPoint(txt, -10000, 10000, null, null);
     44 
     45      // Not specific case, point is inside of btn accessible.
     46      var btn = getAccessible("btn");
     47      testChildAtPoint(btn, 1, 1, btn, btn);
     48 
     49      // Not specific case, point is outside of btn accessible.
     50      testChildAtPoint(btn, -1, 1, null, null);
     51 
     52      // Out of flow accessible testing, do not return out of flow accessible
     53      // because it's not a child of the accessible even visually it is.
     54      var rectArea = getNode("area").getBoundingClientRect();
     55      var outOfFlow = getNode("outofflow");
     56      outOfFlow.style.left = rectArea.left + "px";
     57      outOfFlow.style.top = rectArea.top + "px";
     58 
     59      testChildAtPoint("area", 1, 1, "area", "area");
     60 
     61      // Test image maps. Their children are not in the layout tree.
     62      var theLetterA = getAccessible("imgmap").firstChild;
     63      hitTest("imgmap", theLetterA, theLetterA);
     64      hitTest("container", "imgmap", theLetterA);
     65 
     66      // hit testing for element contained by zero-width element
     67      hitTest("container2", "container2_input", "container2_input");
     68      SimpleTest.finish();
     69    }
     70 
     71    SimpleTest.waitForExplicitFinish();
     72    addA11yLoadEvent(doPreTest);
     73  </script>
     74 </head>
     75 <body>
     76 
     77  <a target="_blank"
     78     href="https://bugzilla.mozilla.org/show_bug.cgi?id=491657"
     79     title="nsIAccessible::childAtPoint() tests">Mozilla Bug 491657</a>
     80  <p id="display"></p>
     81  <div id="content" style="display: none"></div>
     82  <pre id="test">
     83  </pre>
     84 
     85  <div role="list" id="list">
     86    <div role="listitem" id="listitem"><span role="image" id="image">img</span>item</div>
     87  </div>
     88 
     89  <span role="button">button1</span><span role="button" id="btn">button2</span>
     90 
     91  <span role="textbox">textbox1</span><span role="textbox" id="txt">textbox2</span>
     92 
     93  <div id="outofflow" style="width: 10px; height: 10px; position: absolute; left: 0px; top: 0px; background-color: yellow;">
     94  </div>
     95  <div id="area" style="width: 100px; height: 100px; background-color: blue;"></div>
     96 
     97  <map name="atoz_map">
     98    <area href="http://www.bbc.co.uk/radio4/atoz/index.shtml#a"
     99          coords="0,0,15,15" alt="thelettera" shape="rect"/>
    100  </map>
    101 
    102  <div id="container">
    103    <img id="imgmap" width="447" height="15" usemap="#atoz_map" src="../letters.gif"/>
    104  </div>
    105 
    106  <div id="container2" style="width: 0px">
    107    <input id="container2_input">
    108  </div>
    109 </body>
    110 </html>