Skip to content

Commit 1c1afb3

Browse files
committed
fix(e2e): wait for a post-mutation paint before IME screenshots
`test_ime_clear_on_route_change` reset render_stats *before* palette.dismiss, then waited for draw_calls > 0. An in-flight pre-dismiss present can satisfy that wait. On Wayland, window::screenshot copies the last presented buffer, so CI's ubuntu/tiny-skia capture still showed the palette overlay after App.palette was already cleared. Reset the counters after the mutation and wait for the next view+draw (cheap app.render_stats polls, not screenshots). One capture afterward.
1 parent 5ee03dc commit 1c1afb3

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

tools/roosttest/test_ime.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,24 @@ def captured() -> bool:
9191

9292

9393
def _after_redraw(roost, op) -> None:
94-
"""Run `op`, then wait for a fresh paint (the `app.render_stats`
95-
draw-call counter ticking) before the caller screenshots — mirrors
96-
`test_sprite_pixels`'s D4 wait, so the capture reflects the op's
97-
state change and not a stale cached frame. `feed_ime` (and
98-
`palette.dismiss`) are synchronous over IPC — the state mutation
99-
has already landed by the time `op()` returns — so this only waits
100-
for the NEXT paint to pick it up."""
101-
roost.call("app.render_stats", {"reset": True})
94+
"""Run `op`, then wait for a paint that can only have started after
95+
the mutation. `feed_ime` / `palette.dismiss` are synchronous over
96+
IPC; iced then views+draws on the next frame.
97+
98+
Resetting the counters *before* `op` lets an in-flight pre-op
99+
present count as "the next paint". Wayland `window::screenshot`
100+
copies that last presented buffer, so the capture still shows the
101+
pre-op overlay. Reset after the mutation, then wait for
102+
`view_calls` (chrome, including the palette) and `draw_calls`
103+
(terminal widget, including the preedit overlay)."""
102104
op()
103-
Roost._wait(
104-
lambda: int(roost.call("app.render_stats", {})["draw_calls"]) > 0,
105-
5.0,
106-
"redraw after IME op",
107-
)
105+
roost.call("app.render_stats", {"reset": True})
106+
107+
def painted() -> bool:
108+
stats = roost.call("app.render_stats", {})
109+
return int(stats["view_calls"]) > 0 and int(stats["draw_calls"]) > 0
110+
111+
Roost._wait(painted, 2.0, "redraw after IME op")
108112

109113

110114
@pytest.mark.skipif(

0 commit comments

Comments
 (0)