Files
tubestation/testing/web-platform/tests/captured-mouse-events/capture-controller-oncapturedmousechange.https.html
Blink WPT Bot a6cf57da3c Bug 1841588 [wpt PR 40868] - [CapturedMouseEvents] Export web platform tests, a=testonly
Automatic update from web-platform-tests
[CapturedMouseEvents] Export web platform tests (#40868)

This patch exports existing WPT tests added in [1], using the directory
recently introduced in [2] and taking into account the recent renaming
to "captured mouse events".

It also adds a manual test that is verified to pass with [3] applied.
WPT does not provide support for more complex and automated tests,
so this is just a minimal verification. More advanced internal tests
with wider coverage will be added in [3].

[1] https://chromium-review.googlesource.com/c/chromium/src/+/4517372
[2] https://github.com/web-platform-tests/wpt/pull/40826
[3] https://chromium-review.googlesource.com/c/chromium/src/+/4549484

Bug: 1444712
Change-Id: I8ed455c406d6cba81cb4df0651509b6d6f7bd991
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4661012
Commit-Queue: Frédéric Wang <fwang@igalia.com>
Reviewed-by: Elad Alon <eladalon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1167752}

Co-authored-by: Frédéric Wang <fwang@igalia.com>
--

wpt-commits: 72a4f49ebcd4f5d7980bd3a2cdc90805427a93bd
wpt-pr: 40868
2023-07-20 10:30:45 +00:00

31 lines
1.1 KiB
HTML

<!doctype html>
<meta charset=utf-8>
<link rel='help' href='https://screen-share.github.io/captured-mouse-events/#capture-controller-extensions'>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
const controller = new CaptureController();
assert_equals(controller.oncapturedmousechange, null);
}, "oncapturedmousechange is initially unset");
test(() => {
const controller = new CaptureController();
let result = undefined;
controller.oncapturedmousechange = (e) => {
result = {
target: e.currentTarget,
surfaceX: e.surfaceX,
surfaceY: e.surfaceY,
};
};
const init = {surfaceX: 5, surfaceY: 7};
controller.dispatchEvent(
new CapturedMouseEvent("capturedmousechange", init)
);
assert_equals(result.target, controller);
assert_equals(result.surfaceX, init.surfaceX);
assert_equals(result.surfaceY, init.surfaceY);
}, "dispatching a CapturedMouseEvent on CaptureController should trigger oncapturedmousechange");
</script>