diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/layers/apz/test/mochitest/helper_transform_end_on_keyboard_scroll.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_transform_end_on_keyboard_scroll.html')
-rw-r--r-- | gfx/layers/apz/test/mochitest/helper_transform_end_on_keyboard_scroll.html | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_transform_end_on_keyboard_scroll.html b/gfx/layers/apz/test/mochitest/helper_transform_end_on_keyboard_scroll.html new file mode 100644 index 0000000000..20bee3cefd --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_transform_end_on_keyboard_scroll.html @@ -0,0 +1,58 @@ +<!DOCTYPE html> +<html> +<meta charset="utf-8"> +<script src="apz_test_utils.js"></script> +<script src="apz_test_native_event_utils.js"></script> +<script src="/tests/SimpleTest/EventUtils.js"></script> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script src="/tests/SimpleTest/NativeKeyCodes.js"></script> +<script src="/tests/SimpleTest/paint_listener.js"></script> +<style> +html, body { margin: 0; } + +body { + height: 10000px; +} +</style> + +<script> +async function test() { + // Send a native key event which doesn't cause any scroll, so that now + // subsequent native key events will be able to be handled by APZ. See bug + // 1774519 about what happens without this event. + const UpArrowKeyCode = nativeArrowUpKey(); + await new Promise(resolve => { + synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, + UpArrowKeyCode, {} /* no modifier */, + "", "", resolve); }); + + // On test verify runs there's still a race condition where the next key event + // isn't handled by APZ since the focus sequence number hasn't yet been + // reflected to APZ, so we explicitly flush APZ state here. + await promiseApzFlushedRepaints(); + + const transformEndPromise = promiseTransformEnd(); + const DownArrowKeyCode = nativeArrowDownKey(); + await new Promise(resolve => { + synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, + DownArrowKeyCode, {} /* no modifier */, + "", "", resolve); }); + await transformEndPromise; + ok(true, "Got an APZ:TransformEnd "); +} + +function isOnChaosMode() { + return SpecialPowers.Services.env.get("MOZ_CHAOSMODE"); +} + +if ((getPlatform() == "mac" || getPlatform() == "windows") && + !isOnChaosMode()) { + waitUntilApzStable() + .then(test) + .then(subtestDone, subtestFailed); +} else { + ok(true, "Skipping test because native key events are not supported on " + + getPlatform()); + subtestDone(); +} +</script> |