OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
4 <script> | 4 <script> |
5 var givenScrollTop = 2; // Only one page per event, so this should b e interpreted as 1 | 5 var givenScrollTop = 2; // Only one page per event, so this should b e interpreted as 1 |
6 var givenScrollLeft = 2; | 6 var givenScrollLeft = 2; |
7 var expectedScrollTop = 511; // Window is 800x600. 15 pixel scrollba rs. Scroll 87.5% of visible. | |
8 var expectedScrollLeft = 686; | |
9 var event; | 7 var event; |
10 var div; | 8 var div; |
11 | 9 |
12 window.jsTestIsAsync = true; | 10 window.jsTestIsAsync = true; |
13 if (window.testRunner) | 11 if (window.testRunner) |
14 testRunner.waitUntilDone(); | 12 testRunner.waitUntilDone(); |
15 | 13 |
16 function dispatchWheelEvent() | 14 function dispatchWheelEvent() |
17 { | 15 { |
18 document.body.addEventListener("mousewheel", mousewheelHandler, false); | 16 document.body.addEventListener("mousewheel", mousewheelHandler, false); |
19 | 17 |
20 if (window.eventSender) { | 18 if (window.eventSender) { |
21 eventSender.mouseMoveTo(100, 110); | 19 eventSender.mouseMoveTo(100, 110); |
22 eventSender.continuousMouseScrollBy(-window.givenScrollLeft, -window.givenScrollTop, true); | 20 eventSender.continuousMouseScrollBy(-window.givenScrollLeft, -window.givenScrollTop, true); |
23 } | 21 } |
24 | 22 |
25 setTimeout('checkOffsets();', 100); | 23 setTimeout('checkOffsets();', 100); |
26 } | 24 } |
27 | 25 |
28 function checkOffsets() | 26 function checkOffsets() |
29 { | 27 { |
30 shouldBe("document.scrollingElement.scrollTop", "window.expected ScrollTop"); | 28 debug("document.scrollingElement.scrollTop = " + document.scroll ingElement.scrollTop); |
31 shouldBe("document.scrollingElement.scrollLeft", "window.expecte dScrollLeft"); | 29 debug("document.scrollingElement.scrollLeft = " + document.scrol lingElement.scrollLeft); |
bokan
2015/08/19 12:42:47
The expectation is platform dependent so we don't
Rick Byers
2015/08/19 17:33:30
Why did your CL change that though? Are you inten
bokan
2015/08/19 18:45:46
No, there's no change in the dependency on platfor
Rick Byers
2015/08/19 19:42:09
Sorry, I wrote this before seeing the test changes
| |
32 finishJSTest(); | 30 finishJSTest(); |
33 } | 31 } |
34 | 32 |
35 function mousewheelHandler(e) | 33 function mousewheelHandler(e) |
36 { | 34 { |
37 event = e; | 35 event = e; |
38 shouldBe("event.wheelDeltaY", "window.givenScrollTop * -3"); | 36 shouldBe("event.wheelDeltaY", "window.givenScrollTop * -3"); |
39 shouldBe("event.wheelDeltaX", "window.givenScrollLeft * -3"); | 37 shouldBe("event.wheelDeltaX", "window.givenScrollLeft * -3"); |
40 | 38 |
41 if (e.wheelDeltaY) | 39 if (e.wheelDeltaY) |
42 shouldBe("event.wheelDelta", "window.givenScrollTop * -3"); | 40 shouldBe("event.wheelDelta", "window.givenScrollTop * -3"); |
43 else | 41 else |
44 shouldBe("event.wheelDelta", "window.givenScrollLeft * -3"); | 42 shouldBe("event.wheelDelta", "window.givenScrollLeft * -3"); |
45 } | 43 } |
46 </script> | 44 </script> |
47 </head> | 45 </head> |
48 | 46 |
49 <body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)"> | 47 <body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)"> |
50 <div style="height:900px;width:2400px"> | 48 <div style="height:900px;width:2400px"> |
51 <div style="background-color:red;height:900px;width:1200px;position:re lative;left:0px;top:0px"></div> | 49 <div style="background-color:red;height:900px;width:1200px;position:re lative;left:0px;top:0px"></div> |
52 <div style="background-color:green;height:900px;width:1200px;position: relative;left:1200px;top:-900px"></div> | 50 <div style="background-color:green;height:900px;width:1200px;position: relative;left:1200px;top:-900px"></div> |
53 </div> | 51 </div> |
54 <div style="height:900px;width:2400px"> | 52 <div style="height:900px;width:2400px"> |
55 <div style="background-color:blue;height:900px;width:1200px;position:r elative;left:0px;top:0px"></div> | 53 <div style="background-color:blue;height:900px;width:1200px;position:r elative;left:0px;top:0px"></div> |
56 <div style="background-color:yellow;height:900px;width:1200px;position :relative;left:1200px;top:-900px"></div> | 54 <div style="background-color:yellow;height:900px;width:1200px;position :relative;left:1200px;top:-900px"></div> |
57 </div> | 55 </div> |
58 <div id="console"></div> | 56 <div id="console"></div> |
59 </body> | 57 </body> |
60 </html> | 58 </html> |
OLD | NEW |