Change fast/e* files to use pre and post js files in LayoutTests/resources.
[WebKit-https.git] / LayoutTests / fast / events / platform-wheelevent-paging-x-in-non-scrolling-div.html
1 <html>
2     <head>
3         <link rel="stylesheet" href="../js/resources/js-test-style.css">
4         <script src="../../resources/js-test-pre.js"></script>
5         <script>
6             var givenScrollTop = 0;
7             var givenScrollLeft = 2;
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                 var overflowElement = document.getElementById("overflow");
19                 if (overflowElement)
20                     overflowElement.addEventListener("mousewheel", mousewheelHandler, false);
21
22                 if (window.eventSender) {
23                     eventSender.mouseMoveTo(100, 110);
24                     eventSender.continuousMouseScrollBy(-window.givenScrollLeft, -window.givenScrollTop, true);
25                 }
26
27                 setTimeout('checkOffsets();', 100);
28             }
29
30             function checkOffsets()
31             {
32                 div = document.getElementById("overflow");
33                 shouldBe("div.scrollTop", "window.expectedScrollTop");
34                 shouldBe("div.scrollLeft", "window.expectedScrollLeft");
35
36                 if (window.testRunner)
37                     window.testRunner.notifyDone();
38             }
39
40             function mousewheelHandler(e)
41             {
42                 event = e;
43                 shouldBe("event.wheelDeltaY", "0");
44                 shouldBe("event.wheelDeltaX", "window.givenScrollLeft*-3");
45
46                 if (e.wheelDeltaY)
47                     shouldBe("event.wheelDelta", "0");
48                 else
49                     shouldBe("event.wheelDelta", "window.givenScrollLeft*-3");
50             }
51         </script>
52     </head>
53
54     <body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)">
55         <div id="overflow" style="border:2px solid black;overflow:auto;height:200px;width:200px;">
56           <div style="border:0px;background-color:red;height:300px;width:185px;"></div>
57           <div style="border:0px;background-color:green;height:300px;width:185px;"></div>
58         </div>
59         <div id="console"></div>
60     </body>
61 </html>