summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_scrollbarbuttonclick_checkerboard.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/layers/apz/test/mochitest/helper_scrollbarbuttonclick_checkerboard.html
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_scrollbarbuttonclick_checkerboard.html')
-rw-r--r--gfx/layers/apz/test/mochitest/helper_scrollbarbuttonclick_checkerboard.html75
1 files changed, 75 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_scrollbarbuttonclick_checkerboard.html b/gfx/layers/apz/test/mochitest/helper_scrollbarbuttonclick_checkerboard.html
new file mode 100644
index 0000000000..e7b7895966
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_scrollbarbuttonclick_checkerboard.html
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width; initial-scale=1.0">
+ <title>Test that repeated scrollbar button clicks do not cause checkerboarding</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="text/javascript">
+
+async function test() {
+ let utils = SpecialPowers.getDOMWindowUtils(window);
+ let scrollId = utils.getViewId(document.documentElement);
+ let w = {}, h = {};
+ utils.getScrollbarSizes(document.documentElement, w, h);
+ let verticalScrollbarWidth = w.value;
+ if (verticalScrollbarWidth == 0) {
+ ok(true, "No scrollbar, can't do this test");
+ }
+ let downArrowHeight = verticalScrollbarWidth; // assume square scrollbar buttons
+ var mouseX = document.documentElement.clientWidth + verticalScrollbarWidth / 2;
+ let mouseY = document.documentElement.clientHeight - (downArrowHeight / 2);
+
+ // Hold the mouse down on the scrollbar button and
+ // keep it down to trigger the "button repeat" codepath.
+ await promiseNativeMouseEventWithAPZ({
+ type: "mousedown",
+ target: window,
+ offsetX: mouseX,
+ offsetY: mouseY,
+ });
+
+ const repetitions = 20;
+ const repeat_delay = 50; // milliseconds
+ for (i = 0; i < repetitions; i++) {
+ // Wait for the results of the click (or, on subsequent iterations
+ // the repeat) to be painted.
+ await promiseFrame();
+
+ assertNotCheckerboarded(utils, scrollId, "after scrollbar button click-hold", true);
+
+ // Wait enough time to trigger the repeat timer.
+ await SpecialPowers.promiseTimeout(repeat_delay);
+ }
+
+ // Release mouse button to clean up.
+ await promiseNativeMouseEventWithAPZ({
+ type: "mouseup",
+ target: window,
+ offsetX: mouseX,
+ offsetY: mouseY,
+ });
+
+ // Sanity-check: we should have scrolled.
+ ok(window.scrollY > 0, "Should have scrolled by clicking the scrollbar button");
+}
+
+waitUntilApzStable()
+.then(test)
+.then(subtestDone, subtestFailed);
+
+ </script>
+ <style>
+ .page-footer {
+ background-color: #212121;
+ color: #fff;
+ height: 3000px;
+ }
+ </style>
+</head>
+<body>
+ <footer class="page-footer"></footer>
+</body>
+</html>