5 function Open(sFeatures)
10 w = window.open("resources/popup200x200.html", "popup", sFeatures);
16 Open("width=200, height=200, left = 0, top = 0, scrollbars, resizable");
18 setConsole(document.getElementById('console1'));
20 shouldBe("w.innerHeight", 200);
21 shouldBe("w.innerWidth", 200);
22 shouldBe("w.outerWidth", 200);
23 shouldBe("w.screenLeft", 0);
24 shouldBe("w.screenTop", 22); // empirical result of low dpi testing
25 shouldBe("w.outerHeight", 223); // empirical result of low dpi testing
30 console = document.getElementById('console2');
31 Open("width=200, height=200, left = 0, top = 0, scrollbars, menubar, status, toolbar, resizable");
33 setConsole(document.getElementById('console2'));
35 shouldBe("w.innerHeight", 200);
36 shouldBe("w.innerWidth", 200);
37 shouldBe("w.outerWidth", 200);
38 shouldBe("w.screenLeft", 0);
39 shouldBe("w.screenTop", 22); // empirical result of low dpi testing
40 shouldBe("w.outerHeight", 313); // empirical result of low dpi testing
45 Open("width=200,height=200,left=" + (screen.width - 200) + ",screenY=0, resizable");
46 w.moveBy(0, screen.height - w.screenTop - w.outerHeight);
49 w.moveTo(w.screenLeft - 100, w.screenTop + 100);
51 w.resizeTo(w.outerWidth - 100 , w.outerHeight - 100);
54 setConsole(document.getElementById('console3'));
56 shouldBe("w.innerHeight", 200);
57 shouldBe("w.innerWidth", 200);
58 shouldBe("w.outerWidth", 200);
59 shouldBe("w.screenLeft", screen.width - 200);
60 shouldBe("w.screenTop", screen.height - w.outerHeight);
61 shouldBe("w.outerHeight", 223); // empirical result of low dpi testing
65 function print(message, color)
67 var paragraph = document.createElement("div");
68 paragraph.appendChild(document.createTextNode(message));
69 paragraph.style.fontFamily = "monospace";
71 paragraph.style.color = color;
72 console.appendChild(paragraph);
75 function clearConsole()
77 console.innerHTML = "";
80 function setConsole(c)
85 function shouldBe(a, b)
89 print("PASS: " + a + " should be " + b + " and is.", "green");
91 print("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".", "red");
97 <p>This test checks our support for window sizing and positioning.</p>
98 <p>To test: Click each button below. Check to make sure that the window it opens has the specified attributes.
99 Also check for a series of 'PASS' messages below the button.</p>
100 <p style="color:red">NOTE: Make sure to test at magnified resolutions.</p>
101 <p>To test @ 2X resolution:</p>
103 <li>Open Quartz Debug (/Developer/Applications/Performance Tools).</li>
104 <li>Select Tools -> Show User Interface Resolution.</li>
105 <li>Set the resolution to 2.0.</li>
106 <li>Restart Safari.</li>
110 <p>Window size (no toolbars): You should see a red 1 pixel border along every edge of this page, and no scrollbars.</p>
111 <input type="button" value="open it!" onclick="test1()">
112 <div id='console1'></div>
115 <p>Window size (all toolbars): You should see a red 1 pixel border along every edge of this page, and no scrollbars.</p>
116 <input type="button" value="open it!" onclick="test2()">
117 <div id='console2'></div>
120 <p>Window positioning: This window should be aligned exactly to the bottom right corner of the screen.</p>
121 <input type="button" value="open it!" onclick="test3()">
122 <div id='console3'></div>