accessible/tests/mochitest/hittest/test_general.html

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

mercurial