From 1bccc76d77d76876058b3ce2d283a155c51e5bda Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 3 Dec 2026 20:23:55 -0800 Subject: [PATCH] Tests: dock panel tests wait for the font scan before counting idle frames dock::tests::idle_frames_replay_the_color_panel failed now and then with "idle frames replay the Color panel" (left: 1, right: 0). The app starts the scan of the installed fonts on a background thread, and frames do not wait for it. When the scan ends, the fonts' generation changes, and a panel body's inputs hold that generation through layout_inputs. On a loaded machine the scan can end after the helper's two settle frames, so the first idle frame runs the body once. The panel() helper now calls FontDb::global().family_list() after making the app, which waits for that scan (or runs it), as the font menu, properties and native menu tests already do. Every test in the module goes through panel(), so all of them get the fix. --- crates/ui-egui/src/dock.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/ui-egui/src/dock.rs b/crates/ui-egui/src/dock.rs index ea6dcb4c69..f07c0e9a4f 100644 --- a/crates/ui-egui/src/dock.rs +++ b/crates/ui-egui/src/dock.rs @@ -202,6 +202,9 @@ mod tests { fn panel(id: &'static str) -> Panel { SHOWN.with(|s| *s.borrow_mut() = id); let mut app = VectorcraftApp::new(Session::new(), Default::default()); + // The scan of the installed fonts, which the app starts, changes the fonts' generation when it ends, and the + // bodies' inputs hold that generation: wait for it, or an idle frame that it ends in runs the body. + vectorcraft_text::FontDb::global().family_list(); app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap(); let mut panel = Panel::new(app, draw);