summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/pointerevents
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /testing/web-platform/tests/pointerevents
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/pointerevents')
-rw-r--r--testing/web-platform/tests/pointerevents/pointerevent_after_target_appended.html1
-rw-r--r--testing/web-platform/tests/pointerevents/pointerevent_after_target_removed.html25
-rw-r--r--testing/web-platform/tests/pointerevents/pointerevent_pointermove_isprimary_same_as_pointerdown.html73
3 files changed, 64 insertions, 35 deletions
diff --git a/testing/web-platform/tests/pointerevents/pointerevent_after_target_appended.html b/testing/web-platform/tests/pointerevents/pointerevent_after_target_appended.html
index 5d73702aca..712670d647 100644
--- a/testing/web-platform/tests/pointerevents/pointerevent_after_target_appended.html
+++ b/testing/web-platform/tests/pointerevents/pointerevent_after_target_appended.html
@@ -1,5 +1,6 @@
<!DOCTYPE HTML>
<title>Enter/leave events fired to parent after child is added</title>
+<link rel="help" href="https://w3c.github.io/pointerevents/#firing-events-using-the-pointerevent-interface">
<meta name="variant" content="?mouse">
<meta name="variant" content="?touch">
<meta name="variant" content="?pen">
diff --git a/testing/web-platform/tests/pointerevents/pointerevent_after_target_removed.html b/testing/web-platform/tests/pointerevents/pointerevent_after_target_removed.html
index 7b2a4eeb80..b63e8b92d1 100644
--- a/testing/web-platform/tests/pointerevents/pointerevent_after_target_removed.html
+++ b/testing/web-platform/tests/pointerevents/pointerevent_after_target_removed.html
@@ -1,4 +1,5 @@
<!DOCTYPE HTML>
+<link rel="help" href="https://w3c.github.io/pointerevents/#firing-events-using-the-pointerevent-interface">
<title>Enter/leave events fired to parent after child is removed</title>
<meta name="variant" content="?mouse">
<meta name="variant" content="?touch">
@@ -104,24 +105,12 @@
setup();
// Tests for dispatched pointer events.
- addPromiseTest("pointerdown", "pointer",
- pointer_type == "mouse"
- // `pointerup` after removing the child should not cause `pointerover`
- // on the parent if the pointer type is hoverable because pointer boundary
- // events should be fired only when the hoverable pointer is actually
- // moved.
- ? [
- "pointerover@child", "pointerenter@parent", "pointerenter@child",
- "pointerdown@child", "(child-removed)", "pointerup@parent",
- "pointerover@parent", "pointerdown@parent", "pointerup@parent",
- "pointerout@parent", "pointerleave@parent"
- ]
- : [
- "pointerover@child", "pointerenter@parent", "pointerenter@child",
- "pointerdown@child", "(child-removed)", "pointerover@parent", "pointerup@parent",
- "pointerdown@parent", "pointerup@parent",
- "pointerout@parent", "pointerleave@parent"
- ]);
+ addPromiseTest("pointerdown", "pointer", [
+ "pointerover@child", "pointerenter@parent", "pointerenter@child",
+ "pointerdown@child", "(child-removed)", "pointerover@parent", "pointerup@parent",
+ "pointerdown@parent", "pointerup@parent",
+ "pointerout@parent", "pointerleave@parent"
+ ]);
addPromiseTest("pointerup", "pointer", [
"pointerover@child", "pointerenter@parent", "pointerenter@child",
"pointerdown@child", "pointerup@child", "(child-removed)",
diff --git a/testing/web-platform/tests/pointerevents/pointerevent_pointermove_isprimary_same_as_pointerdown.html b/testing/web-platform/tests/pointerevents/pointerevent_pointermove_isprimary_same_as_pointerdown.html
index 3073076a49..c8a10e8bb8 100644
--- a/testing/web-platform/tests/pointerevents/pointerevent_pointermove_isprimary_same_as_pointerdown.html
+++ b/testing/web-platform/tests/pointerevents/pointerevent_pointermove_isprimary_same_as_pointerdown.html
@@ -6,6 +6,8 @@
<link rel="author" title="Microsoft" href="http://www.microsoft.com/"/>
<meta name="assert" content="The isPrimary attribute of a pointermove event must have the same value as the isPrimary attribute of the last pointerdown event with the same pointerId attribute."/>
<link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
+ <meta name="variant" content="?mouse">
+ <meta name="variant" content="?touch">
<!-- /resources/testharness.js -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
@@ -22,45 +24,82 @@
// will fail unless the async_test is created with the var name "test_pointerEvent".
add_completion_callback(showPointerTypes);
- var pointermove_event = null;
- var pointerdown_event = null;
+ var pointermove_events = new Map();
+ var pointerdown_events = new Map();
function run() {
var target0 = document.getElementById("target0");
var actions_promise;
on_event(target0, "pointermove", function (event) {
- if (pointerdown_event != null) {
+ let pointerdown_event = pointerdown_events.get(event.pointerId);
+ if (pointerdown_event) {
test_pointerEvent.step(function () {
assert_equals(event.pointerId, pointerdown_event.pointerId, "pointermove.pointerId should be the same as pointerdown.pointerId.");
assert_equals(event.isPrimary, pointerdown_event.isPrimary, "pointermove.isPrimary should be the same as pointerdown.isPrimary.");
});
- pointermove_event = event;
+ pointermove_events.set(event.pointerId, event);
}
});
on_event(target0, "pointerdown", function (event) {
- pointerdown_event = event;
+ assert_equals(event.isPrimary, !!(pointerdown_events.size == 0), "pointerdown.isPrimary should only be true for first pointer.");
+ pointerdown_events.set(event.pointerId, event);
detected_pointertypes[event.pointerType] = true;
});
on_event(target0, "pointerup", function (event) {
+ let pointerdown_event = pointerdown_events.get(event.pointerId);
test_pointerEvent.step(function () {
- assert_not_equals(pointermove_event, null, "pointermove event was never received: ");
- });
- // Make sure the test finishes after all the input actions are completed.
- actions_promise.then( () => {
- test_pointerEvent.done();
+ assert_true(!!pointerdown_event, "pointerdown event was received.");
+ assert_true(!!pointermove_events.size, "pointermove event was received.");
+ assert_equals(event.pointerId, pointerdown_event.pointerId, "pointerup.pointerId should be the same as pointerdown.pointerId.");
+ assert_equals(event.isPrimary, pointerdown_event.isPrimary, "pointerup.isPrimary should be the same as pointerdown.isPrimary.");
});
+ pointermove_events.delete(event.pointerId);
+ pointerdown_events.delete(event.pointerId);
+ if (pointerdown_events.size == 0) {
+ // Make sure the test finishes after all the input actions are completed.
+ actions_promise.then(() => {
+ test_pointerEvent.done();
+ });
+ }
});
- // Dispatch a mouse drag in target0.
- actions_promise = new test_driver.Actions()
- .pointerMove(0, 0, {origin: target0})
- .pointerDown()
- .pointerMove(3, 3, {origin: target0})
- .pointerUp()
- .send();
+ // Dispatch a mouse/touch drag in target0.
+ var pointerType = location.search.substring(1);
+ switch (pointerType) {
+ case "mouse":
+ actions_promise = new test_driver.Actions()
+ .pointerMove(0, 0, {origin: target0})
+ .pointerDown()
+ .pointerMove(3, 3, {origin: target0})
+ .pointerUp()
+ .send();
+ break;
+ case "touch":
+ actions_promise = new test_driver.Actions()
+ .addPointer("touchPointer1", "touch")
+ .pointerMove(0, 0, {origin: target0, sourceName: "touchPointer1"})
+ .pointerDown({sourceName: "touchPointer1"})
+ .pointerMove(3, 3, {origin: target0, sourceName: "touchPointer1"})
+ .addPointer("touchPointer2", "touch")
+ .pointerMove(0, 0, {origin: target0, sourceName: "touchPointer2"})
+ .pointerDown({sourceName: "touchPointer2"})
+ .pointerMove(5, 5, {origin: target0, sourceName: "touchPointer2"})
+ .addPointer("touchPointer3", "touch")
+ .pointerMove(0, 0, {origin: target0, sourceName: "touchPointer3"})
+ .pointerDown({sourceName: "touchPointer3"})
+ .pointerMove(7, 7, {origin: target0, sourceName: "touchPointer3"})
+ .pointerUp({sourceName: "touchPointer3"})
+ .pointerUp({sourceName: "touchPointer1"})
+ .pointerUp({sourceName: "touchPointer2"})
+ .send();
+ break;
+ default:
+ assert_true(false, `does support testing ${pointerType} input`);
+ break;
+ }
}
</script>
</head>