OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <link rel="stylesheet" href="../js/resources/js-test-style.css"> | 3 <link rel="stylesheet" href="../js/resources/js-test-style.css"> |
4 <script src="../js/resources/js-test-pre.js"></script> | 4 <script src="../js/resources/js-test-pre.js"></script> |
5 <script> | 5 <script> |
6 var givenScrollTop = 2; // Only page is scrolled per event, regardle
ss of this number. | 6 var givenScrollTop = 2; // Only page is scrolled per event, regardle
ss of this number. |
7 var givenScrollLeft = 0; | 7 var givenScrollLeft = 0; |
8 var expectedScrollTop = 525; // Window is 800x600. Scroll 87.5% of v
isible. | 8 var expectedScrollTop = 525; // Window is 800x600. Scroll 87.5% of v
isible. |
9 var expectedScrollLeft = 0; | 9 var expectedScrollLeft = 0; |
10 var event; | 10 var event; |
11 var div; | 11 var div; |
12 | 12 |
| 13 window.jsTestIsAsync = true; |
13 if (window.testRunner) | 14 if (window.testRunner) |
14 testRunner.waitUntilDone(); | 15 testRunner.waitUntilDone(); |
15 | 16 |
16 function dispatchWheelEvent() | 17 function dispatchWheelEvent() |
17 { | 18 { |
18 document.body.addEventListener("mousewheel", mousewheelHandler,
false); | 19 document.body.addEventListener("mousewheel", mousewheelHandler,
false); |
19 | 20 |
20 if (window.eventSender) { | 21 if (window.eventSender) { |
21 eventSender.mouseMoveTo(100, 110); | 22 eventSender.mouseMoveTo(100, 110); |
22 eventSender.continuousMouseScrollBy(-window.givenScrollLeft,
-window.givenScrollTop, true); | 23 eventSender.continuousMouseScrollBy(-window.givenScrollLeft,
-window.givenScrollTop, true); |
23 } | 24 } |
24 | 25 |
25 setTimeout('checkOffsets();', 100); | 26 setTimeout('checkOffsets();', 100); |
26 } | 27 } |
27 | 28 |
28 function checkOffsets() | 29 function checkOffsets() |
29 { | 30 { |
30 shouldBe("document.body.scrollTop", "window.expectedScrollTop"); | 31 shouldBe("document.body.scrollTop", "window.expectedScrollTop"); |
31 shouldBe("document.body.scrollLeft", "window.expectedScrollLeft"
); | 32 shouldBe("document.body.scrollLeft", "window.expectedScrollLeft"
); |
32 | 33 finishJSTest(); |
33 if (window.testRunner) | |
34 window.testRunner.notifyDone(); | |
35 } | 34 } |
36 | 35 |
37 function mousewheelHandler(e) | 36 function mousewheelHandler(e) |
38 { | 37 { |
39 event = e; | 38 event = e; |
40 shouldBe("event.wheelDeltaY", "window.givenScrollTop * -3"); | 39 shouldBe("event.wheelDeltaY", "window.givenScrollTop * -3"); |
41 shouldBe("event.wheelDeltaX", "0"); | 40 shouldBe("event.wheelDeltaX", "0"); |
42 | 41 |
43 if (e.wheelDeltaY) | 42 if (e.wheelDeltaY) |
44 shouldBe("event.wheelDelta", "window.givenScrollTop * -3"); | 43 shouldBe("event.wheelDelta", "window.givenScrollTop * -3"); |
45 else | 44 else |
46 shouldBe("event.wheelDelta", "0"); | 45 shouldBe("event.wheelDelta", "0"); |
47 } | 46 } |
48 </script> | 47 </script> |
49 </head> | 48 </head> |
50 | 49 |
51 <body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)"> | 50 <body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)"> |
52 <div style="height:900px;width:400px"> | 51 <div style="height:900px;width:400px"> |
53 <div style="background-color:red;height:900px;width:200px;position:rel
ative;left:0px;top:0px"></div> | 52 <div style="background-color:red;height:900px;width:200px;position:rel
ative;left:0px;top:0px"></div> |
54 <div style="background-color:green;height:900px;width:200px;position:r
elative;left:200px;top:-900px"></div> | 53 <div style="background-color:green;height:900px;width:200px;position:r
elative;left:200px;top:-900px"></div> |
55 </div> | 54 </div> |
56 <div style="height:900px;width:400px"> | 55 <div style="height:900px;width:400px"> |
57 <div style="background-color:blue;height:900px;width:200px;position:re
lative;left:0px;top:0px"></div> | 56 <div style="background-color:blue;height:900px;width:200px;position:re
lative;left:0px;top:0px"></div> |
58 <div style="background-color:yellow;height:900px;width:200px;position:
relative;left:200px;top:-900px"></div> | 57 <div style="background-color:yellow;height:900px;width:200px;position:
relative;left:200px;top:-900px"></div> |
59 </div> | 58 </div> |
60 <div id="console"></div> | 59 <div id="console"></div> |
61 </body> | 60 </body> |
62 </html> | 61 </html> |
OLD | NEW |