From cc31e60bd48803d65d16bcaec5583556d5f66261 Mon Sep 17 00:00:00 2001 From: David Mann Date: Thu, 19 Nov 2026 18:01:54 +0100 Subject: [PATCH] Integration: #15429: the arrow-key case accepts whichever row ArrowDown reaches ArrowDown steps to the row below the typed match. Where JetBrains Mono NL is installed (Windows), that row is NL, so the case failed on the font list rather than on the caret path. The test now takes the pending font as the accepted row, checks it matches the typed name and differs from the text's font, and keeps the exact font for Enter and click. Co-Authored-By: Claude Opus 5.5 --- .../src/tools/type_tool/font_commit_tests.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/tools/type_tool/font_commit_tests.rs b/crates/ui-egui/src/tools/type_tool/font_commit_tests.rs index cfc131d5e6..8b47bc69d3 100644 --- a/crates/ui-egui/src/tools/type_tool/font_commit_tests.rs +++ b/crates/ui-egui/src/tools/type_tool/font_commit_tests.rs @@ -161,8 +161,22 @@ fn caret_font_choices_style_only_subsequent_typing_including_ime() { h.run(); let before = saved(&h, id); let steps = h.state().session.active().unwrap().history.entries().len(); - let font = FONTS[1 - original]; - choose(&mut h, font, accept); + let requested = FONTS[1 - original]; + choose(&mut h, requested, accept); + // ArrowDown steps to the row below the typed match, which depends on the installed fonts + // ("JetBrains Mono NL" where it is installed), so the pending font is the row it accepted. + let font = h + .state() + .ui + .type_insertion_style + .as_ref() + .map(|s| s.style.font_family.clone()) + .unwrap_or_else(|| panic!("a pending font at the caret: {label:?}")); + let font = font.as_str(); + assert!(font.starts_with(requested) && font != FONTS[original], "the accepted row matches the typed name: {font} {label:?}"); + if accept != "arrow-enter" { + assert_eq!(font, requested, "{label:?}"); + } assert_eq!(saved(&h, id), before, "a font choice at a caret never restyles existing characters: {label:?}"); assert_eq!(h.state().session.active().unwrap().history.entries().len(), steps, "{label:?}"); crate::type_font_preview::set(h.state_mut(), font.into());