test_popupZoom.xul 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
  7. <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
  8. <!-- test results are displayed in the html:body -->
  9. <body xmlns="http://www.w3.org/1999/xhtml">
  10. </body>
  11. <!-- test code goes here -->
  12. <script type="application/javascript"><![CDATA[
  13. SimpleTest.waitForExplicitFinish();
  14. var docviewer;
  15. var savedzoom;
  16. function openPopup()
  17. {
  18. docviewer = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
  19. .getInterface(Components.interfaces.nsIWebNavigation)
  20. .QueryInterface(Components.interfaces.nsIDocShell)
  21. .contentViewer;
  22. savedzoom = docviewer.fullZoom;
  23. docviewer.fullZoom = 2;
  24. document.getElementById("panel").
  25. openPopup(document.getElementById("anchor"), "after_start", 0, 0, false, false, null);
  26. }
  27. function popupShown(event)
  28. {
  29. var panel = document.getElementById("panel");
  30. var panelbcr = panel.getBoundingClientRect();
  31. var anchorbcr = document.getElementById("anchor").getBoundingClientRect();
  32. ok(Math.abs(panelbcr.x - anchorbcr.x) < 3, "x pos is correct");
  33. ok(Math.abs(panelbcr.y - anchorbcr.bottom) < 3, "y pos is correct");
  34. docviewer.fullZoom = savedzoom;
  35. event.target.hidePopup();
  36. }
  37. SimpleTest.waitForFocus(openPopup);
  38. ]]></script>
  39. <description id="anchor" value="Sometext to this some texts"/>
  40. <panel id="panel" onpopupshown="popupShown(event)" onpopuphidden="SimpleTest.finish()">
  41. <resizer id="resizer" dir="bottomend" width="16" height="16"/>
  42. <hbox width="50" height="50" flex="1"/>
  43. </panel>
  44. </window>