From 75ef59fc6a0cf1391448b571c8e3eb33ec7053d6 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 15 Oct 2026 02:10:04 +0700 Subject: [PATCH] Tests: home tests wait for recent files to be looked at Since recent files became cards, a card shows its name only after its reader thread has looked at the file. The home tests drew a fixed 12 frames, which a slow CI machine can finish first (seen on CI). --- crates/ui-egui/src/home_tests.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/home_tests.rs b/crates/ui-egui/src/home_tests.rs index 1179b1c4..8e51f9a7 100644 --- a/crates/ui-egui/src/home_tests.rs +++ b/crates/ui-egui/src/home_tests.rs @@ -22,11 +22,21 @@ fn shapes(u: &mut Ui) -> Vec { flat(&u.frame_output(vec![]).shapes) } -/// Enough frames for every thumbnail in view (they render one a frame) and what follows a click. +/// Enough frames for every thumbnail in view (they render one a frame) and what follows a click, +/// and until every recent file has been looked at (by a thread of its own: a slow machine takes +/// more than a few frames, and a card shows its name only then). fn settle(u: &mut Ui) -> Vec { for _ in 0..12 { u.frame(vec![]); } + for _ in 0..400 { + let files = u.app.inspect()["homeRecents"]["files"].as_array().cloned().unwrap_or_default(); + if files.iter().all(|f| !f["exists"].is_null()) { + break; + } + std::thread::sleep(std::time::Duration::from_millis(5)); + u.frame(vec![]); + } shapes(u) }