Use testRunner instead of layoutTestController in fast/doctypes, dom, dynamic, encodi...
[WebKit-https.git] / LayoutTests / fast / events / platform-wheelevent-paging-y-in-non-scrolling-div.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 pixelsPerWheelTick = 40;
11             var event;
12             var div;
13
14             if (window.testRunner)
15                 testRunner.waitUntilDone();
16
17             function dispatchWheelEvent()
18             {
19                 var overflowElement = document.getElementById("overflow");
20                 if (overflowElement)
21                     overflowElement.addEventListener("mousewheel", mousewheelHandler, false);
22
23                 if (window.eventSender) {
24                     eventSender.mouseMoveTo(100, 110);
25                     eventSender.continuousMouseScrollBy(-window.givenScrollLeft, -window.givenScrollTop, true);
26                 }
27
28                 setTimeout('checkOffsets();', 100);
29             }
30
31             function checkOffsets()
32             {
33                 div = document.getElementById("overflow");
34                 shouldBe("div.scrollTop", "window.expectedScrollTop");
35                 shouldBe("div.scrollLeft", "window.expectedScrollLeft");
36
37                 if (window.testRunner)
38                     window.testRunner.notifyDone();
39             }
40
41             function mousewheelHandler(e)
42             {
43                 event = e;
44                 shouldBe("event.wheelDeltaY", "window.givenScrollTop*-3");
45                 shouldBe("event.wheelDeltaX", "0");
46
47                 if (e.wheelDeltaY)
48                     shouldBe("event.wheelDelta", "window.givenScrollTop*-3");
49                 else
50                     shouldBe("event.wheelDelta", "0");
51             }
52         </script>
53     </head>
54
55     <body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)">
56         <div id="overflow" style="border:2px solid black;overflow:auto;white-space:nowrap;height:200px;width:200px;">
57         <div style="height:185px;width:600px;">
58           <div style="border:0px;background-color:red;height:181px;width:300px;display:inline-block;"></div>
59           <div style="border:0px;background-color:green;height:181px;width:300px;display:inline-block;"></div>
60         </div>
61         </div>
62         <div id="console"></div>
63     </body>
64 </html>