diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /layout/xul/test/test_bug511075.html | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
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.html | 121 |
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> |