summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_bug1783936.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
commit9e3c08db40b8916968b9f30096c7be3f00ce9647 (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /gfx/layers/apz/test/mochitest/helper_bug1783936.html
parentInitial commit. (diff)
downloadthunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.tar.xz
thunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_bug1783936.html')
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1783936.html74
1 files changed, 74 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1783936.html b/gfx/layers/apz/test/mochitest/helper_bug1783936.html
new file mode 100644
index 0000000000..8aec5eafef
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_bug1783936.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>Test that scroll snap happens on pan end without fling</title>
+ <script src="apz_test_utils.js"></script>
+ <script src="apz_test_native_event_utils.js"></script>
+ <script src="/tests/SimpleTest/paint_listener.js"></script>
+ <style>
+ body {
+ margin: 0;
+ padding: 0;
+ }
+ html {
+ overflow-y: scroll;
+ scroll-snap-type: y mandatory;
+ scroll-behavior: auto;
+ }
+ .snap {
+ width: 100%;
+ height: 100vh;
+ background-color: blue;
+ position: absolute;
+ top: 200px;
+ scroll-snap-align: start;
+ }
+ </style>
+</head>
+<body>
+ <div class="snap"></div>
+ <div style="width: 100%; height: 500vh;"></div>
+ <script type="application/javascript">
+ async function test() {
+ is(window.scrollY, 200, "The initial layout should result snapping to 200px");
+
+ // Start scrolling back by a pan gesture and wait its' scroll end.
+ let transformEndPromise = promiseTransformEnd();
+ await promiseNativeTouchpadPanEventAndWaitForObserver(
+ window,
+ 100,
+ 100,
+ 0, -100,
+ SpecialPowers.DOMWindowUtils.PHASE_BEGIN);
+
+ // Finish the pan gesture.
+ await promiseNativeTouchpadPanEventAndWaitForObserver(
+ window,
+ 100,
+ 100,
+ 0, 0,
+ SpecialPowers.DOMWindowUtils.PHASE_END);
+ await transformEndPromise;
+
+ // Make sure the new scroll positions have reached to the main-thread.
+ await promiseOnlyApzControllerFlushed();
+
+ is(window.scrollY, 200, "The pan-end should result snapping to 200px");
+ }
+
+ // This test is supposed to run on environments where
+ // PanGestureInput.mSimulateMomentum for pan gestures is true, which means
+ // as of now it's only on Linux.
+ if (getPlatform() == "linux") {
+ waitUntilApzStable()
+ .then(test)
+ .then(subtestDone, subtestFailed);
+ } else {
+ ok(true, "Skipping test because this test isn't supposed to work on " + getPlatform());
+ subtestDone();
+ }
+ </script>
+</body>
+</html>