diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /gfx/layers/apz/test/mochitest/helper_bug1724759.html | |
parent | Initial commit. (diff) | |
download | firefox-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 'gfx/layers/apz/test/mochitest/helper_bug1724759.html')
-rw-r--r-- | gfx/layers/apz/test/mochitest/helper_bug1724759.html | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1724759.html b/gfx/layers/apz/test/mochitest/helper_bug1724759.html new file mode 100644 index 0000000000..a012bb0fc0 --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_bug1724759.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<html> +<meta name="viewport" content="width=device-width; initial-scale=1.0"> +<title>Tests that :active state is cleared after a longpress event</title> +<script src="/tests/SimpleTest/SimpleTest.js"></script> + <script src="/tests/SimpleTest/paint_listener.js"></script> +<script src="apz_test_utils.js"></script> +<script src="apz_test_native_event_utils.js"></script> +<style> + #button { + width: 100px; + height: 100px; + } +</style> +<button id="button">Button</button> +<script> +async function test() { + const contextmenuPromise = promiseOneEvent(button, "contextmenu", e => { + e.preventDefault(); + return true; + }); + await synthesizeNativeTouch(button, 10, 10, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT); + + // In JS there's no way to ensure `APZStateChange::eStartTouch` notification + // has been processed. So we wait for `:active` state change here. + await SimpleTest.promiseWaitForCondition( + () => button.matches(":active"), + "Waiting for :active state change"); + + ok(button.matches(":active"), "should be active"); + + await contextmenuPromise; + + await synthesizeNativeTouch(button, 10, 10, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE); + + // Same as above. We need to wait for not `:active` state here. + await SimpleTest.promiseWaitForCondition( + () => !button.matches(":active"), + "Waiting for :active state change"); + + ok(!button.matches(":active"), "should not be active"); +} + +if (getPlatform() == "windows") { + // On Windows every context menu on touch screens opens __after__ lifting the + // finger. + ok(true, "Test doesn't need to run on Windows"); + subtestDone(); +} else { + waitUntilApzStable() + .then(test) + .then(subtestDone, subtestFailed); +} +</script> +</html> |