Changeset 271403 in webkit


Ignore:
Timestamp:
Jan 12, 2021 8:30:40 AM (3 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Martin Robinson <mrobinson@igalia.com> 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.
Location:
trunk/LayoutTests
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r271400 r271403  
     12021-01-12  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Clean up some mainframe scroll snap tests
     4        https://bugs.webkit.org/show_bug.cgi?id=220537
     5
     6        Reviewed by Frédéric Wang.
     7
     8        Clean up some mainframe scroll snap tests by removing dead code
     9        and fixing some situations where tests cannot fail. This change
     10        makes it so that these tests no longer sample scroll positions
     11        before the tests. Instead they now rely on the assumption that
     12        the initial scroll offset should be 0.
     13
     14        * tiled-drawing/scrolling/scroll-snap/resources/mainframe-scroll-snap-test.js:
     15        (async doScrollTest):
     16        (delay): Deleted.
     17        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-legacy.html: No longer use shortScrollShouldSnapBack and
     18        scrollGlideShouldScrollTo.
     19        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-margin.html: Ditto.
     20        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal.html: Ditto.
     21        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-horizontal.html: Ditto.
     22        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-vertical.html: Ditto.
     23        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-legacy.html: Ditto.
     24        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-margin.html: Ditto.
     25        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical.html: Ditto.
     26
    1272021-01-12  Philippe Normand  <pnormand@igalia.com>
    228
  • trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/resources/mainframe-scroll-snap-test.js

    r269730 r271403  
    6767    await UIHelper.waitForScrollCompletion();
    6868}
    69 
    70 function delay(time) {
    71     return new Promise(resolve => setTimeout(resolve, time));
    72 }
    73 
    74 function shortScrollShouldSnapBack(targetElement, direction)
    75 {
    76     var scrollPositionBeforeSnap = targetElement.scrollLeft;
    77     return doScrollSnap(targetElement, HORIZONTAL).then(() => {
    78         // The targetElement should have remained on the same snap point.
    79         expectTrue("targetElement.scrollLeft == scrollPositionBeforeSnap", "div honored snap points.");
    80     });
    81 }
    82 
    83 function scrollGlideShouldScrollTo(targetElement, direction, expectedValue)
    84 {
    85     return doScrollGlide(targetElement, HORIZONTAL).then(() => {
    86         // The targetElement should have snapped to the given snap position.
    87         expectTrue("targetElement.scrollLeft == " + expectedValue, "div scrolled to next window.");
    88     });
    89 }
  • trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-legacy.html

    r269730 r271403  
    3131        async function runTests()
    3232        {
    33             await UIHelper.delayFor(0);
    34             await scrollGlideShouldScrollTo(document.scrollingElement, HORIZONTAL, "window.innerWidth");
    35             await UIHelper.delayFor(0);
    36             await shortScrollShouldSnapBack(document.scrollingElement, HORIZONTAL);
    37             finishJSTest();
     33            try {
     34                await UIHelper.delayFor(0);
     35                await doScrollGlide(document.scrollingElement, HORIZONTAL);
     36                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth, "div scrolled to next window.");
     37
     38                await UIHelper.delayFor(0);
     39                await doScrollSnap(document.scrollingElement, HORIZONTAL);
     40                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth, "div honored snap points.");
     41            } catch (e) {
     42                console.log(e);
     43            } finally {
     44                finishJSTest();
     45            }
    3846        }
    3947
  • trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-margin.html

    r269730 r271403  
    3737        async function runTests()
    3838        {
    39             await UIHelper.delayFor(0);
    40             await scrollGlideShouldScrollTo(document.scrollingElement, HORIZONTAL, "window.innerWidth + 50");
    41             await UIHelper.delayFor(0);
    42             await shortScrollShouldSnapBack(document.scrollingElement, HORIZONTAL);
    43             finishJSTest();
     39            try {
     40                await UIHelper.delayFor(0);
     41                await doScrollGlide(document.scrollingElement, HORIZONTAL);
     42                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth + 50, "div scrolled to next window.");
     43
     44                await UIHelper.delayFor(0);
     45                await doScrollSnap(document.scrollingElement, HORIZONTAL);
     46                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth + 50, "div honored snap points.");
     47            } catch (e) {
     48                console.log(e);
     49            } finally {
     50                finishJSTest();
     51            }
    4452        }
    4553
  • trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal.html

    r269730 r271403  
    3333        async function runTests()
    3434        {
    35             await UIHelper.delayFor(0);
    36             await scrollGlideShouldScrollTo(document.scrollingElement, HORIZONTAL, "window.innerWidth");
    37             await UIHelper.delayFor(0);
    38             await shortScrollShouldSnapBack(document.scrollingElement, HORIZONTAL);
    39             finishJSTest();
     35            try {
     36                await UIHelper.delayFor(0);
     37                await doScrollGlide(document.scrollingElement, HORIZONTAL);
     38                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth, "div scrolled to next window.");
     39
     40                await UIHelper.delayFor(0);
     41                await doScrollSnap(document.scrollingElement, HORIZONTAL);
     42                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth, "div honored snap points.");
     43            } catch (e) {
     44                console.log(e);
     45            } finally {
     46                finishJSTest();
     47            }
    4048        }
    4149
  • trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-horizontal.html

    r269730 r271403  
    3333        async function runTests()
    3434        {
    35             await UIHelper.delayFor(0);
    36             await scrollGlideShouldScrollTo(document.scrollingElement, HORIZONTAL, "window.innerWidth");
    37             await UIHelper.delayFor(0);
    38             await shortScrollShouldSnapBack(document.scrollingElement, HORIZONTAL);
    39             finishJSTest();
     35            try {
     36                await UIHelper.delayFor(0);
     37                await doScrollGlide(document.scrollingElement, HORIZONTAL);
     38                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth, "div scrolled to next window.");
     39
     40                await UIHelper.delayFor(0);
     41                await doScrollSnap(document.scrollingElement, HORIZONTAL);
     42                expectTrue(document.scrollingElement.scrollLeft == window.innerWidth, "div honored snap points.");
     43            } catch (e) {
     44                console.log(e);
     45            } finally {
     46                finishJSTest();
     47            }
    4048        }
    4149
  • trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-vertical.html

    r269730 r271403  
    3333        async function runTests()
    3434        {
    35             await UIHelper.delayFor(0);
    36             await scrollGlideShouldScrollTo(document.scrollingElement, VERTICAL, "window.innerHeight");
    37             await UIHelper.delayFor(0);
    38             await shortScrollShouldSnapBack(document.scrollingElement, VERTICAL);
    39             finishJSTest();
     35            try {
     36                await UIHelper.delayFor(0);
     37                await doScrollGlide(document.scrollingElement, VERTICAL);
     38                expectTrue(document.scrollingElement.scrollTop == window.innerHeight, "div scrolled to next window.");
     39
     40                await UIHelper.delayFor(0);
     41                await doScrollSnap(document.scrollingElement, VERTICAL);
     42                expectTrue(document.scrollingElement.scrollTop == window.innerHeight, "div honored snap points.");
     43            } catch (e) {
     44                console.log(e);
     45            } finally {
     46                finishJSTest();
     47            }
    4048        }
    4149
  • trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-legacy.html

    r269730 r271403  
    3131        async function runTests()
    3232        {
    33             await UIHelper.delayFor(0);
    34             await scrollGlideShouldScrollTo(document.scrollingElement, VERTICAL, "window.innerHeight");
    35             await UIHelper.delayFor(0);
    36             await shortScrollShouldSnapBack(document.scrollingElement, VERTICAL);
    37             finishJSTest();
     33            try {
     34                await UIHelper.delayFor(0);
     35                await doScrollGlide(document.scrollingElement, VERTICAL);
     36                expectTrue(document.scrollingElement.scrollTop == window.innerHeight, "div scrolled to next window.");
     37
     38                await UIHelper.delayFor(0);
     39                await doScrollSnap(document.scrollingElement, VERTICAL);
     40                expectTrue(document.scrollingElement.scrollTop == window.innerHeight, "div honored snap points.");
     41            } catch (e) {
     42                console.log(e);
     43            } finally {
     44                finishJSTest();
     45            }
    3846        }
    3947
  • trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-margin.html

    r269730 r271403  
    3737        async function runTests()
    3838        {
    39             await UIHelper.delayFor(0);
    40             await scrollGlideShouldScrollTo(document.scrollingElement, VERTICAL, "window.innerHeight + 50");
    41             await UIHelper.delayFor(0);
    42             await shortScrollShouldSnapBack(document.scrollingElement, VERTICAL);
    43             finishJSTest();
     39            try {
     40                await UIHelper.delayFor(0);
     41                await doScrollGlide(document.scrollingElement, VERTICAL);
     42                expectTrue(document.scrollingElement.scrollTop == window.innerHeight + 50, "div scrolled to next window.");
     43
     44                await UIHelper.delayFor(0);
     45                await doScrollSnap(document.scrollingElement, VERTICAL);
     46                expectTrue(document.scrollingElement.scrollTop == window.innerHeight + 50, "div honored snap points.");
     47            } catch (e) {
     48                console.log(e);
     49            } finally {
     50                finishJSTest();
     51            }
    4452        }
    4553
  • trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical.html

    r269730 r271403  
    3333        async function runTests()
    3434        {
    35             await UIHelper.delayFor(0);
    36             await scrollGlideShouldScrollTo(document.scrollingElement, VERTICAL, "window.innerHeight");
    37             await UIHelper.delayFor(0);
    38             await shortScrollShouldSnapBack(document.scrollingElement, VERTICAL);
    39             finishJSTest();
     35            try {
     36                await UIHelper.delayFor(0);
     37                await doScrollGlide(document.scrollingElement, VERTICAL);
     38                expectTrue(document.scrollingElement.scrollTop == window.innerHeight, "div scrolled to next window.");
     39
     40                await UIHelper.delayFor(0);
     41                await doScrollSnap(document.scrollingElement, VERTICAL);
     42                expectTrue(document.scrollingElement.scrollTop == window.innerHeight, "div honored snap points.");
     43            } catch (e) {
     44                console.log(e);
     45            } finally {
     46                finishJSTest();
     47            }
    4048        }
    4149
Note: See TracChangeset for help on using the changeset viewer.