Title: [285498] trunk/LayoutTests
Revision
285498
Author
simon.fra...@apple.com
Date
2021-11-09 07:25:39 -0800 (Tue, 09 Nov 2021)

Log Message

Convert more wheel event tests to UIHelper.mouseWheelSequence()
https://bugs.webkit.org/show_bug.cgi?id=232847

Reviewed by Wenson Hsieh.

Add an options parameter to mouseWheelSequence() so we can have a version that doens't
wait.

Some tests need to have minor position changes to default the wheel event coalescing code
in WebWheelEventCoalescer.

Change some JS style things.

* fast/scrolling/mac/momentum-axis-locking.html:
* fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow.html:
* fast/scrolling/mac/overflow-hidden-on-one-axis.html:
* fast/scrolling/mac/programmatic-scroll-overrides-rubberband.html:
* fast/scrolling/mac/wheel-event-deltas-are-not-filtered.html:
* resources/ui-helper.js:
(window.UIHelper.async mouseWheelSequence):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (285497 => 285498)


--- trunk/LayoutTests/ChangeLog	2021-11-09 14:48:01 UTC (rev 285497)
+++ trunk/LayoutTests/ChangeLog	2021-11-09 15:25:39 UTC (rev 285498)
@@ -1,3 +1,26 @@
+2021-11-08  Simon Fraser  <simon.fra...@apple.com>
+
+        Convert more wheel event tests to UIHelper.mouseWheelSequence()
+        https://bugs.webkit.org/show_bug.cgi?id=232847
+
+        Reviewed by Wenson Hsieh.
+
+        Add an options parameter to mouseWheelSequence() so we can have a version that doens't
+        wait.
+
+        Some tests need to have minor position changes to default the wheel event coalescing code
+        in WebWheelEventCoalescer.
+        
+        Change some JS style things.
+
+        * fast/scrolling/mac/momentum-axis-locking.html:
+        * fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow.html:
+        * fast/scrolling/mac/overflow-hidden-on-one-axis.html:
+        * fast/scrolling/mac/programmatic-scroll-overrides-rubberband.html:
+        * fast/scrolling/mac/wheel-event-deltas-are-not-filtered.html:
+        * resources/ui-helper.js:
+        (window.UIHelper.async mouseWheelSequence):
+
 2021-11-09  Ziran Sun  <z...@igalia.com>
 
         [css-grid] update the content-sized grid width before laying out a grid item with block constraints and aspect-ratio

Modified: trunk/LayoutTests/fast/scrolling/mac/momentum-axis-locking.html (285497 => 285498)


--- trunk/LayoutTests/fast/scrolling/mac/momentum-axis-locking.html	2021-11-09 14:48:01 UTC (rev 285497)
+++ trunk/LayoutTests/fast/scrolling/mac/momentum-axis-locking.html	2021-11-09 15:25:39 UTC (rev 285498)
@@ -34,20 +34,62 @@
 
             window.addEventListener('scroll', scrollListener);
 
-            eventSender.monitorWheelEvents();
-            eventSender.mouseMoveTo(100, 100);
             // Scroll up with some sideways drift.
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -2, "began", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -2, "changed", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -2, "changed", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "ended", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -2, "none", "begin");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -2, "none", "continue");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(2, -3, "none", "continue");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -2, "none", "continue");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "none", "end");
-            await UIHelper.waitForScrollCompletion();
+            const events = [
+                {
+                    type : "wheel",
+                    viewX : 100,
+                    viewY : 100,
+                    deltaY : -20,
+                    phase : "began"
+                },
+                {
+                    type : "wheel",
+                    deltaX : 10,
+                    deltaY : -20,
+                    phase : "changed"
+                },
+                {
+                    type : "wheel",
+                    deltaX : 10,
+                    deltaY : -20,
+                    phase : "changed"
+                },
+                {
+                    type : "wheel",
+                    phase : "ended"
+                },
+                {
+                    type : "wheel",
+                    deltaX : 10,
+                    deltaY : -20,
+                    momentumPhase : "began"
+                },
+                {
+                    type : "wheel",
+                    deltaX : 10,
+                    deltaY : -20,
+                    momentumPhase : "changed"
+                },
+                {
+                    type : "wheel",
+                    deltaX : 20,
+                    deltaY : -30,
+                    momentumPhase : "changed"
+                },
+                {
+                    type : "wheel",
+                    deltaX : 10,
+                    deltaY : -20,
+                    momentumPhase : "changed"
+                },
+                {
+                    type : "wheel",
+                    momentumPhase : "ended"
+                }
+            ];
 
