8836679d3554d78451dd3bc79886703e5ae75ae7
[WebKit-https.git] / LayoutTests / fast / events / platform-wheelevent-paging-y-in-non-scrolling-page.html
1 <html>
2     <head>
3         <link rel="stylesheet" href="../js/resources/js-test-style.css">
4         <script src="../js/resources/js-test-pre.js"></script>
5         <script>
6             var givenScrollTop = 2;
7             var givenScrollLeft = 0;
8             var expectedScrollTop = 0;
9             var expectedScrollLeft = 0;
10             var event;
11             var div;
12
13             if (window.testRunner)
14                 testRunner.waitUntilDone();
15
16             function dispatchWheelEvent()
17             {
18                 document.body.addEventListener("mousewheel", mousewheelHandler, false);
19
20                 if (window.eventSender) {
21                     eventSender.mouseMoveTo(100, 110);
22                     eventSender.continuousMouseScrollBy(-window.givenScrollLeft, -window.givenScrollTop, true);
23                 }
24
25                 setTimeout('checkOffsets();', 100);
26             }
27
28             function checkOffsets()
29             {
30                 shouldBe("document.body.scrollTop", "window.expectedScrollTop");
31                 shouldBe("document.body.scrollLeft", "window.expectedScrollLeft");
32
33                 if (window.testRunner)
34                     window.testRunner.notifyDone();
35             }
36
37             function mousewheelHandler(e)
38             {
39                                 event = e;
40                                 shouldBe("event.wheelDeltaY", "window.givenScrollTop * -3");
41                                 shouldBe("event.wheelDeltaX", "0");
42
43                                 if (e.wheelDeltaY)
44                                         shouldBe("event.wheelDelta", "window.givenScrollTop * -3");
45                                 else
46                                         shouldBe("event.wheelDelta", "0");
47             }
48         </script>
49     </head>
50
51     <body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)">
52         <div style="height:200px;width:2400px">
53           <div style="background-color:red;height:200px;width:1200px;position:relative;left:0px;top:0px"></div>
54           <div style="background-color:green;height:200px;width:1200px;position:relative;left:1200px;top:-200px"></div>
55         </div>
56         <div style="height:200px;width:2400px">
57           <div style="background-color:blue;height:200px;width:1200px;position:relative;left:0px;top:0px"></div>
58           <div style="background-color:yellow;height:200px;width:1200px;position:relative;left:1200px;top:-200px"></div>
59         </div>
60         <div id="console"></div>
61     </body>
62 </html>