OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <script src="../../../resources/js-test.js"></script> | 2 <script src="../../../resources/js-test.js"></script> |
3 <style type="text/css"> | 3 <style type="text/css"> |
4 body { | 4 body { |
5 height: 2000px; | 5 height: 2000px; |
6 width: 2000px; | 6 width: 2000px; |
7 } | 7 } |
8 </style> | 8 </style> |
9 | 9 |
10 <script> | 10 <script> |
11 window.jsTestIsAsync = true; | 11 window.jsTestIsAsync = true; |
12 var dpr = window.devicePixelRatio; | |
13 | 12 |
14 description("This test ensures that mouse wheel ticks scrolls the right numb
er of pixels in high dpi mode."); | 13 description("This test ensures that mouse wheel ticks scrolls the right numb
er of pixels in high dpi mode."); |
15 | 14 |
16 function testDiagonalScroll() { | 15 function testDiagonalScroll() { |
17 // Reset | 16 // Reset |
18 document.scrollingElement.scrollTop = 0; | 17 document.scrollingElement.scrollTop = 0; |
19 document.scrollingElement.scrollLeft = 0; | 18 document.scrollingElement.scrollLeft = 0; |
20 | 19 |
21 eventSender.mouseMoveTo(20, 20); | 20 eventSender.mouseMoveTo(20, 20); |
22 // 1 tick should move 40px. | 21 // 1 tick should move 40px. |
23 eventSender.mouseScrollBy(-2 * dpr, -2 * dpr); | 22 eventSender.mouseScrollBy(-2, -2); |
24 | 23 |
25 shouldBecomeEqual("document.scrollingElement.scrollTop == 80 && " + | 24 shouldBecomeEqual("document.scrollingElement.scrollTop == 80 && " + |
26 "document.scrollingElement.scrollLeft == 80", "true", finishJSTest); | 25 "document.scrollingElement.scrollLeft == 80", "true", finishJSTest); |
27 } | 26 } |
28 | 27 |
29 function runTest() { | 28 function runTest() { |
30 if (!window.eventSender || !window.internals) { | 29 if (!window.eventSender || !window.internals) { |
31 debug("This test requires window.eventSender and window.internals."); | 30 debug("This test requires window.eventSender and window.internals."); |
32 finishJSTest(); | 31 finishJSTest(); |
33 return; | 32 return; |
34 } | 33 } |
35 | 34 |
36 // Turn on smooth scrolling. | 35 // Turn on smooth scrolling. |
37 internals.settings.setScrollAnimatorEnabled(true); | 36 internals.settings.setScrollAnimatorEnabled(true); |
38 | 37 |
39 eventSender.mouseMoveTo(20, 20); | 38 eventSender.mouseMoveTo(20, 20); |
40 // 1 tick should move 40px. | 39 // 1 tick should move 40px. |
41 eventSender.mouseScrollBy(-dpr, -dpr); | 40 eventSender.mouseScrollBy(-1, -1); |
42 | 41 |
43 // 40px per tick. | 42 // 40px per tick. |
44 shouldBecomeEqual("document.scrollingElement.scrollTop == 40 && " + | 43 shouldBecomeEqual("document.scrollingElement.scrollTop == 40 && " + |
45 "document.scrollingElement.scrollLeft == 40", "true", testDiagonalScro
ll); | 44 "document.scrollingElement.scrollLeft == 40", "true", testDiagonalScro
ll); |
46 } | 45 } |
47 </script> | 46 </script> |
48 | 47 |
49 <body onload="runTest()"></body> | 48 <body onload="runTest()"></body> |
OLD | NEW |