diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/layers/apz/test/mochitest/helper_doubletap_zoom_htmlelement.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_doubletap_zoom_htmlelement.html')
-rw-r--r-- | gfx/layers/apz/test/mochitest/helper_doubletap_zoom_htmlelement.html | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_htmlelement.html b/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_htmlelement.html new file mode 100644 index 0000000000..8fadc4eb3e --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_htmlelement.html @@ -0,0 +1,76 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=2100"/> + <title>Check that double tapping on a scrollbar does not scroll to top</title> + <script type="application/javascript" src="apz_test_native_event_utils.js"></script> + <script type="application/javascript" src="apz_test_utils.js"></script> + <script src="/tests/SimpleTest/paint_listener.js"></script> + <script type="application/javascript"> + +async function test() { + let useTouchpad = (location.search == "?touchpad"); + + var resolution = await getResolution(); + var start_resolution = resolution; + ok(resolution > 0, + "The initial_resolution is " + resolution + ", which is some sane value"); + + // Check that double-tapping once zooms in + await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad); + var prev_resolution = resolution; + resolution = await getResolution(); + ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution); + + // instant scroll to the middle of the page + window.scrollTo({ + top: 4 * window.innerHeight, + left: 0, + behavior: 'auto' + }); + + await promiseApzFlushedRepaints(); + + let prevScrollX = window.scrollX; + let prevScrollY = window.scrollY; + + ok(3.9 * window.innerHeight < window.scrollY && window.scrollY < 4.1 * window.innerHeight, + "scrollY looks good"); + + // Check that double-tapping on the bottom scrollbar does not scroll us to the top + // Need to divide by resolution because the coords are assumed to be inside the resolution + await doubleTapOn(window, (window.innerWidth/2)/resolution, (window.innerHeight - 5)/resolution, useTouchpad); + prev_resolution = resolution; + resolution = await getResolution(); + ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution); + ok(resolution == start_resolution, "The second double-tap has decreased the resolution to the start to " + resolution); + + info("prevscroll " + prevScrollX + " " + prevScrollY + "\n"); + info("window.scroll " + window.scrollX + " " + window.scrollY + "\n"); + + ok(0.88*prevScrollY < window.scrollY && window.scrollY < prevScrollY*1.12, "scroll y didn't change by much"); +} + +waitUntilApzStable() +.then(test) +.then(subtestDone, subtestFailed); + + </script> + <style type="text/css"> + .spacer { + background-color: #eee; + width: 10px; + height: 800vh; + } +</style> +</head> +<body> + +<div id="target" style="width: 100px; height: 100px; background: red;"> +</div> +<div class="spacer"> +</div> + +</body> +</html> |