Title: [271403] trunk/LayoutTests
Revision
271403
Author
[email protected]
Date
2021-01-12 08:30:40 -0800 (Tue, 12 Jan 2021)

Log Message

Clean up some mainframe scroll snap tests
https://bugs.webkit.org/show_bug.cgi?id=220537

Patch by Martin Robinson <[email protected]> on 2021-01-12
Reviewed by Frédéric Wang.

Clean up some mainframe scroll snap tests by removing dead code
and fixing some situations where tests cannot fail. This change
makes it so that these tests no longer sample scroll positions
before the tests. Instead they now rely on the assumption that
the initial scroll offset should be 0.

* tiled-drawing/scrolling/scroll-snap/resources/mainframe-scroll-snap-test.js:
(async doScrollTest):
(delay): Deleted.
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-legacy.html: No longer use shortScrollShouldSnapBack and
scrollGlideShouldScrollTo.
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-margin.html: Ditto.
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal.html: Ditto.
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-horizontal.html: Ditto.
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-vertical.html: Ditto.
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-legacy.html: Ditto.
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-margin.html: Ditto.
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical.html: Ditto.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (271402 => 271403)


--- trunk/LayoutTests/ChangeLog	2021-01-12 15:53:00 UTC (rev 271402)
+++ trunk/LayoutTests/ChangeLog	2021-01-12 16:30:40 UTC (rev 271403)
@@ -1,3 +1,29 @@
+2021-01-12  Martin Robinson  <[email protected]>
+
+        Clean up some mainframe scroll snap tests
+        https://bugs.webkit.org/show_bug.cgi?id=220537
+
+        Reviewed by Frédéric Wang.
+
+        Clean up some mainframe scroll snap tests by removing dead code
+        and fixing some situations where tests cannot fail. This change
+        makes it so that these tests no longer sample scroll positions
+        before the tests. Instead they now rely on the assumption that
+        the initial scroll offset should be 0.
+
+        * tiled-drawing/scrolling/scroll-snap/resources/mainframe-scroll-snap-test.js:
+        (async doScrollTest):
+        (delay): Deleted.
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-legacy.html: No longer use shortScrollShouldSnapBack and
+        scrollGlideShouldScrollTo.
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-margin.html: Ditto.
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal.html: Ditto.
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-horizontal.html: Ditto.
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-vertical.html: Ditto.
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-legacy.html: Ditto.
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-margin.html: Ditto.
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical.html: Ditto.
+
 2021-01-12  Philippe Normand  <[email protected]>
 
         Unreviewed, GTK gardening

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/resources/mainframe-scroll-snap-test.js (271402 => 271403)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/resources/mainframe-scroll-snap-test.js	2021-01-12 15:53:00 UTC (rev 271402)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/resources/mainframe-scroll-snap-test.js	2021-01-12 16:30:40 UTC (rev 271403)
@@ -66,24 +66,3 @@
 
     await UIHelper.waitForScrollCompletion();
 }