+            await UIHelper.mouseWheelSequence({ events });
             window.removeEventListener('scroll', scrollListener);
         }
 
@@ -63,20 +105,61 @@
 
             window.addEventListener('scroll', scrollListener);
 
-            eventSender.monitorWheelEvents();
-            eventSender.mouseMoveTo(100, 100);
             // Scroll right with some upwards drift.
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(-2, 0, "began", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(-2, -1, "changed", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(-2, -1, "changed", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "ended", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(-2, 0, "none", "begin");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(-2, 1, "none", "continue");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(-3, 2, "none", "continue");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(-2, 1, "none", "continue");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "none", "end");
-            await UIHelper.waitForScrollCompletion();
+            const events = [
+                {
+                    type : "wheel",
+                    viewX : 100,
+                    viewY : 100,
+                    deltaX : -20,
+                    phase : "began"
+                },
+                {
+                    type : "wheel",
+                    deltaX : -20,
+                    deltaY : -10,
+                    phase : "changed"
+                },
+                {
+                    type : "wheel",
+                    deltaX : -20,
+                    deltaY : -10,
+                    phase : "changed"
+                },
+                {
+                    type : "wheel",
+                    phase : "ended"
+                },
+                {
+                    type : "wheel",
+                    deltaX : -20,
+                    momentumPhase : "began"
+                },
+                {
+                    type : "wheel",
+                    deltaX : -20,
+                    deltaY : 10,
+                    momentumPhase : "changed"
+                },
+                {
+                    type : "wheel",
+                    deltaX : -30,
+                    deltaY : 20,
+                    momentumPhase : "changed"
+                },
+                {
+                    type : "wheel",
+                    deltaX : -20,
+                    deltaY : 10,
+                    momentumPhase : "changed"
+                },
+                {
+                    type : "wheel",
+                    momentumPhase : "ended"
+                }
+            ];
 
+            await UIHelper.mouseWheelSequence({ events });
             window.removeEventListener('scroll', scrollListener);
         }
 

Modified: trunk/LayoutTests/fast/scrolling/mac/momentum-scroll-with-borders.html (285497 => 285498)


--- trunk/LayoutTests/fast/scrolling/mac/momentum-scroll-with-borders.html	2021-11-09 14:48:01 UTC (rev 285497)
+++ trunk/LayoutTests/fast/scrolling/mac/momentum-scroll-with-borders.html	2021-11-09 15:25:39 UTC (rev 285498)
@@ -81,7 +81,7 @@
             };
             events.push(endEvent);
 
-            await UIHelper.mouseWheelSequence({ events: events });
+            await UIHelper.mouseWheelSequence({ events });
             checkForScroll();
         }
 

Modified: trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow.html (285497 => 285498)


--- trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow.html	2021-11-09 14:48:01 UTC (rev 285497)
+++ trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow.html	2021-11-09 15:25:39 UTC (rev 285498)
@@ -60,18 +60,40 @@
 
     async function scrollTest()
     {
-        eventSender.mouseMoveTo(100, 100);
+        const events = [
+            {
+                type : "wheel",
+                viewX : 100,
+                viewY : 100,
+                deltaX : -10,
+                phase : "began"
+            },
+            {
+                type : "wheel",
+                deltaX : -100,
+                phase : "changed"
+            },
+            {
+                type : "wheel",
+                phase : "ended"
+            },
+            {
+                type : "wheel",
+                deltaX : -100,
+                momentumPhase : "began"
+            },
+            {
+                type : "wheel",
+                deltaX : -100,
+                momentumPhase : "changed"
+            },
+            {
+                type : "wheel",
+                momentumPhase : "ended"
+            }
+        ];
 
-        // Sideways scroll.
-        eventSender.monitorWheelEvents();
-        eventSender.mouseScrollByWithWheelAndMomentumPhases(-1, 0, 'began', 'none');
-        eventSender.mouseScrollByWithWheelAndMomentumPhases(-10, 0, 'changed', 'none');
-        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
-        eventSender.mouseScrollByWithWheelAndMomentumPhases(-10, 0, 'none', 'begin');
-        eventSender.mouseScrollByWithWheelAndMomentumPhases(-10, 0, 'none', 'continue');
-        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end');
-        await UIHelper.waitForScrollCompletion();
-
+        await UIHelper.mouseWheelSequence({ events });
         checkForScroll();
     }
 

