dom/tests/mochitest/general/test_offsets.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/general/test_offsets.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,96 @@
     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 +<?xml-stylesheet href="test_offsets.css" type="text/css"?>
     1.8 +<!--
     1.9 +  XUL Tests for client/scroll properties
    1.10 +  -->
    1.11 +<window title="Test Offset/Client/Scroll Properties" width="500" height="600"
    1.12 +        style="margin: 1px !important"
    1.13 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.14 +  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    1.15 +  <script type="text/javascript" src="test_offsets.js"/>
    1.16 +
    1.17 +<vbox id="testelements" style="margin: 0; padding: 0; border: 0;">
    1.18 +<vbox id="vbox" style="margin: 5px 0 0 2px;">
    1.19 +  <vbox id="noscroll" align="start">
    1.20 +    <button id="button1" label="Button One" style="margin: 0px; padding: 0; border: 0;"/>
    1.21 +    <button id="button2" label="Button Two" width="140" height="120"/>
    1.22 +  </vbox>
    1.23 +  <hbox align="start">
    1.24 +    <vbox id="scrollbox" style="overflow: scroll; padding: 2px; margin: 3px; border: 4px solid green;"
    1.25 +          maxwidth="66" maxheight="56">
    1.26 +      <label value="One" style="margin: 0"/>
    1.27 +      <label id="scrollchild" value="Two"/>
    1.28 +      <label value="Three"/>
    1.29 +      <label id="lastline" value="This fourth label is much longer than the others"
    1.30 +             style="margin: 0; padding: 0; border: 0;"/>
    1.31 +    </vbox>
    1.32 +    <vbox id="scrollbox-test">
    1.33 +       <scrollbar orient="vertical" style="border: 0; padding: 0;"/>
    1.34 +    </vbox>
    1.35 +  </hbox>
    1.36 +</vbox>
    1.37 +
    1.38 +<svg:svg id="svgbase" width="45" height="20" xmlns:svg="http://www.w3.org/2000/svg">
    1.39 +  <svg:rect id="svgrect" x="3" y="5" width="45" height="20" fill="red"/>
    1.40 +</svg:svg>
    1.41 +
    1.42 +</vbox>
    1.43 +
    1.44 +<button id="outermenu" type="menu" label="Menu">
    1.45 +  <menupopup id="outerpopup"
    1.46 +             style="margin-left: 5px; padding-left: 3px; padding: 0;"
    1.47 +             onpopupshown="this.firstChild.open = true"
    1.48 +             onpopuphidden="if (event.target == this) SimpleTest.finish();">
    1.49 +    <menu id="innermenu" label="Open"
    1.50 +          style="margin: 0; padding: 0; border: 2px black solid; -moz-appearance: none;">
    1.51 +      <menupopup style="margin: 0; padding: 0; border: 1px black solid; -moz-appearance: none;"
    1.52 +                 onpopupshown="testElements('outermenu', doneTests)">
    1.53 +        <menuitem label="Document"/>
    1.54 +        <menuitem id="innermenuitem" style="margin: 2px; padding: 3px;" label="Page"/>
    1.55 +      </menupopup>
    1.56 +    </menu>
    1.57 +    <menuitem id="outermenuitem" label="Close"/>
    1.58 +  </menupopup>
    1.59 +</button>
    1.60 +
    1.61 +  <!-- test results are displayed in the html:body -->
    1.62 +  <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
    1.63 +
    1.64 +  <!-- test code goes here -->
    1.65 +  <script type="application/javascript"><![CDATA[
    1.66 +
    1.67 +var gTestSet = "box";
    1.68 +
    1.69 +var whichpopup = "outer";
    1.70 +
    1.71 +SimpleTest.waitForExplicitFinish();
    1.72 +
    1.73 +function startTests()
    1.74 +{
    1.75 +  testElements('testelements', doneTests);
    1.76 +}
    1.77 +
    1.78 +function doneTests()
    1.79 +{
    1.80 +  if (gTestSet == "box") {
    1.81 +    gTestSet = "popup";
    1.82 +    // only test this on Mac for now
    1.83 +    if (navigator.platform.indexOf("Mac") >= 0) {
    1.84 +      checkScrollState($("outerpopup"), 0, 0, 0, 0, "popup before open");
    1.85 +      checkClientState($("outerpopup"), 0, 0, 0, 0, "popup before open");
    1.86 +    }
    1.87 +    $("outermenu").open = true;
    1.88 +  }
    1.89 +  else {
    1.90 +    $("outermenu").open = false;
    1.91 +  }
    1.92 +}
    1.93 +
    1.94 +SimpleTest.waitForFocus(startTests);
    1.95 +
    1.96 +]]>
    1.97 +</script>
    1.98 +
    1.99 +</window>

mercurial