summaryrefslogtreecommitdiffstats
path: root/dom/events/test/pointerevents/test_bug1403055.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /dom/events/test/pointerevents/test_bug1403055.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/events/test/pointerevents/test_bug1403055.html')
-rw-r--r--dom/events/test/pointerevents/test_bug1403055.html90
1 files changed, 90 insertions, 0 deletions
diff --git a/dom/events/test/pointerevents/test_bug1403055.html b/dom/events/test/pointerevents/test_bug1403055.html
new file mode 100644
index 0000000000..8327fd147d
--- /dev/null
+++ b/dom/events/test/pointerevents/test_bug1403055.html
@@ -0,0 +1,90 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1403055
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1403055</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"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1403055">Mozilla Bug 1403055</a>
+<p id="display"></p>
+<div id="target0" style="width: 50px; height: 50px; background: green"></div>
+<div id="target1" style="width: 50px; height: 50px; background: red"></div>
+<div id="done" style="width: 50px; height: 50px; background: black"></div>
+<script type="text/javascript">
+/** Test for Bug 1403055 **/
+SimpleTest.waitForExplicitFinish();
+
+var target0 = window.document.getElementById("target0");
+var target1 = window.document.getElementById("target1");
+var done = window.document.getElementById("done");
+
+function withoutImplicitlyPointerCaptureForTouch() {
+ let target0_events = ["pointerover", "pointerenter", "pointerdown", "pointermove"];
+ let target1_events = ["pointerover", "pointerenter", "pointermove", "pointercancel", "pointerout", "pointerleave"];
+
+ target0_events.forEach((elem, index, arr) => {
+ target0.addEventListener(elem, (event) => {
+ is(event.type, target0_events[0], "receive " + event.type + " on target0");
+ target0_events = target0_events.filter(item => item !== event.type);
+ }, { once: true });
+ });
+
+ target1_events.forEach((elem, index, arr) => {
+ target1.addEventListener(elem, (event) => {
+ is(event.type, target1_events[0], "receive " + event.type + " on target1");
+ target1_events = target1_events.filter(item => item !== event.type);
+ }, { once: true });
+ });
+
+ done.addEventListener("mouseup", () => {
+ ok(!target0_events.length, " should receive " + target0_events + " on target0");
+ ok(!target1_events.length, " should receive " + target1_events + " on target1");
+ SpecialPowers.pushPrefEnv({"set": [["dom.w3c_pointer_events.implicit_capture", true]]},
+ withImplicitlyPointerCaptureForTouch);
+ }, {once : true});
+
+ synthesizeTouch(target0, 5, 5, { type: "touchstart" });
+ synthesizeTouch(target0, 6, 6, { type: "touchmove" });
+ synthesizeTouch(target1, 5, 5, { type: "touchmove" });
+ synthesizeTouch(target1, 5, 5, { type: "touchcancel" });
+ synthesizeMouseAtCenter(done, { type: "mousedown" });
+ synthesizeMouseAtCenter(done, { type: "mouseup" });
+}
+
+function withImplicitlyPointerCaptureForTouch() {
+ let target0_events = ["pointerover", "pointerenter", "pointerdown", "pointermove", "pointercancel", "pointerout", "pointerleave"];
+
+ target0_events.forEach((elem, index, arr) => {
+ target0.addEventListener(elem, (event) => {
+ is(event.type, target0_events[0], "receive " + event.type + " on target0");
+ target0_events = target0_events.filter(item => item !== event.type);
+ }, { once: true });
+ });
+
+ done.addEventListener("mouseup", () => {
+ ok(!target0_events.length, " should receive " + target0_events + " on target0");
+ SimpleTest.finish();
+ }, {once : true});
+
+ synthesizeTouch(target0, 5, 5, { type: "touchstart" });
+ synthesizeTouch(target0, 5, 5, { type: "touchmove" });
+ synthesizeTouch(target1, 5, 5, { type: "touchmove" });
+ synthesizeTouch(target1, 5, 5, { type: "touchcancel" });
+ synthesizeMouseAtCenter(done, { type: "mousedown" });
+ synthesizeMouseAtCenter(done, { type: "mouseup" });
+}
+
+SimpleTest.waitForFocus(() => {
+ SpecialPowers.pushPrefEnv({"set": [["dom.w3c_pointer_events.implicit_capture", false]]},
+ withoutImplicitlyPointerCaptureForTouch);
+});
+
+</script>
+</body>
+</html>