widget/tests/window_state_windows.xul

branch
TOR_BUG_9701
changeset 10
ac0c01689b40
equal deleted inserted replaced
-1:000000000000 0:06ff48935bdc
1 <?xml version="1.0"?>
2
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/. -->
6
7 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
8 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
9
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">
16
17 <script type="application/javascript"
18 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
19 <script type="application/javascript">
20 <![CDATA[
21
22 let Cc = Components.classes;
23 let Ci = Components.interfaces;
24 let Cu = Components.utils;
25 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
26
27 SimpleTest.waitForExplicitFinish();
28
29 function onLoad() {
30 var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
31 var win = wm.getMostRecentWindow("navigator:browser");
32
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 */
49
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.");
55
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!");
60
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.");
68
69 /*
70 dump(win.screenX + "\n");
71 win.minimize();
72 dump(win.screenX + "\n");
73 win.restore();
74 dump(win.screenX + "\n");
75 */
76
77 SimpleTest.finish();
78 }
79
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