Lay out mounted overlays before asserting their rendered cues

This commit is contained in:
2026-09-12 17:53:09 -07:00
parent a357b22778
commit e44f07565c
2 changed files with 20 additions and 0 deletions
+10
View File
@@ -1215,6 +1215,16 @@ mod tests {
"moving the target must not invoke an action"
);
}
// Building an Iced UI does not lay out its overlay. The normal
// update pass must initialize it before draw can paint the menu.
let _ = ui.update(
&[],
cursor,
&mut renderer,
&mut iced::advanced::clipboard::Null,
&mut messages,
);
assert!(messages.is_empty(), "layout cannot invoke an action");
ui.draw(&mut renderer, &theme, &paint_style, cursor);
let pixels = Headless::screenshot(&mut renderer, Size::new(480, 420), 1., Color::WHITE);
assert!(
@@ -1117,6 +1117,16 @@ mod paint_tests {
let mut messages = vec![];
for active in 0..2 {
let mut ui = UserInterface::build(view(&chooser, anchor), size, cache, &mut renderer);
// Every controlled rebuild starts without a retained overlay layout.
// Run the normal update pass before observing the rendered popup.
let _ = ui.update(
&[],
cursor,
&mut renderer,
&mut iced::advanced::clipboard::Null,
&mut messages,
);
assert!(messages.is_empty(), "layout cannot browse or choose");
ui.draw(&mut renderer, &theme, &paint_style, cursor);
let pixels = Headless::screenshot(&mut renderer, Size::new(480, 420), 1., Color::WHITE);
for index in 0..3 {