#1026: the intensity-width test skips labels egui's own font can't draw

This commit is contained in:
bflatastic
2026-10-24 13:04:14 +07:00
parent 030dffc2eb
commit 0168d25d85
+5
View File
@@ -577,6 +577,11 @@ fn the_intensity_label_fits_whole_in_every_language() {
let label = lang.ui.iter().find(|(k, _)| *k == "Intensity").map_or("Intensity", |(_, t)| match t {
Text::Plain(s) | Text::Plural { other: s, .. } => s,
});
// The test's context has only egui's own font: a label it can't draw (Vietnamese
// diacritics, CJK) can't be measured here, and the app draws it with a system font.
if !ui.ctx().fonts_mut(|f| f.has_glyphs(&crate::theme::regular(11.0), label)) {
continue;
}
let lead = crate::widgets::text_lead_width(ui, label, GLASS_FIELD_W);
assert!(lead >= 12.0 + width(label), "{}: {label:?} would end in \"…\"", lang.code);
}