accessible/tests/mochitest/hittest/test_general.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/hittest/test_general.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,110 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>nsIAccessible::childAtPoint() tests</title>
     1.8 +  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
     1.9 +
    1.10 +  <script type="application/javascript"
    1.11 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="application/javascript"
    1.13 +          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    1.14 +
    1.15 +  <script type="application/javascript"
    1.16 +          src="../common.js"></script>
    1.17 +  <script type="application/javascript"
    1.18 +          src="../layout.js"></script>
    1.19 +  <script type="application/javascript"
    1.20 +          src="../events.js"></script>
    1.21 +
    1.22 +  <script type="application/javascript">
    1.23 +    function doPreTest()
    1.24 +    {
    1.25 +      waitForImageMap("imgmap", doTest);
    1.26 +    }
    1.27 +
    1.28 +    function doTest()
    1.29 +    {
    1.30 +      // Not specific case, child and deepchild testing.
    1.31 +      var list = getAccessible("list");
    1.32 +      var listitem = getAccessible("listitem");
    1.33 +      var image = getAccessible("image");
    1.34 +if (!MAC) {
    1.35 +      testChildAtPoint(list, 1, 1, listitem, image.firstChild);
    1.36 +} else {
    1.37 +      todo(false, "Bug 746974 - children must match on all platforms, disable failing test on Mac");
    1.38 +}
    1.39 +
    1.40 +      // ::MustPrune case (in this case childAtPoint doesn't look inside a
    1.41 +      // textbox), point is inside of textbox.
    1.42 +      var txt = getAccessible("txt");
    1.43 +      testChildAtPoint(txt, 1, 1, txt, txt);
    1.44 +
    1.45 +      // ::MustPrune case, point is outside of textbox accessible but is in
    1.46 +      // document.
    1.47 +      testChildAtPoint(txt, -1, 1, null, null);
    1.48 +
    1.49 +      // ::MustPrune case, point is outside of root accessible.
    1.50 +      testChildAtPoint(txt, -10000, 10000, null, null);
    1.51 +
    1.52 +      // Not specific case, point is inside of btn accessible.
    1.53 +      var btn = getAccessible("btn");
    1.54 +      var btnText = btn.firstChild;
    1.55 +      testChildAtPoint(btn, 1, 1, btn, btn);
    1.56 +  
    1.57 +      // Not specific case, point is outside of btn accessible.
    1.58 +      testChildAtPoint(btn, -1, 1, null, null);
    1.59 +
    1.60 +      // Out of flow accessible testing, do not return out of flow accessible
    1.61 +      // because it's not a child of the accessible even visually it is.
    1.62 +      var rectArea = getNode("area").getBoundingClientRect();
    1.63 +      var outOfFlow = getNode("outofflow");
    1.64 +      outOfFlow.style.left = rectArea.left + "px";
    1.65 +      outOfFlow.style.top = rectArea.top + "px";
    1.66 +
    1.67 +      testChildAtPoint("area", 1, 1, "area", "area");
    1.68 +
    1.69 +      // Test image maps. Their children are not in the layout tree.
    1.70 +      var theLetterA = getAccessible("imgmap").firstChild;
    1.71 +      hitTest("imgmap", theLetterA, theLetterA);
    1.72 +      hitTest("container", "imgmap", theLetterA);
    1.73 +
    1.74 +      SimpleTest.finish();
    1.75 +    }
    1.76 +
    1.77 +    SimpleTest.waitForExplicitFinish();
    1.78 +    addA11yLoadEvent(doPreTest);
    1.79 +  </script>
    1.80 +</head>
    1.81 +<body>
    1.82 +
    1.83 +  <a target="_blank"
    1.84 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=491657"
    1.85 +     title="nsIAccessible::childAtPoint() tests">Mozilla Bug 491657</a>
    1.86 +  <p id="display"></p>
    1.87 +  <div id="content" style="display: none"></div>
    1.88 +  <pre id="test">
    1.89 +  </pre>
    1.90 +
    1.91 +  <div role="list" id="list">
    1.92 +    <div role="listitem" id="listitem"><span role="image" id="image">img</span>item</div>
    1.93 +  </div>
    1.94 +
    1.95 +  <span role="button">button1</span><span role="button" id="btn">button2</span>
    1.96 +
    1.97 +  <span role="textbox">textbox1</span><span role="textbox" id="txt">textbox2</span>
    1.98 +
    1.99 +  <div id="outofflow" style="width: 10px; height: 10px; position: absolute; left: 0px; top: 0px; background-color: yellow;">
   1.100 +  </div>
   1.101 +  <div id="area" style="width: 100px; height: 100px; background-color: blue;"></div>
   1.102 +
   1.103 +  <map name="atoz_map">
   1.104 +    <area href="http://www.bbc.co.uk/radio4/atoz/index.shtml#a"
   1.105 +          coords="0,0,15,15" alt="thelettera" shape="rect"/>
   1.106 +  </map>
   1.107 +
   1.108 +  <div id="container">
   1.109 +    <img id="imgmap" width="447" height="15" usemap="#atoz_map" src="../letters.gif"/>
   1.110 +  </div>
   1.111 +
   1.112 +</body>
   1.113 +</html>

mercurial