browser/base/content/test/general/browser_tab_dragdrop2_frame1.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/base/content/test/general/browser_tab_dragdrop2_frame1.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,167 @@
     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" type="text/css"?>
     1.7 +<!--
     1.8 +  XUL Widget Test for panels
     1.9 +  -->
    1.10 +<window title="Titlebar" width="200" height="200"
    1.11 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    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/tests/SimpleTest/EventUtils.js"/>
    1.16 +
    1.17 +<tree id="tree" seltype="single" width="100" height="100">
    1.18 +  <treecols>
    1.19 +    <treecol flex="1"/>
    1.20 +    <treecol flex="1"/>
    1.21 +  </treecols>
    1.22 +  <treechildren id="treechildren">
    1.23 +    <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
    1.24 +    <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
    1.25 +    <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
    1.26 +    <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
    1.27 +    <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
    1.28 +    <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
    1.29 +  </treechildren>
    1.30 +</tree>
    1.31 +
    1.32 +
    1.33 +  <!-- test results are displayed in the html:body -->
    1.34 +  <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
    1.35 +
    1.36 +  <!-- test code goes here -->
    1.37 +  <script type="application/javascript"><![CDATA[
    1.38 +
    1.39 +SimpleTest.waitForExplicitFinish();
    1.40 +
    1.41 +var currentTest = null;
    1.42 +
    1.43 +var i = 0;
    1.44 +var my_debug = false;
    1.45 +function test_panels()
    1.46 +{
    1.47 +  checkTreeCoords();
    1.48 +
    1.49 +  addEventListener("popupshown", popupShown, false);
    1.50 +  addEventListener("popuphidden", nextTest, false);
    1.51 +  return nextTest();
    1.52 +}
    1.53 +
    1.54 +function nextTest()
    1.55 +{
    1.56 +  ok(true,"popuphidden " + i)
    1.57 +  if (i == tests.length) {
    1.58 +    return i;
    1.59 +  }
    1.60 +
    1.61 +  currentTest = tests[i];
    1.62 +  var panel = createPanel(currentTest.attrs);
    1.63 +  currentTest.test(panel);
    1.64 +  return i;
    1.65 +}
    1.66 +
    1.67 +var waitSteps = 0;
    1.68 +function popupShown(event)
    1.69 +{
    1.70 +  var panel = event.target;
    1.71 +  if (waitSteps > 0 && navigator.platform.indexOf("Linux") >= 0 &&
    1.72 +      panel.boxObject.screenY == 210) {
    1.73 +    waitSteps--;
    1.74 +    setTimeout(popupShown, 10, event);
    1.75 +    return;
    1.76 +  }
    1.77 +  ++i;
    1.78 +
    1.79 +  currentTest.result(currentTest.testname + " ", panel);
    1.80 +  panel.hidePopup();
    1.81 +}
    1.82 +
    1.83 +function createPanel(attrs)
    1.84 +{
    1.85 +  var panel = document.createElement("panel");
    1.86 +  for (var a in attrs) {
    1.87 +    panel.setAttribute(a, attrs[a]);
    1.88 +  }
    1.89 +
    1.90 +  var button = document.createElement("button");
    1.91 +  panel.appendChild(button);
    1.92 +  button.label = "OK";
    1.93 +  button.width = 120;
    1.94 +  button.height = 40;
    1.95 +  button.setAttribute("style", "-moz-appearance: none; border: 0; margin: 0;");
    1.96 +  panel.setAttribute("style", "-moz-appearance: none; border: 0; margin: 0;");
    1.97 +  return document.documentElement.appendChild(panel);
    1.98 +}
    1.99 +
   1.100 +function checkTreeCoords()
   1.101 +{
   1.102 +  var tree = $("tree");
   1.103 +  var treechildren = $("treechildren");
   1.104 +  tree.currentIndex = 0;
   1.105 +  tree.treeBoxObject.scrollToRow(0);
   1.106 +  synthesizeMouse(treechildren, 10, tree.treeBoxObject.rowHeight + 2, { });
   1.107 +
   1.108 +  tree.treeBoxObject.scrollToRow(2);
   1.109 +  synthesizeMouse(treechildren, 10, tree.treeBoxObject.rowHeight + 2, { });
   1.110 +}
   1.111 +
   1.112 +var tests = [
   1.113 +  {
   1.114 +    testname: "normal panel",
   1.115 +    attrs: { },
   1.116 +    test: function(panel) {
   1.117 +      panel.openPopupAtScreen(200, 210);
   1.118 +    },
   1.119 +    result: function(testname, panel) {
   1.120 +      if (my_debug) alert(testname);
   1.121 +      var panelrect = panel.getBoundingClientRect();
   1.122 +    }
   1.123 +  },
   1.124 +  {
   1.125 +    // only noautohide panels support titlebars, so one shouldn't be shown here
   1.126 +    testname: "autohide panel with titlebar",
   1.127 +    attrs: { titlebar: "normal" },
   1.128 +    test: function(panel) {
   1.129 +      panel.openPopupAtScreen(200, 210);
   1.130 +    },
   1.131 +    result: function(testname, panel) {
   1.132 +      if (my_debug) alert(testname);
   1.133 +      var panelrect = panel.getBoundingClientRect();
   1.134 +    }
   1.135 +  },
   1.136 +  {
   1.137 +    testname: "noautohide panel with titlebar",
   1.138 +    attrs: { noautohide: true, titlebar: "normal" },
   1.139 +    test: function(panel) {
   1.140 +      waitSteps = 25;
   1.141 +      panel.openPopupAtScreen(200, 210);
   1.142 +    },
   1.143 +    result: function(testname, panel) {
   1.144 +      if (my_debug) alert(testname);
   1.145 +      var panelrect = panel.getBoundingClientRect();
   1.146 +
   1.147 +      var gotMouseEvent = false;
   1.148 +      function mouseMoved(event)
   1.149 +      {
   1.150 +        gotMouseEvent = true;
   1.151 +      }
   1.152 +
   1.153 +      panel.addEventListener("mousemove", mouseMoved, true);
   1.154 +      synthesizeMouse(panel, 10, 10, { type: "mousemove" });
   1.155 +      panel.removeEventListener("mousemove", mouseMoved, true);
   1.156 +
   1.157 +      var tree = $("tree");
   1.158 +      tree.currentIndex = 0;
   1.159 +      panel.appendChild(tree);
   1.160 +      checkTreeCoords();
   1.161 +    }
   1.162 +  }
   1.163 +];
   1.164 +
   1.165 +SimpleTest.waitForFocus(test_panels);
   1.166 +
   1.167 +]]>
   1.168 +</script>
   1.169 +
   1.170 +</window>

mercurial