widget/tests/window_bug522217.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/tests/window_bug522217.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,72 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<window title="Mozilla Bug 522217"
     1.7 +  onload="start();"
     1.8 +  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     1.9 +
    1.10 +  <script type="application/javascript"
    1.11 +          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js" />
    1.12 +
    1.13 +<body xmlns="http://www.w3.org/1999/xhtml" id="body">
    1.14 +</body>
    1.15 +
    1.16 +<script class="testbody" type="application/javascript">
    1.17 +<![CDATA[
    1.18 +
    1.19 +function ok(aCondition, aMessage)
    1.20 +{
    1.21 +  window.opener.wrappedJSObject.SimpleTest.ok(aCondition, aMessage);
    1.22 +}
    1.23 +
    1.24 +function is(aLeft, aRight, aMessage)
    1.25 +{
    1.26 +  window.opener.wrappedJSObject.SimpleTest.is(aLeft, aRight, aMessage);
    1.27 +}
    1.28 +
    1.29 +function isnot(aLeft, aRight, aMessage)
    1.30 +{
    1.31 +  window.opener.wrappedJSObject.SimpleTest.isnot(aLeft, aRight, aMessage);
    1.32 +}
    1.33 +
    1.34 +function executeSoon(aFct)
    1.35 +{
    1.36 +  window.opener.wrappedJSObject.SimpleTest.executeSoon(aFct);
    1.37 +}
    1.38 +
    1.39 +function start() {
    1.40 +  window.onfocus = function () {
    1.41 +    window.onfocus = null;
    1.42 +    var oldOuterWidth = window.outerWidth, oldOuterHeight = window.outerHeight;
    1.43 +    var oldInnerWidth = window.innerWidth, oldInnerHeight = window.innerHeight;
    1.44 +    document.documentElement.setAttribute("drawintitlebar", "true");
    1.45 +
    1.46 +    executeSoon(function() {
    1.47 +      is(window.outerWidth, oldOuterWidth, "drawintitlebar shouldn't change the window's outerWidth");
    1.48 +      is(window.outerHeight, oldOuterHeight, "drawintitlebar shouldn't change the window's outerHeight");
    1.49 +      is(window.innerWidth, oldOuterWidth, "if drawintitlebar is set, innerWidth and outerWidth should be the same");
    1.50 +      is(window.innerHeight, oldOuterHeight, "if drawintitlebar is set, innerHeight and outerHeight should be the same");
    1.51 +      window.fullScreen = true;
    1.52 +      window.fullScreen = false;
    1.53 +      is(window.outerWidth, oldOuterWidth, "wrong outerWidth after fullscreen mode");
    1.54 +      is(window.outerHeight, oldOuterHeight, "wrong outerHeight after fullscreen mode");
    1.55 +      is(window.innerWidth, oldOuterWidth, "wrong innerWidth after fullscreen mode");
    1.56 +      is(window.innerHeight, oldOuterHeight, "wrong innerHeight after fullscreen mode");
    1.57 +      document.documentElement.removeAttribute("drawintitlebar");
    1.58 +
    1.59 +      executeSoon(function() {
    1.60 +        is(window.outerWidth, oldOuterWidth, "wrong outerWidth after removing drawintitlebar");
    1.61 +        is(window.outerHeight, oldOuterHeight, "wrong outerHeight after removing drawintitlebar");
    1.62 +        is(window.innerWidth, oldInnerWidth, "wrong innerWidth after removing drawintitlebar");
    1.63 +        is(window.innerHeight, oldInnerHeight, "wrong innerHeight after removing drawintitlebar");
    1.64 +        window.opener.wrappedJSObject.SimpleTest.finish();
    1.65 +        window.close();
    1.66 +      });
    1.67 +    });
    1.68 +  }
    1.69 +}
    1.70 +
    1.71 +
    1.72 +]]>
    1.73 +</script>
    1.74 +
    1.75 +</window>

mercurial