summaryrefslogtreecommitdiffstats
path: root/layout/xul/test/test_bug511075.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 /layout/xul/test/test_bug511075.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/xul/test/test_bug511075.html')
-rw-r--r--layout/xul/test/test_bug511075.html121
1 files changed, 121 insertions, 0 deletions
diff --git a/layout/xul/test/test_bug511075.html b/layout/xul/test/test_bug511075.html
new file mode 100644
index 0000000000..34e784ba56
--- /dev/null
+++ b/layout/xul/test/test_bug511075.html
@@ -0,0 +1,121 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=511075
+-->
+<head>
+ <title>Test for Bug 511075</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <style>
+ #scroller {
+ border: 1px solid black;
+ }
+ </style>
+</head>
+<body onload="runTests()">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=511075">Mozilla Bug 511075</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 511075 **/
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+
+var tests = [
+ function() {
+ ok(true, "Setting location.hash should scroll.");
+ nextTest();
+ // Click the top scroll arrow.
+ var x = scroller.getBoundingClientRect().width - 5;
+ var y = 5;
+ // On MacOSX the top scroll arrow can be below the slider just above
+ // the bottom scroll arrow.
+ if (navigator.platform.includes("Mac"))
+ y = scroller.getBoundingClientRect().height - 40;
+ synthesizeMouse(scroller, x, y, { type : "mousedown" }, window);
+ synthesizeMouse(scroller, x, y, { type: "mouseup" }, window);
+ },
+ function() {
+ ok(true, "Clicking the top scroll arrow should scroll.");
+ nextTest();
+ // Click the bottom scroll arrow.
+ var x = scroller.getBoundingClientRect().width - 5;
+ var y = scroller.getBoundingClientRect().height - 25;
+ synthesizeMouse(scroller, x, y, { type : "mousedown" }, window);
+ synthesizeMouse(scroller, x, y, { type: "mouseup" }, window);
+ },
+ function() {
+ ok(true, "Clicking the bottom scroll arrow should scroll.");
+ nextTest();
+ // Click the scrollbar.
+ var x = scroller.getBoundingClientRect().width - 5;
+ synthesizeMouse(scroller, x, 40, { type : "mousedown" }, window);
+ synthesizeMouse(scroller, x, 40, { type: "mouseup" }, window);
+ },
+ function() {
+ ok(true, "Clicking the scrollbar should scroll");
+ nextTest();
+ // Click the scrollbar.
+ var x = scroller.getBoundingClientRect().width - 5;
+ var y = scroller.getBoundingClientRect().height - 50;
+ synthesizeMouse(scroller, x, y, { type : "mousedown" }, window);
+ synthesizeMouse(scroller, x, y, { type: "mouseup" }, window);
+ },
+ function() {
+ scroller.onscroll = null;
+ ok(true, "Clicking the scrollbar should scroll");
+ finish();
+ }
+];
+
+document.onmousedown = function () { return false; };
+document.onmouseup = function () { return true; };
+
+
+var scroller;
+var timer = 0;
+
+function failure() {
+ ok(false, scroller.onscroll + " did not run!");
+ scroller.onscroll = null;
+ finish();
+}
+
+function nextTest() {
+ clearTimeout(timer);
+ scroller.onscroll = tests.shift();
+ timer = setTimeout(failure, 2000);
+}
+
+function runTests() {
+ scroller = document.getElementById("scroller");
+ nextTest();
+ window.location.hash = "initialPosition";
+}
+
+function finish() {
+ document.onmousedown = null;
+ document.onmouseup = null;
+ clearTimeout(timer);
+ window.location.hash = "topPosition";
+ SimpleTest.finish();
+}
+
+
+</script>
+</pre>
+<div id="scroller" style="overflow: scroll; width: 100px; height: 150px;">
+<a id="topPosition" name="topPosition">top</a>
+<div style="width: 20000px; height: 20000px;"></div>
+<a id="initialPosition" name="initialPosition">initialPosition</a>
+<div style="width: 20000px; height: 20000px;"></div>
+</div>
+</body>
+</html>