M7: home screen test waits for the recent-file reader

The first-run test settled the home screen with a fixed 12 frames, but
the recent files are looked at on a thread of their own and a card shows
no name until that thread has answered. On a busy CI runner it hadn't
yet, so "ridgeline" was still a grey placeholder and the test failed
(seen on this PR and on codex/issue-250-async-dialog). settle() now waits
until every recent file has been looked at, as home_recents_tests does.
Checked with a reader slowed to 200 ms: the old test fails at the same
line as CI, the new one passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Rob Coenen
2026-10-14 14:30:10 -04:00
co-authored by Claude Opus 5.5
parent 9404226235
commit 3e777d2485
+11 -1
View File
@@ -22,8 +22,18 @@ fn shapes(u: &mut Ui) -> Vec<Shape> {
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,
/// after every recent file has been looked at (the reader is a thread of its own, and a card
/// shows no name until it has answered).
fn settle(u: &mut Ui) -> Vec<Shape> {
for _ in 0..400 {
u.frame(vec![]);
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));
}
for _ in 0..12 {
u.frame(vec![]);
}