From 3141df334b84ccbabc48609e1253512db57158c7 Mon Sep 17 00:00:00 2001 From: moppeeer Date: Sun, 11 Oct 2026 11:29:22 +0200 Subject: [PATCH] test: The recently used font is the topmost row, whatever fonts are installed With few fonts installed the font's own row in the main list is on screen too, so the label matched twice (FreeBSD CI). Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panels/mod.rs b/crates/ui-egui/src/panels/mod.rs index f4d01b98f..30b4ca642 100644 --- a/crates/ui-egui/src/panels/mod.rs +++ b/crates/ui-egui/src/panels/mod.rs @@ -438,9 +438,11 @@ mod font_menu_ui_tests { click_at(&mut h, at); } assert_eq!(h.state().app.session.prefs.recent_fonts, ["Source Sans 3"]); - // Reopened without a search: Source Sans 3 is listed at the top, and again in its place. + // Reopened without a search: Source Sans 3 is listed at the top, and again in its place (on + // screen too when few fonts are installed). open_menu(&mut h, "Source Sans 3", ""); - let recent = h.get_by_label("Source Sans 3").rect(); + let recent = + h.query_all_by_label("Source Sans 3").map(|n| n.rect()).min_by(|a, b| a.min.y.total_cmp(&b.min.y)).expect("Source Sans 3 is listed"); let search = h.get_by(|n| n.role() == egui::accesskit::Role::TextInput && n.is_focused()).rect(); assert!(recent.min.y > search.max.y && recent.min.y - search.max.y < 80.0, "the first row, under the filters: {recent:?} vs {search:?}"); }