diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /testing/web-platform/tests/pointerevents/pointerevent_pointermove_isprimary_same_as_pointerdown.html | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/pointerevents/pointerevent_pointermove_isprimary_same_as_pointerdown.html')
-rw-r--r-- | testing/web-platform/tests/pointerevents/pointerevent_pointermove_isprimary_same_as_pointerdown.html | 73 |
1 files changed, 56 insertions, 17 deletions
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> |