2 <?xml-stylesheet href=
"chrome://global/skin" type=
"text/css"?>
3 <?xml-stylesheet href=
"chrome://mochikit/content/tests/SimpleTest/test.css" type=
"text/css"?>
7 <window title=
"XUL Panel sizeTo tests"
8 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
10 <script src=
"chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
12 <!-- test results are displayed in the html:body -->
13 <body xmlns=
"http://www.w3.org/1999/xhtml">
16 <!-- test code goes here -->
17 <script type=
"application/javascript"><![CDATA[
18 SimpleTest.waitForExplicitFinish();
22 document.getElementById(
"panel").
23 openPopupAtScreen(Math.round(window.mozInnerScreenX) + window.innerWidth -
130,
24 Math.round(window.mozInnerScreenY) + window.innerHeight -
130);
27 function sizeAndCheck(width, height) {
28 var panel = document.getElementById(
"panel");
29 panel.sizeTo(width, height);
30 is(panel.getBoundingClientRect().width, width,
"width is correct");
31 is(panel.getBoundingClientRect().height, height,
"height is correct");
34 function popupShown(event)
36 var panel = document.getElementById(
"panel");
37 var bcr = panel.getBoundingClientRect();
38 // resize to
10px bigger in both dimensions.
39 sizeAndCheck(bcr.width+
10, bcr.height+
10);
40 // Same width, different height (based on *new* size from last sizeAndCheck)
41 sizeAndCheck(bcr.width+
10, bcr.height);
42 // Same height, different width (also based on *new* size from last sizeAndCheck)
43 sizeAndCheck(bcr.width, bcr.height);
44 event.target.hidePopup();
47 SimpleTest.waitForFocus(openPopup);
50 <panel id=
"panel" onpopupshown=
"popupShown(event)" onpopuphidden=
"SimpleTest.finish()">
51 <resizer id=
"resizer" dir=
"bottomend" width=
"16" height=
"16"/>
52 <hbox width=
"50" height=
"50" flex=
"1"/>