diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /accessible/tests/mochitest/hittest | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'accessible/tests/mochitest/hittest')
-rw-r--r-- | accessible/tests/mochitest/hittest/a11y.ini | 14 | ||||
-rw-r--r-- | accessible/tests/mochitest/hittest/test_browser.html | 63 | ||||
-rw-r--r-- | accessible/tests/mochitest/hittest/test_canvas_hitregion.html | 88 | ||||
-rw-r--r-- | accessible/tests/mochitest/hittest/test_general.html | 115 | ||||
-rw-r--r-- | accessible/tests/mochitest/hittest/test_menu.xul | 134 | ||||
-rw-r--r-- | accessible/tests/mochitest/hittest/test_shadowroot.html | 72 | ||||
-rw-r--r-- | accessible/tests/mochitest/hittest/test_zoom.html | 61 | ||||
-rw-r--r-- | accessible/tests/mochitest/hittest/test_zoom_text.html | 57 | ||||
-rw-r--r-- | accessible/tests/mochitest/hittest/test_zoom_tree.xul | 100 | ||||
-rw-r--r-- | accessible/tests/mochitest/hittest/zoom_tree.xul | 18 |
10 files changed, 722 insertions, 0 deletions
diff --git a/accessible/tests/mochitest/hittest/a11y.ini b/accessible/tests/mochitest/hittest/a11y.ini new file mode 100644 index 000000000..13bca54de --- /dev/null +++ b/accessible/tests/mochitest/hittest/a11y.ini @@ -0,0 +1,14 @@ +[DEFAULT] +support-files = zoom_tree.xul + !/accessible/tests/mochitest/*.js + !/accessible/tests/mochitest/letters.gif + +[test_browser.html] +[test_canvas_hitregion.html] +skip-if = (os == "android" || appname == "b2g") +[test_general.html] +[test_menu.xul] +[test_shadowroot.html] +[test_zoom.html] +[test_zoom_text.html] +[test_zoom_tree.xul] diff --git a/accessible/tests/mochitest/hittest/test_browser.html b/accessible/tests/mochitest/hittest/test_browser.html new file mode 100644 index 000000000..75e0b9a95 --- /dev/null +++ b/accessible/tests/mochitest/hittest/test_browser.html @@ -0,0 +1,63 @@ +<!DOCTYPE html> +<html> +<head> + <title>nsIAccessible::childAtPoint() from browser tests</title> + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../layout.js"></script> + + <script type="application/javascript"> + function doTest() + { + // Hit testing. See bug #726097 + getNode("hittest").scrollIntoView(true); + + var hititem = getAccessible("hititem"); + var hittest = getAccessible("hittest"); + + var [hitX, hitY, hitWidth, hitHeight] = getBounds(hititem); + var tgtX = hitX + hitWidth / 2; + var tgtY = hitY + hitHeight / 2; + + var rootAcc = getRootAccessible(); + var docAcc = getAccessible(document); + var outerDocAcc = docAcc.parent; + + var hitAcc = rootAcc.getDeepestChildAtPoint(tgtX, tgtY); + is(hitAcc, hititem, "Hit match at " + tgtX + "," + tgtY + + ". Found: " + prettyName(hitAcc)); + var hitAcc2 = docAcc.getDeepestChildAtPoint(tgtX, tgtY); + is(hitAcc, hitAcc2, "Hit match at " + tgtX + "," + tgtY + + ". Found: " + prettyName(hitAcc2)); + + hitAcc = outerDocAcc.getChildAtPoint(tgtX, tgtY); + is(hitAcc, docAcc, "Hit match at " + tgtX + "," + tgtY + + ". Found: " + prettyName(hitAcc)); + hitAcc = docAcc.getChildAtPoint(tgtX, tgtY); + is(hitAcc, hittest, "Hit match at " + tgtX + "," + tgtY + + ". Found: " + prettyName(hitAcc)); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=726097" + title="nsIAccessible::childAtPoint() from browser tests">Mozilla Bug 726097</a> + + <div id="hittest"> + <div id="hititem"><span role="image">img</span>item</div> + </div> +</body> +</html> diff --git a/accessible/tests/mochitest/hittest/test_canvas_hitregion.html b/accessible/tests/mochitest/hittest/test_canvas_hitregion.html new file mode 100644 index 000000000..fc1df3d60 --- /dev/null +++ b/accessible/tests/mochitest/hittest/test_canvas_hitregion.html @@ -0,0 +1,88 @@ +<!DOCTYPE html> +<html> +<head> + <title>nsIAccessible::childAtPoint() for canvas from browser tests</title> + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../layout.js"></script> + + <script type="application/javascript"> + function redrawCheckbox(context, element, x, y) + { + context.save(); + context.font = '10px sans-serif'; + context.textAlign = 'left'; + context.textBaseline = 'middle'; + var metrics = context.measureText(element.parentNode.textContent); + context.beginPath(); + context.strokeStyle = 'black'; + context.rect(x-5, y-5, 10, 10); + context.stroke(); + if (element.checked) { + context.fillStyle = 'black'; + context.fill(); + } + context.fillText(element.parentNode.textContent, x+5, y); + + context.beginPath(); + context.rect(x-7, y-7, 12 + metrics.width+2, 14); + + if (document.activeElement == element) + context.drawFocusIfNeeded(element); + context.addHitRegion({control: element}); + context.restore(); + } + + function doTest() + { + var offsetX = 20, offsetY = 40; + getNode("hitcanvas").scrollIntoView(true); + + var context = document.getElementById("hitcanvas").getContext('2d'); + redrawCheckbox(context, document.getElementById('hitcheck'), + offsetX, offsetY); + + var hitcanvas = getAccessible("hitcanvas"); + var hitcheck = getAccessible("hitcheck"); + + var [hitX, hitY, hitWidth, hitHeight] = getBounds(hitcanvas); + var [deltaX, deltaY] = CSSToDevicePixels(window, offsetX, offsetY); + + var docAcc = getAccessible(document); + + // test if we hit the region associated with the shadow dom checkbox + var tgtX = hitX + deltaX; + var tgtY = hitY + deltaY; + hitAcc = docAcc.getDeepestChildAtPoint(tgtX, tgtY); + isObject(hitAcc, hitcheck, `Hit match at (${tgtX}, ${tgtY}`); + + // test that we don't hit the region associated with the shadow dom checkbox + tgtY = hitY + deltaY * 2; + hitAcc = docAcc.getDeepestChildAtPoint(tgtX, tgtY); + isObject(hitAcc, hitcanvas, `Hit match at (${tgtX}, ${tgtY}`); + + SimpleTest.finish(); + } + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(function() { + SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]}, doTest); + }); + </script> +</head> +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=966591" + title="nsIAccessible::childAtPoint() for canvas hit regions from browser tests">Mozilla Bug 966591</a> + + <canvas id="hitcanvas"> + <input id="hitcheck" type="checkbox"><label for="showA"> Show A </label> + </canvas> +</body> +</html> diff --git a/accessible/tests/mochitest/hittest/test_general.html b/accessible/tests/mochitest/hittest/test_general.html new file mode 100644 index 000000000..74ff4fe29 --- /dev/null +++ b/accessible/tests/mochitest/hittest/test_general.html @@ -0,0 +1,115 @@ +<!DOCTYPE html> +<html> +<head> + <title>nsIAccessible::childAtPoint() tests</title> + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../layout.js"></script> + <script type="application/javascript" + src="../events.js"></script> + + <script type="application/javascript"> + function doPreTest() + { + waitForImageMap("imgmap", doTest); + } + + function doTest() + { + // Not specific case, child and deepchild testing. + var list = getAccessible("list"); + var listitem = getAccessible("listitem"); + var image = getAccessible("image"); +if (!MAC) { + testChildAtPoint(list, 1, 1, listitem, image.firstChild); +} else { + todo(false, "Bug 746974 - children must match on all platforms, disable failing test on Mac"); +} + + // ::MustPrune case (in this case childAtPoint doesn't look inside a + // textbox), point is inside of textbox. + var txt = getAccessible("txt"); + testChildAtPoint(txt, 1, 1, txt, txt); + + // ::MustPrune case, point is outside of textbox accessible but is in + // document. + testChildAtPoint(txt, -1, 1, null, null); + + // ::MustPrune case, point is outside of root accessible. + testChildAtPoint(txt, -10000, 10000, null, null); + + // Not specific case, point is inside of btn accessible. + var btn = getAccessible("btn"); + var btnText = btn.firstChild; + testChildAtPoint(btn, 1, 1, btn, btn); + + // Not specific case, point is outside of btn accessible. + testChildAtPoint(btn, -1, 1, null, null); + + // Out of flow accessible testing, do not return out of flow accessible + // because it's not a child of the accessible even visually it is. + var rectArea = getNode("area").getBoundingClientRect(); + var outOfFlow = getNode("outofflow"); + outOfFlow.style.left = rectArea.left + "px"; + outOfFlow.style.top = rectArea.top + "px"; + + testChildAtPoint("area", 1, 1, "area", "area"); + + // Test image maps. Their children are not in the layout tree. + var theLetterA = getAccessible("imgmap").firstChild; + hitTest("imgmap", theLetterA, theLetterA); + hitTest("container", "imgmap", theLetterA); + + // hit testing for element contained by zero-width element + hitTest("container2", "container2_input", "container2_input"); + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doPreTest); + </script> +</head> +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=491657" + title="nsIAccessible::childAtPoint() tests">Mozilla Bug 491657</a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <div role="list" id="list"> + <div role="listitem" id="listitem"><span role="image" id="image">img</span>item</div> + </div> + + <span role="button">button1</span><span role="button" id="btn">button2</span> + + <span role="textbox">textbox1</span><span role="textbox" id="txt">textbox2</span> + + <div id="outofflow" style="width: 10px; height: 10px; position: absolute; left: 0px; top: 0px; background-color: yellow;"> + </div> + <div id="area" style="width: 100px; height: 100px; background-color: blue;"></div> + + <map name="atoz_map"> + <area href="http://www.bbc.co.uk/radio4/atoz/index.shtml#a" + coords="0,0,15,15" alt="thelettera" shape="rect"/> + </map> + + <div id="container"> + <img id="imgmap" width="447" height="15" usemap="#atoz_map" src="../letters.gif"/> + </div> + + <div id="container2" style="width: 0px"> + <input id="container2_input"> + </div> +</body> +</html> diff --git a/accessible/tests/mochitest/hittest/test_menu.xul b/accessible/tests/mochitest/hittest/test_menu.xul new file mode 100644 index 000000000..30bf93acf --- /dev/null +++ b/accessible/tests/mochitest/hittest/test_menu.xul @@ -0,0 +1,134 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" + type="text/css"?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="Hit testing for XUL menus"> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> + + <script type="application/javascript" + src="../common.js" /> + <script type="application/javascript" + src="../role.js" /> + <script type="application/javascript" + src="../states.js" /> + <script type="application/javascript" + src="../layout.js" /> + <script type="application/javascript" + src="../events.js" /> + + <script type="application/javascript"> + <![CDATA[ + function openMenu(aMenuID, aMenuPopupID, aMenuItemID) + { + this.menuNode = getNode(aMenuID); + + this.eventSeq = [ + new invokerChecker(EVENT_FOCUS, this.menuNode) + ]; + + this.invoke = function openMenu_invoke() + { + this.menuNode.open = true; + } + + this.finalCheck = function openMenu_finalCheck() + { + hitTest(aMenuPopupID, aMenuItemID, aMenuItemID); + } + + this.getID = function openMenu_invoke() + { + return "open menu '" + aMenuID + "' and do hit testing"; + } + } + + function closeMenu(aID, aSubID, aSub2ID) + { + this.menuNode = getNode(aID); + + this.eventSeq = [ + new invokerChecker(EVENT_FOCUS, document) + ]; + + this.invoke = function openMenu_invoke() + { + this.menuNode.open = false; + } + + this.finalCheck = function openMenu_finalCheck() + { + testStates(aID, 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN); + testStates(aSubID, STATE_INVISIBLE, 0, STATE_OFFSCREEN); + testStates(aSub2ID, STATE_INVISIBLE, 0, STATE_OFFSCREEN); + } + + this.getID = function openMenu_invoke() + { + return "open menu and test states"; + } + } + + var gQueue = null; + function doTest() + { + if (LINUX) { + ok(true, "No tests is running on Linux"); + SimpleTest.finish(); + return; + } + + getNode("mi_file1").scrollIntoView(true); + + gQueue = new eventQueue(); + gQueue.push(new openMenu("mi_file1", "mp_file1", "mi_file1.1")); + gQueue.push(new openMenu("mi_file1.2", "mp_file1.2", "mi_file1.2.1")); + gQueue.push(new closeMenu("mi_file1", "mi_file1.1", "mi_file1.2.1")); + gQueue.invoke(); // Will call SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + ]]> + </script> + + <hbox flex="1" style="overflow: auto;"> + <body xmlns="http://www.w3.org/1999/xhtml"> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=670087" + title="AccessibleObjectFromPoint returns incorrect accessible for popup menus"> + Bug 670087 + </a> + + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + </body> + + <vbox flex="1"> + + <menubar> + <menu label="File" id="mi_file1"> + <menupopup id="mp_file1"> + <menuitem label="SubFile" id="mi_file1.1"/> + <menu label="SubFile2" id="mi_file1.2"> + <menupopup style="max-height: 5em;" id="mp_file1.2"> + <menuitem label="SubSubFile" id="mi_file1.2.1"/> + <menuitem label="SubSubFile2" id="mi_file1.2.2"/> + <menuitem label="SubSubFile3" id="mi_file1.2.3"/> + <menuitem label="SubSubFile4" id="mi_file1.2.4"/> + </menupopup> + </menu> + </menupopup> + </menu> + </menubar> + </vbox> + </hbox> + +</window> + diff --git a/accessible/tests/mochitest/hittest/test_shadowroot.html b/accessible/tests/mochitest/hittest/test_shadowroot.html new file mode 100644 index 000000000..41400840d --- /dev/null +++ b/accessible/tests/mochitest/hittest/test_shadowroot.html @@ -0,0 +1,72 @@ +<!DOCTYPE html> +<html> +<head> + <title>ShadowRoot hit tests</title> + <link rel="stylesheet" type="text/css" + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../layout.js"></script> + + <script type="application/javascript"> + function doTest() + { + var componentAcc = getAccessible('component1'); + testChildAtPoint(componentAcc, 1, 1, componentAcc.firstChild, + componentAcc.firstChild); + + componentAcc = getAccessible('component2'); + testChildAtPoint(componentAcc, 1, 1, componentAcc.firstChild, + componentAcc.firstChild); + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> +<body> + + <a target="_blank" + title="Test getChildAtPoint works for shadow DOM content" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=1027315"> + Mozilla Bug 1027315 + </a><br/> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <div role="group" class="components" id="component1" style="display: inline-block;"> + <!-- + <div role="button" id="component-child" + style="width: 100px; height: 100px; background-color: pink;"> + </div> + --> + </div> + <div role="group" class="components" id="component2" style="display: inline-block;"> + <!-- + <button>Hello world</button> + --> + </div> + <script> + // This routine adds the comment children of each 'component' to its + // shadow root. + var components = document.querySelectorAll('.components'); + for (var i = 0; i < components.length; i++) { + var component = components[i]; + var shadow = component.createShadowRoot(); + for (var child = component.firstChild; child; child = child.nextSibling) { + if (child.nodeType === 8) + shadow.innerHTML = child.data; + } + } + </script> + +</body> +</html> diff --git a/accessible/tests/mochitest/hittest/test_zoom.html b/accessible/tests/mochitest/hittest/test_zoom.html new file mode 100644 index 000000000..bc1cf9d55 --- /dev/null +++ b/accessible/tests/mochitest/hittest/test_zoom.html @@ -0,0 +1,61 @@ +<!DOCTYPE html> +<html> +<head> + <title>childAtPoint when page is zoomed</title> + <link rel="stylesheet" type="text/css" + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../role.js"></script> + <script type="application/javascript" + src="../layout.js"></script> + <script type="application/javascript" + src="../browser.js"></script> + + <script type="application/javascript"> + function doTest() + { +if (!MAC) { + var tabDocument = currentTabDocument(); + var p1 = tabDocument.body.firstElementChild; + var p2 = tabDocument.body.lastElementChild; + + hitTest(tabDocument, p1, p1.firstChild); + hitTest(tabDocument, p2, p2.firstChild); + + zoomDocument(tabDocument, 2.0); + + hitTest(tabDocument, p1, p1.firstChild); + hitTest(tabDocument, p2, p2.firstChild); + + closeBrowserWindow(); +} else { + todo(false, "Bug 746974 - deepest child must be correct on all platforms, disabling on Mac!"); +} + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + openBrowserWindow(doTest, + "data:text/html,<html><body><p>para 1</p><p>para 2</p></body></html>", + { left: 100, top: 100 }); + </script> +</head> +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=727942" + title="childAtPoint may return incorrect accessibles when page zoomed"> + Mozilla Bug 727942 + </a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> +</body> +</html> diff --git a/accessible/tests/mochitest/hittest/test_zoom_text.html b/accessible/tests/mochitest/hittest/test_zoom_text.html new file mode 100644 index 000000000..3a75296b2 --- /dev/null +++ b/accessible/tests/mochitest/hittest/test_zoom_text.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<html> +<head> + <title>getOffsetAtPoint when page is zoomed</title> + <link rel="stylesheet" type="text/css" + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../role.js"></script> + <script type="application/javascript" + src="../layout.js"></script> + + <script type="application/javascript"> + function doTest() + { + var hyperText = getNode("paragraph"); + var textNode = hyperText.firstChild; + var [x, y, width, height] = getBounds(textNode); + testOffsetAtPoint(hyperText, x + width / 2, y + height / 2, + COORDTYPE_SCREEN_RELATIVE, + hyperText.textContent.length / 2); + + zoomDocument(document, 2.0); + + var [x, y, width, height] = getBounds(textNode); + testOffsetAtPoint(hyperText, x + width / 2, y + height / 2, + COORDTYPE_SCREEN_RELATIVE, + hyperText.textContent.length / 2); + + zoomDocument(document, 1.0); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=727942" + title="getOffsetAtPoint returns incorrect value when page is zoomed"> + Mozilla Bug 727942 + </a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + <p id="paragraph" style="font-family: monospace;">Болтали две сороки</p> +</body> +</html> diff --git a/accessible/tests/mochitest/hittest/test_zoom_tree.xul b/accessible/tests/mochitest/hittest/test_zoom_tree.xul new file mode 100644 index 000000000..da1628df2 --- /dev/null +++ b/accessible/tests/mochitest/hittest/test_zoom_tree.xul @@ -0,0 +1,100 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" + type="text/css"?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="nsIAccessible::getChildAtPoint and getDeepestChildAtPoint"> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> + <script type="application/javascript" + src="chrome://mochikit/content/chrome-harness.js" /> + + <script type="application/javascript" + src="../treeview.js" /> + + <script type="application/javascript" + src="../common.js" /> + <script type="application/javascript" + src="../events.js" /> + <script type="application/javascript" + src="../layout.js" /> + <script type="application/javascript" + src="../browser.js" /> + + <script type="application/javascript"> + <![CDATA[ + function doTest() + { + var tabDocument = currentTabDocument(); + var tabWindow = currentTabWindow(); + + var tree = tabDocument.getElementById("tree"); + var treecols = tabDocument.getElementById("treecols"); + var treecol1 = tabDocument.getElementById("treecol1"); + + // tree columns + hitTest(tree, treecols, treecol1); + + // tree rows and cells + var treeBoxObject = tree.treeBoxObject; + var treeBodyBoxObj = tree.treeBoxObject.treeBody.boxObject; + var rect = treeBoxObject.getCoordsForCellItem(1, tree.columns[0], "cell"); + + var treeAcc = getAccessible(tree, [nsIAccessibleTable]); + var cellAcc = treeAcc.getCellAt(1, 0); + var rowAcc = cellAcc.parent; + + var cssX = rect.x + treeBodyBoxObj.x; + var cssY = rect.y + treeBodyBoxObj.y; + var [x, y] = CSSToDevicePixels(tabWindow, cssX, cssY); + + testChildAtPoint(treeAcc, x, y, rowAcc, cellAcc); + testChildAtPoint(rowAcc, x, y, cellAcc, cellAcc); + + // do zoom + zoomDocument(tabDocument, 1.5); + + // tree columns + hitTest(tree, treecols, treecol1); + + // tree rows and cells + var [x, y] = CSSToDevicePixels(tabWindow, cssX, cssY); + testChildAtPoint(treeAcc, x, y, rowAcc, cellAcc); + testChildAtPoint(rowAcc, x, y, cellAcc, cellAcc); + + closeBrowserWindow(); + SimpleTest.finish(); + } + + function prepareTest() + { + var tabDocument = currentTabDocument(); + var tree = tabDocument.getElementById("tree"); + loadXULTreeAndDoTest(doTest, tree, new nsTableTreeView(5)); + } + + SimpleTest.waitForExplicitFinish(); + openBrowserWindow(prepareTest, + getRootDirectory(window.location.href) + "zoom_tree.xul", + { left: 100, top: 100 }); + ]]> + </script> + + <hbox flex="1" style="overflow: auto;"> + <body xmlns="http://www.w3.org/1999/xhtml"> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=471493" + title=" crash [@ nsPropertyTable::GetPropertyInternal]"> + Mozilla Bug 471493 + </a><br/> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + </body> + </hbox> + +</window> diff --git a/accessible/tests/mochitest/hittest/zoom_tree.xul b/accessible/tests/mochitest/hittest/zoom_tree.xul new file mode 100644 index 000000000..52ec0932a --- /dev/null +++ b/accessible/tests/mochitest/hittest/zoom_tree.xul @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" + type="text/css"?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="nsIAccessible::getChildAtPoint and getDeepestChildAtPoint for XUL trees"> + + <tree id="tree" flex="1"> + <treecols id="treecols"> + <treecol id="treecol1" flex="1" primary="true" label="column"/> + <treecol id="treecol2" flex="1" label="column 2"/> + </treecols> + <treechildren id="treechildren"/> + </tree> + +</window> + |