1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../../resources/js-test.js"></script>
7 <script language=
"JavaScript" type=
"text/javascript">
20 window
.moveTo(screen
.availLeft
+ 100, screen
.availTop
+ 100);
21 window
.resizeTo(300, 200);
22 resetWidth
= window
.outerWidth
;
23 resetHeight
= window
.outerHeight
;
24 resetX
= window
.screenX
;
25 resetY
= window
.screenY
;
28 if (window
.testRunner
)
29 testRunner
.dumpAsText();
33 description("This test makes sure that calling the window moving and resizing\
34 methods with less than 2 arguments treats the missing arguments as 0.");
36 // resizeTo /////////////////////////
38 debug('window.resizeTo Tests');
41 debug("Testing - resizeTo with 0 arguments");
42 shouldThrow('window.resizeTo()');
43 shouldBe('window.outerWidth', 'resetWidth');
44 shouldBe('window.outerHeight', 'resetHeight');
47 debug("Testing - resizeTo with 1 argument");
48 shouldThrow('window.resizeTo(width)');
49 shouldBe('window.outerWidth', 'resetWidth');
50 shouldBe('window.outerHeight', 'resetHeight');
53 debug("Testing - resizeTo with more than 2 arguments");
54 window
.resizeTo(width
, height
, 200, "text");
55 shouldBe('window.outerWidth', 'width');
56 shouldBe('window.outerHeight', 'height');
59 // resizeBy /////////////////////////
61 debug('window.resizeBy Tests');
64 debug("Testing - resizeBy with 0 arguments");
65 shouldThrow('window.resizeBy()');
66 shouldBe('window.outerWidth', 'resetWidth');
67 shouldBe('window.outerHeight', 'resetHeight');
70 debug("Testing - resizeBy with 1 argument");
71 shouldThrow('window.resizeBy(x)');
72 shouldBe('window.outerWidth', 'resetWidth');
73 shouldBe('window.outerHeight', 'resetHeight');
76 debug("Testing - resizeBy with more than 2 arguments");
77 window
.resizeBy(x
, y
, 200, "text");
78 shouldBe('window.outerWidth', 'resetWidth + x');
79 shouldBe('window.outerHeight', 'resetHeight + y');
83 // moveTo /////////////////////////
85 debug('window.moveTo Tests');
88 debug("Testing - moveTo with 0 arguments");
89 shouldThrow('window.moveTo()');
90 shouldBe('window.screenX', 'resetX');
91 shouldBe('window.screenY', 'resetY');
94 debug("Testing - moveTo with 1 argument");
95 shouldThrow('window.moveTo(x)');
96 shouldBe('window.screenX', 'resetX');
97 shouldBe('window.screenY', 'resetY');
100 debug("Testing - moveTo with more than 2 arguments");
101 window
.moveTo(x
, y
, 200, "text");
102 shouldBe('window.screenX', 'Math.max(x, screen.availLeft)');
103 shouldBe('window.screenY', 'Math.max(y, screen.availTop)');
108 // moveBy /////////////////////////
110 debug('window.moveBy Tests');
113 debug("Testing - moveBy with 0 arguments");
114 shouldThrow('window.moveBy()');
115 shouldBe('window.screenX', 'resetX');
116 shouldBe('window.screenY', 'resetY');
119 debug("Testing - moveBy with 1 argument");
120 shouldThrow('window.moveBy(x)');
121 shouldBe('window.screenX', 'resetX');
122 shouldBe('window.screenY', 'resetY');
125 debug("Testing - moveBy with more than 2 arguments");
126 window
.moveBy(x
, y
, 200, "text");
127 shouldBe('window.screenX', 'resetX + x');
128 shouldBe('window.screenY', 'resetY + y');