widget/tests/window_state_windows.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <?xml version="1.0"?>
     3 <!-- This Source Code Form is subject to the terms of the Mozilla Public
     4    - License, v. 2.0. If a copy of the MPL was not distributed with this
     5    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     7 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     8 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
    10 <window id="NativeWindow"
    11         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    12         width="300"
    13         height="300"
    14         onload="onLoad();"
    15         title="Window State Tests">
    17   <script type="application/javascript"
    18           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    19   <script type="application/javascript">
    20     <![CDATA[
    22     let Cc = Components.classes;
    23     let Ci = Components.interfaces;
    24     let Cu = Components.utils;
    25     Cu.import("resource://gre/modules/XPCOMUtils.jsm");
    27     SimpleTest.waitForExplicitFinish();
    29     function onLoad() {
    30       var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
    31       var win = wm.getMostRecentWindow("navigator:browser");
    33       /*
    34       switch(win.windowState) {
    35         case win.STATE_FULLSCREEN:
    36         dump("STATE_FULLSCREEN \n");
    37         break;
    38         case win.STATE_MAXIMIZED:
    39         dump("STATE_MAXIMIZED \n");
    40         break;
    41         case win.STATE_MINIMIZED:
    42         dump("STATE_MINIMIZED \n");
    43         break;
    44         case win.STATE_NORMAL:
    45         dump("STATE_NORMAL \n");
    46         break;
    47       }
    48       */
    50       // Make sure size mode changes are reflected in the widget.
    51       win.restore();
    52       ok(win.windowState == win.STATE_NORMAL, "window state is restored.");
    53       win.minimize();
    54       ok(win.windowState == win.STATE_MINIMIZED, "window state is minimized.");
    56       // Windows resizes children to 0x0. Code in nsWindow filters these changes out. Without
    57       // this all sorts of screwy things can happen in child widgets.
    58       ok(document.height > 0, "document height should not be zero for a minimized window!");
    59       ok(document.width > 0, "document width should not be zero for a minimized window!");
    61       // Make sure size mode changes are reflected in the widget.
    62       win.restore();
    63       ok(win.windowState == win.STATE_NORMAL, "window state is restored.");
    64       win.maximize();
    65       ok(win.windowState == win.STATE_MAXIMIZED, "window state is maximized.");
    66       win.restore();
    67       ok(win.windowState == win.STATE_NORMAL, "window state is restored.");
    69       /*
    70       dump(win.screenX + "\n");
    71       win.minimize();
    72       dump(win.screenX + "\n");
    73       win.restore();
    74       dump(win.screenX + "\n");
    75       */
    77       SimpleTest.finish();
    78     }
    80   ]]>
    81   </script>
    82   <body xmlns="http://www.w3.org/1999/xhtml">
    83     <p id="display"></p>
    84     <div id="content" style="display: none"></div>
    85     <pre id="test"></pre>
    86   </body>
    87 </window>

mercurial