accessible/tests/mochitest/hittest/test_zoom_tree.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/hittest/test_zoom_tree.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,103 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
     1.7 +                 type="text/css"?>
     1.8 +
     1.9 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    1.10 +        title="nsIAccessible::getChildAtPoint and getDeepestChildAtPoint">
    1.11 +
    1.12 +  <script type="application/javascript"
    1.13 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    1.14 +  <script type="application/javascript"
    1.15 +          src="chrome://mochikit/content/chrome-harness.js" />
    1.16 +
    1.17 +  <script type="application/javascript"
    1.18 +          src="../treeview.js" />
    1.19 +
    1.20 +  <script type="application/javascript"
    1.21 +          src="../common.js" />
    1.22 +  <script type="application/javascript"
    1.23 +          src="../events.js" />
    1.24 +  <script type="application/javascript"
    1.25 +          src="../layout.js" />
    1.26 +  <script type="application/javascript"
    1.27 +          src="../browser.js" />
    1.28 +
    1.29 +  <script type="application/javascript">
    1.30 +  <![CDATA[
    1.31 +    function doTest()
    1.32 +    {
    1.33 +      var tabDocument = currentTabDocument();
    1.34 +      var tabWindow = currentTabWindow();
    1.35 +
    1.36 +      var tree = tabDocument.getElementById("tree");
    1.37 +      var treecols = tabDocument.getElementById("treecols");
    1.38 +      var treecol1 = tabDocument.getElementById("treecol1");
    1.39 +
    1.40 +      // tree columns
    1.41 +      hitTest(tree, treecols, treecol1);
    1.42 +
    1.43 +      // tree rows and cells
    1.44 +      var treeBoxObject = tree.treeBoxObject;
    1.45 +      var treeBodyBoxObj = tree.treeBoxObject.treeBody.boxObject;
    1.46 +      var xObj = {}, yObj = {}, widthObj = {}, heightObj = {};
    1.47 +      treeBoxObject.getCoordsForCellItem(1, tree.columns[0], "cell",
    1.48 +                                         xObj, yObj, widthObj, heightObj);
    1.49 +
    1.50 +      var treeAcc = getAccessible(tree, [nsIAccessibleTable]);
    1.51 +      var cellAcc = treeAcc.getCellAt(1, 0);
    1.52 +      var rowAcc = cellAcc.parent;
    1.53 +
    1.54 +      var cssX = xObj.value + treeBodyBoxObj.x;
    1.55 +      var cssY = yObj.value + treeBodyBoxObj.y;
    1.56 +      var [x, y] = CSSToDevicePixels(tabWindow, cssX, cssY);
    1.57 +
    1.58 +      testChildAtPoint(treeAcc, x, y, rowAcc, cellAcc);
    1.59 +      testChildAtPoint(rowAcc, x, y, cellAcc, cellAcc);
    1.60 +
    1.61 +      // do zoom
    1.62 +      zoomDocument(tabDocument, 1.5);
    1.63 +
    1.64 +      // tree columns
    1.65 +      hitTest(tree, treecols, treecol1);
    1.66 +
    1.67 +      // tree rows and cells
    1.68 +      var [x, y] = CSSToDevicePixels(tabWindow, cssX, cssY);
    1.69 +      testChildAtPoint(treeAcc, x, y, rowAcc, cellAcc);
    1.70 +      testChildAtPoint(rowAcc, x, y, cellAcc, cellAcc);
    1.71 +
    1.72 +      closeBrowserWindow();
    1.73 +      SimpleTest.finish();
    1.74 +    }
    1.75 +
    1.76 +    function prepareTest()
    1.77 +    {
    1.78 +      var tabDocument = currentTabDocument();
    1.79 +      var tree = tabDocument.getElementById("tree");
    1.80 +      loadXULTreeAndDoTest(doTest, tree, new nsTableTreeView(5));
    1.81 +    }
    1.82 +
    1.83 +    SimpleTest.waitForExplicitFinish();
    1.84 +    openBrowserWindow(prepareTest,
    1.85 +                      getRootDirectory(window.location.href) + "zoom_tree.xul",
    1.86 +                      { left: 100, top: 100 });
    1.87 +  ]]>
    1.88 +  </script>
    1.89 +
    1.90 +  <hbox flex="1" style="overflow: auto;">
    1.91 +    <body xmlns="http://www.w3.org/1999/xhtml">
    1.92 +      <a target="_blank"
    1.93 +         href="https://bugzilla.mozilla.org/show_bug.cgi?id=471493"
    1.94 +         title=" crash [@ nsPropertyTable::GetPropertyInternal]">
    1.95 +        Mozilla Bug 471493
    1.96 +      </a><br/>
    1.97 +      <p id="display"></p>
    1.98 +      <div id="content" style="display: none">
    1.99 +      </div>
   1.100 +      <pre id="test">
   1.101 +      </pre>
   1.102 +    </body>
   1.103 +  </hbox>
   1.104 +
   1.105 +</window>
   1.106 +

mercurial