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.
This commit is contained in:
dotCooCoo committed 2026-12-03 20:23:55 -08:00
1 parent 8ea0227804
commit 1bccc76d77
1 file changed
+3
+3
View File
@@ -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);