tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_offsets.xhtml (3417B)


      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 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
     12  <script type="text/javascript" src="test_offsets.js"/>
     13 
     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" style="width: 140px; height: 120px;"/>
     19  </vbox>
     20  <hbox align="start">
     21    <vbox id="scrollbox" style="overflow: scroll; padding: 2px; margin: 3px; border: 4px solid green; max-width: 66px; max-height: 56px">
     22      <label value="One" style="margin: 0"/>
     23      <label id="scrollchild" value="Two"/>
     24      <label value="Three"/>
     25      <label id="lastline" value="This fourth label is much longer than the others"
     26             style="margin: 0; padding: 0; border: 0;"/>
     27    </vbox>
     28    <vbox id="scrollbox-test">
     29       <scrollbar vertical="true" style="border: 0; padding: 0;"/>
     30    </vbox>
     31  </hbox>
     32 </vbox>
     33 
     34 <!-- wrap svg in a div so that it can take its intrinsic width -->
     35 <div>
     36 <svg:svg id="svgbase" width="45" height="20" xmlns:svg="http://www.w3.org/2000/svg">
     37  <svg:rect id="svgrect" x="3" y="5" width="45" height="20" fill="red"/>
     38 </svg:svg>
     39 </div>
     40 
     41 </vbox>
     42 
     43 <button id="outermenu" type="menu" label="Menu">
     44  <menupopup id="outerpopup"
     45             style="margin-left: 5px; padding-left: 3px; padding: 0;"
     46             onpopupshown="this.firstChild.open = true"
     47             onpopuphidden="if (event.target == this) SimpleTest.finish();">
     48    <menu id="innermenu" label="Open"
     49          style="margin: 0; padding: 0; border: 2px black solid; -moz-appearance: none;">
     50      <menupopup style="margin: 0; padding: 0; border: 1px black solid; -moz-appearance: none;"
     51                 onpopupshown="testElements('outermenu', doneTests)">
     52        <menuitem label="Document"/>
     53        <menuitem id="innermenuitem" style="margin: 2px; padding: 3px;" label="Page"/>
     54      </menupopup>
     55    </menu>
     56    <menuitem id="outermenuitem" label="Close"/>
     57  </menupopup>
     58 </button>
     59 
     60  <!-- test results are displayed in the html:body -->
     61  <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
     62 
     63  <!-- test code goes here -->
     64  <script type="application/javascript"><![CDATA[
     65 
     66 var gTestSet = "box";
     67 
     68 var whichpopup = "outer";
     69 
     70 SimpleTest.waitForExplicitFinish();
     71 
     72 function startTests()
     73 {
     74  testElements('testelements', doneTests);
     75 }
     76 
     77 function doneTests()
     78 {
     79  if (gTestSet == "box") {
     80    gTestSet = "popup";
     81    // only test this on Mac for now
     82    if (navigator.platform.includes("Mac")) {
     83      checkScrollState($("outerpopup"), 0, 0, 0, 0, "popup before open");
     84      checkClientState($("outerpopup"), 0, 0, 0, 0, "popup before open");
     85    }
     86    $("outermenu").open = true;
     87  }
     88  else {
     89    $("outermenu").open = false;
     90  }
     91 }
     92 
     93 SimpleTest.waitForFocus(startTests);
     94 
     95 ]]>
     96 </script>
     97 
     98 </window>