Modified: trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis.html (285497 => 285498)


--- trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis.html	2021-11-09 14:48:01 UTC (rev 285497)
+++ trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis.html	2021-11-09 15:25:39 UTC (rev 285498)
@@ -60,18 +60,40 @@
 
     async function scrollTest()
     {
-        eventSender.mouseMoveTo(100, 100);
+        const events = [
+            {
+                type : "wheel",
+                viewX : 100,
+                viewY : 100,
+                deltaX : -10,
+                phase : "began"
+            },
+            {
+                type : "wheel",
+                deltaX : -100,
+                phase : "changed"
+            },
+            {
+                type : "wheel",
+                phase : "ended"
+            },
+            {
+                type : "wheel",
+                deltaX : -100,
+                momentumPhase : "began"
+            },
+            {
+                type : "wheel",
+                deltaX : -100,
+                momentumPhase : "changed"
+            },
+            {
+                type : "wheel",
+                momentumPhase : "ended"
+            }
+        ];
 
-        // Sideways scroll.
-        eventSender.monitorWheelEvents();
-        eventSender.mouseScrollByWithWheelAndMomentumPhases(-1, 0, 'began', 'none');
-        eventSender.mouseScrollByWithWheelAndMomentumPhases(-10, 0, 'changed', 'none');
-        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
-        eventSender.mouseScrollByWithWheelAndMomentumPhases(-10, 0, 'none', 'begin');
-        eventSender.mouseScrollByWithWheelAndMomentumPhases(-10, 0, 'none', 'continue');
-        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end');
-        await UIHelper.waitForScrollCompletion();
-
+        await UIHelper.mouseWheelSequence({ events });
         checkForScroll();
     }
 

Modified: trunk/LayoutTests/fast/scrolling/mac/programmatic-scroll-overrides-rubberband.html (285497 => 285498)


--- trunk/LayoutTests/fast/scrolling/mac/programmatic-scroll-overrides-rubberband.html	2021-11-09 14:48:01 UTC (rev 285497)
+++ trunk/LayoutTests/fast/scrolling/mac/programmatic-scroll-overrides-rubberband.html	2021-11-09 15:25:39 UTC (rev 285498)
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
 <html>
 <head>
     <style>
@@ -21,29 +21,60 @@
         
         async function doMouseWheelScroll()
         {
-            eventSender.mouseMoveTo(100, 100);
+            const events = [
+                {
+                    type : "wheel",
+                    viewX : 100,
+                    viewY : 100,
+                    deltaY : -10,
+                    phase : "began"
+                },
+                {
+                    type : "wheel",
+                    deltaY : -100,
+                    phase : "changed"
+                },
+                {
+                    type : "wheel",
+                    deltaY : -50,
+                    phase : "changed"
+                },
+                {
+                    type : "wheel",
+                    deltaY : 50,
+                    phase : "changed"
+                },
+                {
+                    type : "wheel",
+                    deltaY : 100,
+                    phase : "changed"
+                },
+                {
+                    type : "wheel",
+                    deltaY : 100,
+                    phase : "changed"
+                },
+                {
+                    type : "wheel",
+                    phase : "ended"
+                },
+                {
+                    type : "wheel",
+                    deltaY : 100,
+                    momentumPhase : "began"
+                },
+                {
+                    type : "wheel",
+                    deltaY : 100,
+                    momentumPhase : "changed"
+                },
+                {
+                    type : "wheel",
+                    momentumPhase : "ended"
+                }
+            ];
 
-            // Trigger rubberbanding at the top.
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, 'changed', 'none', true);
-            await UIHelper.renderingUpdate();
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -5, 'changed', 'none', true);
-            await UIHelper.renderingUpdate();
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 5, 'changed', 'none', true);
-            await UIHelper.renderingUpdate();
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 10, 'changed', 'none', true);
-            await UIHelper.renderingUpdate();
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 10, 'changed', 'none', true);
-            await UIHelper.renderingUpdate();
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none', true);
-            await UIHelper.renderingUpdate();
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 10, 'none', 'begin', true);
-            await UIHelper.renderingUpdate();
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 10, 'none', 'continue', true);
-            await UIHelper.renderingUpdate();
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end', true);
-
-            await UIHelper.renderingUpdate();
+            await UIHelper.mouseWheelSequence({ events }, { waitForCompletion: false });
         }
         
         async function scrollTest()

