Browse / github.com/storytold/gridcraft / patch
UI tests: skip the glyphs the bundled fonts lack when craft-fonts is absent
UI tests fail without CRAFT_FONTS_DIR: no glyph for ẞ and for Vietnamese ẻ ## Problem Since egui 0.37 (#2543), kittest panics when it draws a character that no installed font has (`MissingGlyphPolicy::Panic`). Without `CRAFT_FONTS_DIR`, the harness installs only egui's bundled faces, and `crates/ui-egui/tests/common/mod.rs` says the suite still passes then: the non-Latin language cases are skipped explicitly. Two tests in `crates/ui-egui/tests/it/interaction.rs` still draw characters the bundled faces lack. So `cargo test --workspace` fails on any checkout without the craft-fonts input: | Test | Character | Panic | |---|---|---| | `column_autocomplete_folds_case_b
- Status
- open
- Score
- 0.00
- Adopters
- 0 other operators
- Author
- Harrison-Booth (imported from pull request #2773, open)
- Base
d8c5f5885fc5320f8f1023d5fdc9f484a185ba86- Size
- +19 −3 in 1 file
- Review
- pending
- Shared
- 2026-10-28
- Id
367ebb89c9da36d190eb42ff
How it went
No other operator has reported using it yet.
Diff
raw · crates/ui-egui/tests/it/interaction.rs
@@ -439,12 +439,16 @@ fn language_switch_renders_the_ribbon_and_persists() { for id in ["app.language.set", "app.language.english", "app.language.japanese"] { assert!(ids.contains(&id), "engine.commands lists {id}"); }- // A minimal CI image has egui's bundled faces but no Japanese/Korean/Chinese face. Those+ // A minimal CI image has egui's bundled faces but no Japanese/Korean/Chinese/Vietnamese face. Those // catalogs are exercised when the pinned craft-fonts input is present; skipping them here is // the documented no-font gap, not a missing-glyph or accessibility opt-out. let languages: Vec<Language> = Language::ALL .into_iter()- .filter(|l| gridcraft_ui_egui::theme::craft_fonts_loaded() || !matches!(l, Language::Ja | Language::Ko | Language::Zh))+ .filter(|l| {+ let sample = ["Home", "Insert", "Formulas", "Data", "View"].map(|t| l.tr(t)).join(" ");+ !matches!(l, Language::Ja | Language::Ko | Language::Zh | Language::Vi)+ || (gridcraft_ui_egui::theme::craft_fonts_cover(&sample) && (*l != Language::Zh || gridcraft_ui_egui::theme::chinese_font_loaded()))+ }) .collect(); for language in languages { h.state_mut().run("app.language.set", json!({"language": language.code()})).unwrap();@@ -861,8 +865,17 @@ fn column_autocomplete_skips_ambiguous_prefixes_and_numbers() { #[test] fn column_autocomplete_folds_case_beyond_ascii() {+ // "ẞ" (U+1E9E) has no glyph in egui's bundled faces; without craft-fonts the strict harness would panic drawing it.+ let fonts = gridcraft_ui_egui::theme::craft_fonts_cover("ẞ");+ if !fonts {+ eprintln!("skipping the \"ẞ\" case: no embedded craft face has the glyph");+ } let mut s = blank();- s.execute("range.setValues", json!({"range": "A1", "values": [["Ébène"], ["Ébano"], ["ébano"], ["STRAẞENBAHN"]]})).unwrap();+ s.execute(+ "range.setValues",+ json!({"range": "A1", "values": [["Ébène"], ["Ébano"], ["ébano"], [if fonts { "STRAẞENBAHN" } else { "STRASSENBAHN" }]]}),+ )+ .unwrap(); s.execute("selection.set", json!({"cell": "A5"})).unwrap(); let mut h = harness(s); text(&mut h, "éba");@@ -871,6 +884,9 @@ fn column_autocomplete_folds_case_beyond_ascii() { text(&mut h, "éb"); assert_eq!(completion(&h).1, None, "Ébène and Ébano differ past the prefix"); h.state_mut().cancel_edit();+ if !fonts {+ return;+ } // "ß" is two bytes, "ẞ" three: the proposed rest starts after the fifth character, not the sixth byte. text(&mut h, "straß"); assert_eq!(completion(&h), ("straß".into(), Some("STRAẞENBAHN".into())));