From 401f449729210e69029aac0af8852c1697f787d7 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 11 Nov 2026 09:02:45 -0500 Subject: [PATCH] M8: zoom previews: scan system fonts before the zoom-preview tests render (#2230) pans_and_edits_get_no_preview_and_build_on_the_kept_image failed in full lib runs with "a pan after a previewed zoom renders strips only: Full". The render kept from the zoom is stale once the global font generation changes (retained.rs prepare: last.fonts == layout_generation()), and the once-per-process system font scan that many other tests start bumps it (fontdb.rs scan_system_fonts -> clear_layout_cache). When that scan landed between the test's zoom and its pan, the pan redrew in full instead of patching. Unrelated to the clock or the threshold. document() now runs scan_system_fonts() first (a concurrent caller waits for the scan), so the generation is settled before any render. Test-only change; the shipped staleness check is intended behaviour. Stress, full lib binary with 16 test threads: 3 of 6 runs failed before, 0 of 25 after. Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium Co-authored-by: Claude Sonnet 5.5 --- crates/ui-egui/src/canvas/zoom_preview_tests.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/canvas/zoom_preview_tests.rs b/crates/ui-egui/src/canvas/zoom_preview_tests.rs index 62951f8bd..bb36c0aae 100644 --- a/crates/ui-egui/src/canvas/zoom_preview_tests.rs +++ b/crates/ui-egui/src/canvas/zoom_preview_tests.rs @@ -23,8 +23,12 @@ use crate::render_worker::{ Done, Inline, Job, PREVIEW_AFTER_MS, PREVIEW_FACTOR, Refined, Renders, SETTLE_MS, Worker, better, coarse_view, preview_with, render_now, }; -/// A page of ellipses with a rectangle on top; the session and the rectangle. +/// A page of ellipses with a rectangle on top; the session and the rectangle. The system fonts are +/// scanned first (once per process, and a concurrent caller waits for it): the scan another test +/// starts bumps the global font generation, and a render kept from before it is stale, so a pan +/// or an edit meanwhile would redraw in full instead of patching. fn document() -> (Session, NodeId) { + figcraft_text::scan_system_fonts(); let mut s = Session::new(); for k in 0..12 { let k = f64::from(k);