DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (27a812186ff4)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<!--
XUL <resizer> tests
-->
<window title="XUL resizer tests"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>

  <!-- test results are displayed in the html:body -->
  <body xmlns="http://www.w3.org/1999/xhtml">
  </body>

  <!-- test code goes here -->
  <script type="application/javascript"><![CDATA[
    SimpleTest.waitForExplicitFinish();
    SimpleTest.ignoreAllUncaughtExceptions();

    function openPopup()
    {
      document.getElementById("panel").
        openPopupAtScreen(Math.round(window.mozInnerScreenX) + window.innerWidth - 130,
                          Math.round(window.mozInnerScreenY) + window.innerHeight - 130);
    }

    var step = 0;
    function popupShown(event)
    {
      if (step == 0) {
        // check to make sure that the popup cannot be resized past the edges of
        // the content area
        var resizerrect = document.getElementById("resizer").getBoundingClientRect();
        synthesizeMouse(document.documentElement, resizerrect.left + 5, resizerrect.top + 5, { type:"mousedown" });
        synthesizeMouse(document.documentElement, resizerrect.left + 2000, resizerrect.top + 2000, { type:"mousemove" });

        // allow a one pixel variance as rounding is always done to the inside
        // of a rectangle.
        var popuprect = document.getElementById("panel").getBoundingClientRect();
        ok(Math.round(popuprect.right) == window.innerWidth ||
           Math.round(popuprect.right) == window.innerWidth - 1,
           "resized to content edge width");
        ok(Math.round(popuprect.bottom) == window.innerHeight ||
           Math.round(popuprect.bottom) == window.innerHeight - 1,
           "resized to content edge height");

        resizerrect = document.getElementById("resizer").getBoundingClientRect();
        synthesizeMouse(document.documentElement, resizerrect.left + 5, resizerrect.top + 5, { type:"mouseup" });
      }
      else {
        // the popup is opened twice. Make sure that for the second time, the
        // resized popup opens in the same direction as there should still be
        // room for it
        var popuprect = document.getElementById("panel").getBoundingClientRect();
        is(Math.round(popuprect.left), window.innerWidth - 130, "reopen popup left");
        is(Math.round(popuprect.top), window.innerHeight - 130, "reopen popup top");
      }

      event.target.hidePopup();
    }

    function doResizerWindowTests() {
      step++;
      if (step == 1) {
        openPopup();
        return;
      }

      if (/Mac/.test(navigator.platform)) {
        window.open("window_resizer.xul", "_blank", "left=200,top=200,outerWidth=300,outerHeight=300,chrome");
      }
      else {
        // Skip window_resizer.xul tests.
        todo(false, "We can't test GTK and Windows native drag resizing implementations.");
        // Run window_resizer_element.xul test only.
        lastResizerTest();
      }
    }

    function lastResizerTest()
    {
      window.open("window_resizer_element.xul", "_blank", "left=200,top=200,outerWidth=300,outerHeight=300,chrome");
    }

    SimpleTest.waitForFocus(openPopup);
   ]]></script>

<panel id="panel" onpopupshown="popupShown(event)" onpopuphidden="doResizerWindowTests()">
  <resizer id="resizer" dir="bottomend" width="16" height="16"/>
  <hbox width="50" height="50" flex="1"/>
</panel>

</window>