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 /layout/base/tests/bug977003_inner_3.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 'layout/base/tests/bug977003_inner_3.html')
-rw-r--r-- | layout/base/tests/bug977003_inner_3.html | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/layout/base/tests/bug977003_inner_3.html b/layout/base/tests/bug977003_inner_3.html new file mode 100644 index 0000000000..2448b4ada8 --- /dev/null +++ b/layout/base/tests/bug977003_inner_3.html @@ -0,0 +1,95 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=977003 +--> +<head> + <meta charset="utf-8"> + <title>Test for Bug 977003</title> + <meta name="author" content="Maksim Lebedev" /> + <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> + #target, #mediator, #listener { background: yellow; } + </style> + <script type="application/javascript"> + var target = undefined; + var mediator = undefined; + var listener = undefined; + var test_down_got = false; + var test_mediator_got = false; + var test_mediator_lost = false; + var test_listener = false; + + function TargetDownHandler(event) { + logger("Target receive event: " + event.type); + logger("Send pointerCapture to Mediator"); + mediator.setPointerCapture(event.pointerId); + logger("setPointerCapture was executed"); + test_down_got = true; + } + function MediatorGotPCHandler(event) { + logger("Mediator receive event: " + event.type); + logger("Try send setPointerCapture on listener"); + listener.setPointerCapture(event.pointerId); + logger("Try send releasePointerCapture from listener"); + listener.releasePointerCapture(event.pointerId); + test_mediator_got = true; + } + function MediatorLostPCHandler(event) { + logger("Mediator receive event: " + event.type); + test_mediator_lost = true; + } + function ListenerHandler(event) { + logger("Receive event on Listener: " + event.type); + test_listener = true; + } + function logger(message) { + console.log(message); + var log = document.getElementById('log'); + log.innerHTML = message + "<br>" + log.innerHTML; + } + + function prepareTest() { + SimpleTest.executeSoon(executeTest); + } + function executeTest() + { + logger("executeTest"); + target = document.getElementById("target"); + mediator = document.getElementById("mediator"); + listener = document.getElementById("listener"); + target.addEventListener("pointerdown", TargetDownHandler); + mediator.addEventListener("gotpointercapture", MediatorGotPCHandler); + mediator.addEventListener("lostpointercapture", MediatorLostPCHandler); + listener.addEventListener("gotpointercapture", ListenerHandler); + listener.addEventListener("lostpointercapture", ListenerHandler); + var rect = target.getBoundingClientRect(); + synthesizeMouse(target, rect.width/2, rect.height/2, {type: "mousedown"}); + synthesizeMouse(target, rect.width/3, rect.height/3, {type: "mousemove"}); + synthesizeMouse(target, rect.width/4, rect.height/4, {type: "mousemove"}); + finishTest(); + } + function finishTest() { + parent.is(test_down_got, true, "Part 3: pointerdown event should be received"); + parent.is(test_mediator_got, true, "Part 3: gotpointercapture event should be received by Mediator"); + parent.is(test_mediator_lost, true, "Part 3: lostpointercapture event should be received by Mediator"); + parent.is(test_listener, false, "Part 3: listener should not receive any events"); + logger("finishTest"); + parent.finishTest(); + } + </script> +</head> +<body onload="prepareTest()"> + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=977003">Mozilla Bug 977003 Test 3</a> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <div id="listener">div id=listener</div> + <div id="mediator">div id=mediator</div> + <div id="target">div id=target</div> + <pre id="log"> + </pre> +</body> +</html> |