-
-function delay(time) {
-    return new Promise(resolve => setTimeout(resolve, time));
-}
-
-function shortScrollShouldSnapBack(targetElement, direction)
-{
-    var scrollPositionBeforeSnap = targetElement.scrollLeft;
-    return doScrollSnap(targetElement, HORIZONTAL).then(() => {
-        // The targetElement should have remained on the same snap point.
-        expectTrue("targetElement.scrollLeft == scrollPositionBeforeSnap", "div honored snap points.");
-    });
-}
-
-function scrollGlideShouldScrollTo(targetElement, direction, expectedValue)
-{
-    return doScrollGlide(targetElement, HORIZONTAL).then(() => {
-        // The targetElement should have snapped to the given snap position.
-        expectTrue("targetElement.scrollLeft == " + expectedValue, "div scrolled to next window.");
-    });
-}

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-legacy.html (271402 => 271403)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-legacy.html	2021-01-12 15:53:00 UTC (rev 271402)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-legacy.html	2021-01-12 16:30:40 UTC (rev 271403)
@@ -30,11 +30,19 @@
 
         async function runTests()
         {
-            await UIHelper.delayFor(0);
-            await scrollGlideShouldScrollTo(document.scrollingElement, HORIZONTAL, "window.innerWidth");
-            await UIHelper.delayFor(0);
-            await shortScrollShouldSnapBack(document.scrollingElement, HORIZONTAL);
-            finishJSTest();
+            try {
+                await UIHelper.delayFor(0);
+                await doScrollGlide(document.scrollingElement, HORIZONTAL);
+                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth, "div scrolled to next window.");
+
+                await UIHelper.delayFor(0);
+                await doScrollSnap(document.scrollingElement, HORIZONTAL);
+                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth, "div honored snap points.");
+            } catch (e) {
+                console.log(e);
+            } finally {
+                finishJSTest();
+            }
         }
 
         function onLoad()

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-margin.html (271402 => 271403)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-margin.html	2021-01-12 15:53:00 UTC (rev 271402)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-margin.html	2021-01-12 16:30:40 UTC (rev 271403)
@@ -36,11 +36,19 @@
 
         async function runTests()
         {
-            await UIHelper.delayFor(0);
-            await scrollGlideShouldScrollTo(document.scrollingElement, HORIZONTAL, "window.innerWidth + 50");
-            await UIHelper.delayFor(0);
-            await shortScrollShouldSnapBack(document.scrollingElement, HORIZONTAL);
-            finishJSTest();
+            try {
+                await UIHelper.delayFor(0);
+                await doScrollGlide(document.scrollingElement, HORIZONTAL);
+                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth + 50, "div scrolled to next window.");
+
+                await UIHelper.delayFor(0);
+                await doScrollSnap(document.scrollingElement, HORIZONTAL);
+                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth + 50, "div honored snap points.");
+            } catch (e) {
+                console.log(e);
+            } finally {
+                finishJSTest();
+            }
         }
 
         function onLoad()

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal.html (271402 => 271403)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal.html	2021-01-12 15:53:00 UTC (rev 271402)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal.html	2021-01-12 16:30:40 UTC (rev 271403)
@@ -32,11 +32,19 @@
 
         async function runTests()
         {
-            await UIHelper.delayFor(0);
-            await scrollGlideShouldScrollTo(document.scrollingElement, HORIZONTAL, "window.innerWidth");
-            await UIHelper.delayFor(0);
-            await shortScrollShouldSnapBack(document.scrollingElement, HORIZONTAL);
-            finishJSTest();
+            try {
+                await UIHelper.delayFor(0);
+                await doScrollGlide(document.scrollingElement, HORIZONTAL);
+                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth, "div scrolled to next window.");
+
+                await UIHelper.delayFor(0);
+                await doScrollSnap(document.scrollingElement, HORIZONTAL);
+                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth, "div honored snap points.");
+            } catch (e) {
+                console.log(e);
+            } finally {
+                finishJSTest();
+            }
         }
 
         function onLoad()

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-horizontal.html (271402 => 271403)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-horizontal.html	2021-01-12 15:53:00 UTC (rev 271402)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-horizontal.html	2021-01-12 16:30:40 UTC (rev 271403)
@@ -32,11 +32,19 @@
 
         async function runTests()
         {
-            await UIHelper.delayFor(0);
-            await scrollGlideShouldScrollTo(document.scrollingElement, HORIZONTAL, "window.innerWidth");
-            await UIHelper.delayFor(0);
-            await shortScrollShouldSnapBack(document.scrollingElement, HORIZONTAL);
-            finishJSTest();
+            try {
+                await UIHelper.delayFor(0);
+                await doScrollGlide(document.scrollingElement, HORIZONTAL);
+                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth, "div scrolled to next window.");
+
+                await UIHelper.delayFor(0);
+                await doScrollSnap(document.scrollingElement, HORIZONTAL);
+                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth, "div honored snap points.");
+            } catch (e) {
+                console.log(e);
+            } finally {
+                finishJSTest();
+            }
         }
 
         function onLoad()

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-vertical.html (271402 => 271403)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-vertical.html	2021-01-12 15:53:00 UTC (rev 271402)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-vertical.html	2021-01-12 16:30:40 UTC (rev 271403)
@@ -32,11 +32,19 @@
 
         async function runTests()
         {
-            await UIHelper.delayFor(0);
-            await scrollGlideShouldScrollTo(document.scrollingElement, VERTICAL, "window.innerHeight");
-            await UIHelper.delayFor(0);
-            await shortScrollShouldSnapBack(document.scrollingElement, VERTICAL);
-            finishJSTest();
+            try {
+                await UIHelper.delayFor(0);
+                await doScrollGlide(document.scrollingElement, VERTICAL);
+                expectTrue(document.scrollingElement.scrollTop == window.innerHeight, "div scrolled to next window.");
+
+                await UIHelper.delayFor(0);
+                await doScrollSnap(document.scrollingElement, VERTICAL);
+                expectTrue(document.scrollingElement.scrollTop == window.innerHeight, "div honored snap points.");
+            } catch (e) {
+                console.log(e);
+            } finally {
+                finishJSTest();
+            }
         }
 
         function onLoad()

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-legacy.html (271402 => 271403)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-legacy.html	2021-01-12 15:53:00 UTC (rev 271402)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-legacy.html	2021-01-12 16:30:40 UTC (rev 271403)
@@ -30,11 +30,19 @@
 
         async function runTests()
         {
-            await UIHelper.delayFor(0);
-            await scrollGlideShouldScrollTo(document.scrollingElement, VERTICAL, "window.innerHeight");
-            await UIHelper.delayFor(0);
-            await shortScrollShouldSnapBack(document.scrollingElement, VERTICAL);
-            finishJSTest();
+            try {
+                await UIHelper.delayFor(0);
+                await doScrollGlide(document.scrollingElement, VERTICAL);
+                expectTrue(document.scrollingElement.scrollTop == window.innerHeight, "div scrolled to next window.");
+
+                await UIHelper.delayFor(0);
+                await doScrollSnap(document.scrollingElement, VERTICAL);
+                expectTrue(document.scrollingElement.scrollTop == window.innerHeight, "div honored snap points.");
+            } catch (e) {
+                console.log(e);
+            } finally {
+                finishJSTest();
+            }
         }
 
         function onLoad()

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-margin.html (271402 => 271403)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-margin.html	2021-01-12 15:53:00 UTC (rev 271402)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-margin.html	2021-01-12 16:30:40 UTC (rev 271403)
@@ -36,11 +36,19 @@
 
         async function runTests()
         {
-            await UIHelper.delayFor(0);
-            await scrollGlideShouldScrollTo(document.scrollingElement, VERTICAL, "window.innerHeight + 50");
-            await UIHelper.delayFor(0);
-            await shortScrollShouldSnapBack(document.scrollingElement, VERTICAL);
-            finishJSTest();
+            try {
+                await UIHelper.delayFor(0);
+                await doScrollGlide(document.scrollingElement, VERTICAL);
+                expectTrue(document.scrollingElement.scrollTop == window.innerHeight + 50, "div scrolled to next window.");
+
+                await UIHelper.delayFor(0);
+                await doScrollSnap(document.scrollingElement, VERTICAL);
+                expectTrue(document.scrollingElement.scrollTop == window.innerHeight + 50, "div honored snap points.");
+            } catch (e) {
+                console.log(e);
+            } finally {
+                finishJSTest();
+            }
         }
 
         function onLoad()

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical.html (271402 => 271403)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical.html	2021-01-12 15:53:00 UTC (rev 271402)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical.html	2021-01-12 16:30:40 UTC (rev 271403)
@@ -32,11 +32,19 @@
 
         async function runTests()
         {
-            await UIHelper.delayFor(0);
-            await scrollGlideShouldScrollTo(document.scrollingElement, VERTICAL, "window.innerHeight");
-            await UIHelper.delayFor(0);
-            await shortScrollShouldSnapBack(document.scrollingElement, VERTICAL);
-            finishJSTest();
+            try {
+                await UIHelper.delayFor(0);
+                await doScrollGlide(document.scrollingElement, VERTICAL);
+                expectTrue(document.scrollingElement.scrollTop == window.innerHeight, "div scrolled to next window.");
+
+                await UIHelper.delayFor(0);
+                await doScrollSnap(document.scrollingElement, VERTICAL);
+                expectTrue(document.scrollingElement.scrollTop == window.innerHeight, "div honored snap points.");
+            } catch (e) {
+                console.log(e);
+            } finally {
+                finishJSTest();
+            }
         }
 
         function onLoad()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to