blob: 58f2891bc17085c9d48ddcafb27ccb06770a7759 [file] [log] [blame]
enrica@apple.com13780da2010-03-15 20:31:04 +00001<html>
2 <head>
mark.lam@apple.com436bf822013-09-07 23:07:25 +00003 <script src="../../resources/js-test-pre.js"></script>
enrica@apple.com13780da2010-03-15 20:31:04 +00004 <script>
5 var expectedScrollTop = 200;
6 var expectedScrollLeft = 100;
7 var event;
8 var div;
9
rniwa@webkit.orgada3c202012-06-20 03:28:42 +000010 if (window.testRunner) {
11 testRunner.waitUntilDone();
enrica@apple.com13780da2010-03-15 20:31:04 +000012 }
13
14 function dispatchWheelEvent()
15 {
16 var overflowElement = document.getElementById("overflow");
17 if (overflowElement)
18 overflowElement.addEventListener("mousewheel", mousewheelHandler, false);
19
20 if (window.eventSender) {
21 eventSender.mouseMoveTo(100, 110);
22 eventSender.continuousMouseScrollBy(-window.expectedScrollLeft, -window.expectedScrollTop);
23 }
24
25 setTimeout('checkOffsets();', 100);
26 }
27
28 function checkOffsets()
29 {
30 div = document.getElementById("overflow");
31 shouldBe("div.scrollTop", "window.expectedScrollTop");
32 shouldBe("div.scrollLeft", "window.expectedScrollLeft");
33
rniwa@webkit.orgada3c202012-06-20 03:28:42 +000034 if (window.testRunner)
35 window.testRunner.notifyDone();
enrica@apple.com13780da2010-03-15 20:31:04 +000036 }
37
38 function mousewheelHandler(e)
39 {
40 event = e;
commit-queue@webkit.org10fad572010-09-06 06:50:21 +000041 shouldBe("event.wheelDeltaY", "window.expectedScrollTop*-3");
42 shouldBe("event.wheelDeltaX", "window.expectedScrollLeft*-3");
enrica@apple.com13780da2010-03-15 20:31:04 +000043
44 if (e.wheelDeltaY)
commit-queue@webkit.org10fad572010-09-06 06:50:21 +000045 shouldBe("event.wheelDelta", "window.expectedScrollTop*-3");
enrica@apple.com13780da2010-03-15 20:31:04 +000046 else
commit-queue@webkit.org10fad572010-09-06 06:50:21 +000047 shouldBe("event.wheelDelta", "window.expectedScrollLeft*-3");
enrica@apple.com13780da2010-03-15 20:31:04 +000048 }
49 </script>
50 </head>
51
52 <body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)">
53 <div id="overflow" style="border:2px solid black;overflow:auto;height:200px;width:200px;">
54 <div style="background-color:red;height:200px;width:400px;"></div>
55 <div style="background-color:green;height:200px;width:400px;"></div>
56 <div style="background-color:red;height:200px;width:400px;"></div>
57 </div>
58 <div id="console"></div>
59 </body>
60</html>