8 if (window
.testRunner
) {
9 testRunner
.dumpAsText();
10 testRunner
.setCanOpenWindows();
11 testRunner
.waitUntilDone();
16 var console
= document
.getElementById("console");
17 console
.appendChild(document
.createTextNode(message
+ "\n"));
20 function click(newwindow
, image
)
22 var e
= newwindow
.document
.createEvent("MouseEvent");
23 e
.initMouseEvent("click", true, true, newwindow
, 1, 1, 1, 1, 1, false, false, false, false, 0, newwindow
.document
);
24 image
.dispatchEvent(e
);
27 window
.onload = function()
29 var newwindow
= window
.open("resources/flowchart.jpg");
30 if (window
.testRunner
)
31 testRunner
.useUnfortunateSynchronousResizeMode();
32 newwindow
.onload = function() {
34 newwindow
.onresize = function() {
35 var image
= newwindow
.document
.querySelector("img");
36 if (image
.clientWidth
== 0) {
37 // On GTK+, sometimes the resize callback fires before the GTK
38 // window has finished resizing. If that happens, try to resize
40 requestId
= newWindow
.requestAnimationFrame(function() {
41 newwindow
.resizeTo(100, 100);
43 newwindow
.cancelAnimationFrame(requestId
);
49 if (window
.eventSender
) {
52 eventSender
.zoomPageIn();
53 var w
= Math
.round(image
.clientWidth
);
54 var h
= Math
.round(image
.clientHeight
);
55 log("Size at zoomed in level : " + w
+ " x " + h
);
58 click(newwindow
, image
);
60 var w
= Math
.round(image
.clientWidth
);
61 var h
= Math
.round(image
.clientHeight
);
62 log("Size at zoomed level after scale up click " + count
+ " : " + w
+ " x " + h
);
64 testRunner
.notifyDone();
66 // Restore the image size
67 click(newwindow
, image
);
69 // Brings to normal zoom
70 eventSender
.zoomPageOut();
72 eventSender
.zoomPageOut();
73 // Restore the image size
74 var w
= Math
.round(image
.clientWidth
);
75 var h
= Math
.round(image
.clientHeight
);
76 log("Size at zoomed out level after click " + count
+ " (Image restored): " + w
+ " x " + h
);
78 click(newwindow
, image
);
83 newwindow
.resizeTo(100, 100);
87 <p>This tests that on a zoomed page, click to scale up / down works fine. This test requires testRunner to run. To test manually, open
<a href=
"resources/dice.png">this image
</a> in a browser window, resize the window to
100px tall and zoom out and click on the image to scale it up.
</p>
88 <pre id=
"console"></pre>