tor-browser

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

test_popupZoom.xhtml (1881B)


      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 <window title="XUL Panel zoom test"
      5        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
      6  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
      7  <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
      8 
      9  <body xmlns="http://www.w3.org/1999/xhtml">
     10  </body>
     11 
     12  <script><![CDATA[
     13    SimpleTest.waitForExplicitFinish();
     14 
     15    var savedzoom;
     16 
     17    function openPopup()
     18    {
     19      docviewer = window.docShell.docViewer;
     20      savedzoom = SpecialPowers.getFullZoom(window);
     21      SpecialPowers.setFullZoom(window, 2);
     22 
     23      document.getElementById("panel").
     24        openPopup(document.getElementById("anchor"), "after_start", 0, 0, false, false, null);
     25    }
     26 
     27    function popupShown(event)
     28    {
     29      var panel = document.getElementById("panel");
     30      var panelMarginLeft = parseFloat(getComputedStyle(panel).marginLeft);
     31      var panelMarginTop = parseFloat(getComputedStyle(panel).marginTop);
     32      var panelbcr = panel.getBoundingClientRect();
     33      var anchorbcr = document.getElementById("anchor").getBoundingClientRect();
     34 
     35      ok(Math.abs(panelbcr.x - panelMarginLeft - anchorbcr.x) < 3, "x pos is correct");
     36      ok(Math.abs(panelbcr.y - panelMarginTop - anchorbcr.bottom) < 3, "y pos is correct");
     37 
     38      SpecialPowers.setFullZoom(window, savedzoom);
     39 
     40      event.target.hidePopup();
     41    }
     42 
     43    SimpleTest.waitForFocus(openPopup);
     44   ]]></script>
     45 
     46 <description id="anchor" value="Sometext to this some texts"/>
     47 <panel id="panel" onpopupshown="popupShown(event)" onpopuphidden="SimpleTest.finish()">
     48  <resizer id="resizer" dir="bottomend" width="16" height="16"/>
     49  <hbox width="50" height="50" flex="1"/>
     50 </panel>
     51 
     52 
     53 </window>