Truly independent web browser
Tests/LibWeb: Retry snap takeover tests when the snap scroll ends first
Tim Ledbettera08e1c06f178
diff --git a/Tests/LibWeb/Text/expected/scroll-snap-new-gesture-during-compositor-snap-scroll.txt b/Tests/LibWeb/Text/expected/scroll-snap-new-gesture-during-compositor-snap-scroll.txtindex 65858ec7a57..69c420d6a25 100644--- a/Tests/LibWeb/Text/expected/scroll-snap-new-gesture-during-compositor-snap-scroll.txt+++ b/Tests/LibWeb/Text/expected/scroll-snap-new-gesture-during-compositor-snap-scroll.txt@@ -1,4 +1,3 @@-snap scroll in flight: truescrollend events while the gesture was in progress: 0scroll offset after the gesture settled: 0,200scrollend events in total: 1diff --git a/Tests/LibWeb/Text/expected/scroll-snap-new-gesture-during-snap-scroll.txt b/Tests/LibWeb/Text/expected/scroll-snap-new-gesture-during-snap-scroll.txtindex 65858ec7a57..69c420d6a25 100644--- a/Tests/LibWeb/Text/expected/scroll-snap-new-gesture-during-snap-scroll.txt+++ b/Tests/LibWeb/Text/expected/scroll-snap-new-gesture-during-snap-scroll.txt@@ -1,4 +1,3 @@-snap scroll in flight: truescrollend events while the gesture was in progress: 0scroll offset after the gesture settled: 0,200scrollend events in total: 1diff --git a/Tests/LibWeb/Text/input/scroll-snap-new-gesture-during-compositor-snap-scroll.html b/Tests/LibWeb/Text/input/scroll-snap-new-gesture-during-compositor-snap-scroll.htmlindex c92b363f6e1..68a64f55d2a 100644--- a/Tests/LibWeb/Text/input/scroll-snap-new-gesture-during-compositor-snap-scroll.html+++ b/Tests/LibWeb/Text/input/scroll-snap-new-gesture-during-compositor-snap-scroll.html@@ -29,13 +29,21 @@// Nothing keeps this gesture on the main thread, so the compositor process runs the scroll to the snap position// selected once the gesture settles.- await internals.wheel(50, 50, 0, 120, true);- while (scroller.scrollTop === 120)- await animationFrame();- println(`snap scroll in flight: ${scroller.scrollTop > 120}`);+ while (true) {+ await internals.wheel(50, 50, 0, 120, true);+ while (scroller.scrollTop === 120)+ await animationFrame();- // The input of a new gesture takes the scroll over, so its scrollend event is not delivered mid-gesture.- await internals.wheel(50, 50, 0, 20, true);+ // The input of a new gesture takes the scroll over, so its scrollend event is not delivered mid-gesture.+ await internals.wheel(50, 50, 0, 20, true);+ if (scroller.scrollTop < 220)+ break;++ while (scroller.scrollTop % 200 !== 0)+ await scrollendEvent(scroller);+ await scrollSettled(scroller, () => scroller.scrollTop = 0);+ scrollendCount = 0;+ }await animationFrame();println(`scrollend events while the gesture was in progress: ${scrollendCount}`);diff --git a/Tests/LibWeb/Text/input/scroll-snap-new-gesture-during-snap-scroll.html b/Tests/LibWeb/Text/input/scroll-snap-new-gesture-during-snap-scroll.htmlindex e498ff3bfcb..8cc5310e570 100644--- a/Tests/LibWeb/Text/input/scroll-snap-new-gesture-during-snap-scroll.html+++ b/Tests/LibWeb/Text/input/scroll-snap-new-gesture-during-snap-scroll.html@@ -30,14 +30,22 @@let scrollendCount = 0;scroller.addEventListener("scrollend", () => ++scrollendCount);- await internals.wheel(50, 50, 0, 120, true);- while (scroller.scrollTop === 120)- await animationFrame();- println(`snap scroll in flight: ${scroller.scrollTop > 120}`);+ while (true) {+ await internals.wheel(50, 50, 0, 120, true);+ while (scroller.scrollTop === 120)+ await animationFrame();- // The scroll the input of a new gesture takes over belongs to the gesture that started it, so its scrollend- // event is not delivered mid-gesture.- await internals.wheel(50, 50, 0, 20, true);+ // The scroll the input of a new gesture takes over belongs to the gesture that started it, so its scrollend+ // event is not delivered mid-gesture.+ await internals.wheel(50, 50, 0, 20, true);+ if (scroller.scrollTop < 220)+ break;++ while (scroller.scrollTop % 200 !== 0)+ await scrollendEvent(scroller);+ await scrollSettled(scroller, () => scroller.scrollTop = 0);+ scrollendCount = 0;+ }await animationFrame();println(`scrollend events while the gesture was in progress: ${scrollendCount}`);