diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /gfx/layers/apz/test/mochitest/helper_scroll_anchoring_on_wheel.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_scroll_anchoring_on_wheel.html')
-rw-r--r-- | gfx/layers/apz/test/mochitest/helper_scroll_anchoring_on_wheel.html | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_scroll_anchoring_on_wheel.html b/gfx/layers/apz/test/mochitest/helper_scroll_anchoring_on_wheel.html new file mode 100644 index 0000000000..9f439a8ce3 --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_scroll_anchoring_on_wheel.html @@ -0,0 +1,58 @@ +<!DOCTYPE HTML> +<meta charset="utf-8"> +<meta name="viewport" content="width=device-width, minimum-scale=1.0"> +<title>Tests scroll anchoring updates in-progress wheel scrolling __relatively__</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 } + #target > div { + height: 500px; + } +</style> +<div id="target"></div> +<div class="spacer" style="height: 1000vh"></div> +<script> + const targetElement = document.getElementById("target"); + + async function test() { + // Fistly send a wheel event to measure the scroll amount of one event. + let transformEndPromise = promiseTransformEnd(); + await synthesizeNativeWheel(window, 50, 50, 0, -50); + await transformEndPromise; + + ok(window.scrollY > 0, "Should be scrolled to some amount"); + + const firstScrollAmount = window.scrollY; + + // Now send a wheel event again. + transformEndPromise = promiseTransformEnd(); + await synthesizeNativeWheel(window, 50, 50, 0, -50); + await promiseApzFlushedRepaints(); + + // And insert an element during the wheel scrolling is still in progress. + targetElement.appendChild(document.createElement("div")); + + await transformEndPromise; + + // Give scroll offsets a chance to sync. + await promiseApzFlushedRepaints(); + + // Though in an ideal environment, the expected total scroll amount should + // be `firstScrollAmount * 2 + 500`, we don't expect it on our CIs, so we + // assume here; + // 1) it's greater than double of the first scroll amount since it should + // include the height of the inserted element. + // 2) it's greater than the first scroll amount + the height of the inserted + // element. + ok(window.scrollY > firstScrollAmount * 2, + `the scroll amount ${window.scrollY} should be greater than double of the first scroll amount ${firstScrollAmount*2}`); + ok(window.scrollY > firstScrollAmount + 500, + `the scroll amount ${window.scrollY} should also be greater than the first scroll amount + the inserted element height ${firstScrollAmount+500}`); + } + + waitUntilApzStable() + .then(test) + .then(subtestDone, subtestFailed); +</script> |