dom/tests/mochitest/general/test_offsets.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     4 <?xml-stylesheet href="test_offsets.css" type="text/css"?>
     5 <!--
     6   XUL Tests for client/scroll properties
     7   -->
     8 <window title="Test Offset/Client/Scroll Properties" width="500" height="600"
     9         style="margin: 1px !important"
    10         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    11   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    12   <script type="text/javascript" src="test_offsets.js"/>
    14 <vbox id="testelements" style="margin: 0; padding: 0; border: 0;">
    15 <vbox id="vbox" style="margin: 5px 0 0 2px;">
    16   <vbox id="noscroll" align="start">
    17     <button id="button1" label="Button One" style="margin: 0px; padding: 0; border: 0;"/>
    18     <button id="button2" label="Button Two" width="140" height="120"/>
    19   </vbox>
    20   <hbox align="start">
    21     <vbox id="scrollbox" style="overflow: scroll; padding: 2px; margin: 3px; border: 4px solid green;"
    22           maxwidth="66" maxheight="56">
    23       <label value="One" style="margin: 0"/>
    24       <label id="scrollchild" value="Two"/>
    25       <label value="Three"/>
    26       <label id="lastline" value="This fourth label is much longer than the others"
    27              style="margin: 0; padding: 0; border: 0;"/>
    28     </vbox>
    29     <vbox id="scrollbox-test">
    30        <scrollbar orient="vertical" style="border: 0; padding: 0;"/>
    31     </vbox>
    32   </hbox>
    33 </vbox>
    35 <svg:svg id="svgbase" width="45" height="20" xmlns:svg="http://www.w3.org/2000/svg">
    36   <svg:rect id="svgrect" x="3" y="5" width="45" height="20" fill="red"/>
    37 </svg:svg>
    39 </vbox>
    41 <button id="outermenu" type="menu" label="Menu">
    42   <menupopup id="outerpopup"
    43              style="margin-left: 5px; padding-left: 3px; padding: 0;"
    44              onpopupshown="this.firstChild.open = true"
    45              onpopuphidden="if (event.target == this) SimpleTest.finish();">
    46     <menu id="innermenu" label="Open"
    47           style="margin: 0; padding: 0; border: 2px black solid; -moz-appearance: none;">
    48       <menupopup style="margin: 0; padding: 0; border: 1px black solid; -moz-appearance: none;"
    49                  onpopupshown="testElements('outermenu', doneTests)">
    50         <menuitem label="Document"/>
    51         <menuitem id="innermenuitem" style="margin: 2px; padding: 3px;" label="Page"/>
    52       </menupopup>
    53     </menu>
    54     <menuitem id="outermenuitem" label="Close"/>
    55   </menupopup>
    56 </button>
    58   <!-- test results are displayed in the html:body -->
    59   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
    61   <!-- test code goes here -->
    62   <script type="application/javascript"><![CDATA[
    64 var gTestSet = "box";
    66 var whichpopup = "outer";
    68 SimpleTest.waitForExplicitFinish();
    70 function startTests()
    71 {
    72   testElements('testelements', doneTests);
    73 }
    75 function doneTests()
    76 {
    77   if (gTestSet == "box") {
    78     gTestSet = "popup";
    79     // only test this on Mac for now
    80     if (navigator.platform.indexOf("Mac") >= 0) {
    81       checkScrollState($("outerpopup"), 0, 0, 0, 0, "popup before open");
    82       checkClientState($("outerpopup"), 0, 0, 0, 0, "popup before open");
    83     }
    84     $("outermenu").open = true;
    85   }
    86   else {
    87     $("outermenu").open = false;
    88   }
    89 }
    91 SimpleTest.waitForFocus(startTests);
    93 ]]>
    94 </script>
    96 </window>

mercurial