Truly independent web browser
Tests/LibWeb: Test a pinch past the scale limit beside a busy task
Andreas Kling2c5fdc576975
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/pinch-past-the-scale-limit-beside-a-busy-task.txt b/Tests/LibWeb/Text/expected/async-scrolling/pinch-past-the-scale-limit-beside-a-busy-task.txtnew file mode 100644index 00000000000..69a497d25f8--- /dev/null+++ b/Tests/LibWeb/Text/expected/async-scrolling/pinch-past-the-scale-limit-beside-a-busy-task.txt@@ -0,0 +1,2 @@+compositor scale beside the task: 1+main thread scale after the task: 1diff --git a/Tests/LibWeb/Text/input/async-scrolling/pinch-past-the-scale-limit-beside-a-busy-task.html b/Tests/LibWeb/Text/input/async-scrolling/pinch-past-the-scale-limit-beside-a-busy-task.htmlnew file mode 100644index 00000000000..d076fc7792d--- /dev/null+++ b/Tests/LibWeb/Text/input/async-scrolling/pinch-past-the-scale-limit-beside-a-busy-task.html@@ -0,0 +1,33 @@+<!DOCTYPE html>+<script src="../include.js"></script>+<style>+ body {+ margin: 0;+ height: 3000px;+ }+</style>+<script>+ // A step of a pinch that the scale limit leaves nothing to do for is still the compositor's: the main thread has no+ // zoom to do for it, so it holds back none of the steps after it, however busy the main thread is.+ promiseTest(async () => {+ await animationFrame();+ await animationFrame();++ const compositorScale = () => internals.compositorScrollState().visualViewportScale;+ internals.pinchThroughUIProcess(400, 300, -0.5);+ internals.pinchThroughUIProcess(400, 300, 0.5);+ internals.pinchThroughUIProcess(400, 300, 0.5);++ // NB: This only gives up on steps that never come, so the time limit can't fail a slow machine's run of a fixed+ // engine.+ const giveUpAt = performance.now() + 5000;+ while (compositorScale() !== 2.25 && performance.now() < giveUpAt) {+ // Stay in this task.+ }+ println(`compositor scale beside the task: ${compositorScale()}`);++ while (visualViewport.scale !== compositorScale())+ await animationFrame();+ println(`main thread scale after the task: ${visualViewport.scale}`);+ });+</script>