Commit adc34f41 authored by Ella Ge's avatar Ella Ge Committed by Commit Bot

Fix web_test pointerevent_coordinates_when_locked on wpt

The test was failing on WPT[1] because test driver only takes integer
coordinates, but the test was using getBoundingClientRect which
returns float values.

This CL changes the test to set the "origin" for test driver actions
so that there is no need to use getBoundingClientRect.

[1] https://wpt.fyi/results/pointerevents/pointerlock/pointerevent_coordinates_when_locked.html

Change-Id: I56b2c052805b3bc174573564d176d6660accd7cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1553645Reviewed-by: default avatarLan Wei <lanwei@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#647877}
parent 91146a65
...@@ -73,15 +73,15 @@ ...@@ -73,15 +73,15 @@
}); });
var actions = new test_driver.Actions(); var actions = new test_driver.Actions();
actions.pointerMove(/* x = */ 0, /* y = */ 0, {origin: target}).pointerDown(); actions.pointerMove(/* x = */ 0, /* y = */ 0, {origin: div1}).pointerDown();
pos_x = target.getBoundingClientRect().x + target.offsetWidth / 2; pos_x = div1.offsetWidth / 2;
pos_y = target.getBoundingClientRect().y + target.offsetHeight / 2; pos_y = div1.offsetHeight / 2;
for (var i = 0; i < 10; i++) { for (var i = 0; i < 10; i++) {
// Alternatively move left/right and up/down. // Alternatively move left/right and up/down.
pos_x += ((-1)**i) * i * 10; pos_x += ((-1)**i) * i * 10;
pos_y -= ((-1)**i) * i * 10; pos_y -= ((-1)**i) * i * 10;
actions.pointerMove(pos_x, pos_y); actions.pointerMove(pos_x, pos_y, {origin: div1});
} }
actions.pointerUp().send(); actions.pointerUp().send();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment