mirror of
https://github.com/storytold/cadcraft.git
synced 2026-11-03 00:42:46 -06:00
test(ui): the IME double-click test passes without craft-fonts (#2652)
`double_clicked_text_takes_ime_composition_and_commit` commits 中文 at the command line. Without a CJK font (no CRAFT_FONTS_DIR, none installed, as on a plain Linux CI image) the kittest harness panics on the first missing glyph: "No glyph for 中 in Proportional". Code and tests must work without craft-fonts. The test now asks the harness's own fonts whether they can draw 中文 and, only when they can't, lets the command line draw boxes for it. The IME path it checks is unchanged: the pre-edit is shown and not saved, the commit is inserted once, Enter stores 中文 in the text. With a CJK font the harness still fails on any missing glyph. Co-authored-by: Tyler Chiriboga <18270301+Tyler-Chiriboga@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Tyler Chiriboga
Claude Opus 5.5
parent
facae4a9a6
commit
0e7c71759c
@@ -73,6 +73,16 @@ fn double_clicked_text_takes_ime_composition_and_commit() {
|
||||
let mut h = harness();
|
||||
double_click(&mut h, Vec2::new(4.0, 1.2));
|
||||
assert_eq!(h.state().session.current_prompt().unwrap().message, "Enter new text");
|
||||
// Without a CJK font (none installed, no craft-fonts) the command line draws 中文 as boxes,
|
||||
// which the harness takes for a bug. The IME path below is the same either way.
|
||||
let drawable = h.ctx.fonts_mut(|view| {
|
||||
[egui::FontFamily::Proportional, egui::FontFamily::Monospace]
|
||||
.into_iter()
|
||||
.all(|family| view.has_glyphs(&egui::FontId::new(12.0, family), "中文"))
|
||||
});
|
||||
if !drawable {
|
||||
h.ctx.set_missing_glyph_policy(egui::MissingGlyphPolicy::Tofu);
|
||||
}
|
||||
// Composition is shown, not saved; the commit is inserted exactly once (#1761).
|
||||
h.event(Event::Ime(ImeEvent::Preedit { text: "zhong".into(), active_range_chars: None }));
|
||||
h.run_steps(1);
|
||||
|
||||
Reference in New Issue
Block a user