Modified: trunk/LayoutTests/fast/scrolling/mac/wheel-event-deltas-are-not-filtered.html (285497 => 285498)


--- trunk/LayoutTests/fast/scrolling/mac/wheel-event-deltas-are-not-filtered.html	2021-11-09 14:48:01 UTC (rev 285497)
+++ trunk/LayoutTests/fast/scrolling/mac/wheel-event-deltas-are-not-filtered.html	2021-11-09 15:25:39 UTC (rev 285498)
@@ -8,17 +8,52 @@
 
         async function dispatchWheelEvents()
         {
-            eventSender.monitorWheelEvents();
-            eventSender.mouseMoveTo(100, 100);
+            const events = [
+                {
+                    type : "wheel",
+                    viewX : 100,
+                    viewY : 100,
+                    deltaX : 10,
+                    deltaY : -10,
+                    phase : "began"
+                },
+                {
+                    type : "wheel",
+                    deltaX : 10,
+                    deltaY : -20,
+                    phase : "changed"
+                },
+                {
+                    type : "wheel",
+                    phase : "ended"
+                },
+                {
+                    type : "wheel",
+                    deltaX : 10,
+                    deltaY : -10,
+                    momentumPhase : "began"
+                },
+                {
+                    type : "wheel",
+                    viewX : 101, // Defeat coalescing
+                    deltaX : 10,
+                    deltaY : -20,
+                    momentumPhase : "changed"
+                },
+                {
+                    type : "wheel",
+                    viewX : 102, // Defeat coalescing
+                    deltaX : 20,
+                    deltaY : -30,
+                    momentumPhase : "changed"
+                },
+                {
+                    type : "wheel",
+                    momentumPhase : "ended"
+                }
+            ];
 
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -1, "began", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -2, "changed", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "ended", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -1, "none", "begin");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -2, "none", "continue");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(2, -3, "none", "continue");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "none", "end");
-            await UIHelper.waitForScrollCompletion();
+            await UIHelper.mouseWheelSequence({ events });
             finishJSTest();
         }
 

Modified: trunk/LayoutTests/resources/ui-helper.js (285497 => 285498)


--- trunk/LayoutTests/resources/ui-helper.js	2021-11-09 14:48:01 UTC (rev 285497)
+++ trunk/LayoutTests/resources/ui-helper.js	2021-11-09 15:25:39 UTC (rev 285498)
@@ -108,7 +108,7 @@
         await UIHelper.animationFrame();
     }
 
-    static async mouseWheelSequence(eventStream)
+    static async mouseWheelSequence(eventStream, { waitForCompletion = true } = {})
     {
         if (!this.isWebKit2()) {
             console.log('UIHelper.mouseWheelSequence() does not work in DumpRenderTree')
@@ -115,7 +115,8 @@
             return Promise.resolve();
         }
 
-        eventSender.monitorWheelEvents();
+        if (waitForCompletion)
+            eventSender.monitorWheelEvents();
         const eventStreamAsString = JSON.stringify(eventStream);
         await new Promise(resolve => {
             testRunner.runUIScript(`
@@ -127,7 +128,8 @@
             `, resolve);
         });
 
-        await UIHelper.waitForScrollCompletion();
+        if (waitForCompletion)
+            await UIHelper.waitForScrollCompletion();
     }
 
     static async waitForScrollCompletion()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to