Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/mousewheel-scroll.html

Issue 1547003002: Fix error in determining the target position for smooth scroll animation curve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add test Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script> 2 <script src="../../../resources/js-test.js"></script>
3 <style> 3 <style>
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 12
13 description("This test ensures that consecutive mouse wheel ticks scroll\ 13 description("This test ensures that consecutive mouse wheel ticks scroll\
14 to the right offset. The main purpose of this test is to ensure that\ 14 to the right offset. The main purpose of this test is to ensure that\
15 smooth scrolling on the compositor works as intended (tested via\ 15 smooth scrolling on the compositor works as intended (tested via\
16 virtual suite virtual/threaded/)."); 16 virtual suite virtual/threaded/).");
17 17
18 function testDiagonalScroll() {
19 // Reset
20 document.scrollingElement.scrollTop = 0;
21 document.scrollingElement.scrollLeft = 0;
22
23 eventSender.mouseMoveTo(20, 20);
24 // Scroll 3 ticks diagonally.
25 eventSender.mouseScrollBy(-3, -3);
26 // Undo 1 tick in each direction.
27 eventSender.mouseScrollBy(1, 1);
28 // 40px per tick.
29 shouldBecomeEqual("document.scrollingElement.scrollTop == 80 && " +
Rick Byers 2015/12/23 19:13:33 Should this perhaps use different expected scroll
ymalik 2015/12/23 19:20:37 Done.
30 "document.scrollingElement.scrollLeft == 80", "true", finishJSTest);
31 }
32
18 function runTest() { 33 function runTest() {
19 if (!window.eventSender || !window.internals) { 34 if (!window.eventSender || !window.internals) {
20 finishJSTest(); 35 finishJSTest();
21 return; 36 return;
22 } 37 }
23 38
24 // Turn on smooth scrolling. 39 // Turn on smooth scrolling.
25 internals.settings.setScrollAnimatorEnabled(true); 40 internals.settings.setScrollAnimatorEnabled(true);
26 41
27 eventSender.mouseMoveTo(20, 20); 42 eventSender.mouseMoveTo(20, 20);
28 // Scroll down 3 ticks. 43 // Scroll down 3 ticks.
29 eventSender.mouseScrollBy(0, -1); 44 eventSender.mouseScrollBy(0, -1);
30 eventSender.mouseScrollBy(0, -1); 45 eventSender.mouseScrollBy(0, -2);
31 eventSender.mouseScrollBy(0, -1);
32 // Scroll right 3 ticks. 46 // Scroll right 3 ticks.
33 eventSender.mouseScrollBy(-1, 0); 47 eventSender.mouseScrollBy(-1, 0);
34 eventSender.mouseScrollBy(-1, 0); 48 eventSender.mouseScrollBy(-2, 0);
35 eventSender.mouseScrollBy(-1, 0);
36 // Undo 1 tick in each direction. 49 // Undo 1 tick in each direction.
37 eventSender.mouseScrollBy(0, 1); 50 eventSender.mouseScrollBy(0, 1);
38 eventSender.mouseScrollBy(1, 0); 51 eventSender.mouseScrollBy(1, 0);
39 52
40 // 40px per tick. 53 // 40px per tick.
41 shouldBecomeEqual("document.scrollingElement.scrollTop == 80 && " + 54 shouldBecomeEqual("document.scrollingElement.scrollTop == 80 && " +
42 "document.scrollingElement.scrollLeft == 80", "true", finishJSTest); 55 "document.scrollingElement.scrollLeft == 80", "true", testDiagonalScro ll);
43 } 56 }
44 </script> 57 </script>
45 58
46 <body onload="runTest()"></body> 59 <body onload="runTest()"></body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698