From e3385de040ea7cc7418d9eb9e47bee13c13c21a4 Mon Sep 17 00:00:00 2001 From: batistalucasv Date: Mon, 23 Nov 2026 23:37:10 -0300 Subject: [PATCH 1/2] font-manager: use filled warning triangle icon in FontPicker (storytold/wordcraft#7684) --- crates/font-manager/src/picker.rs | 2 +- crates/font-manager/tests/it/picker.rs | 58 +++++++++++++++++++ crates/ui-contract/icons/ATTRIBUTION.md | 2 +- crates/ui-contract/icons/icons.toml | 5 ++ .../icons/phosphor/warning-filled.svg | 1 + 5 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 crates/ui-contract/icons/phosphor/warning-filled.svg diff --git a/crates/font-manager/src/picker.rs b/crates/font-manager/src/picker.rs index 887faf69c..ee4dc6444 100644 --- a/crates/font-manager/src/picker.rs +++ b/crates/font-manager/src/picker.rs @@ -531,7 +531,7 @@ const TEXT: PartKey = PartKey::new("text"); const CHEVRON: PartKey = PartKey::new("chevron"); /// The mark before the chevron of a shown font that is not installed; its tooltip is the note. const WARNING: PartKey = PartKey::new("missing"); -const WARNING_ICON: &str = "warning"; +const WARNING_ICON: &str = "warning_filled"; /// The popup the chevron and Alt+Down toggle. const POPUP: &str = "list"; /// The Show Similar part at the end of a family row, in the `Chips` layout. diff --git a/crates/font-manager/tests/it/picker.rs b/crates/font-manager/tests/it/picker.rs index 5b1f60c26..583d16830 100644 --- a/crates/font-manager/tests/it/picker.rs +++ b/crates/font-manager/tests/it/picker.rs @@ -798,6 +798,64 @@ fn the_missing_font_warning_icon_paints_in_status_warn_fg_and_dims_when_disabled ); } +/// Texture ids of textured meshes whose centre falls inside `rect`. +fn mesh_textures(shapes: &[egui::Shape], rect: egui::Rect, out: &mut Vec) { + for shape in shapes { + match shape { + egui::Shape::Vec(inner) => mesh_textures(inner, rect, out), + egui::Shape::Mesh(mesh) if rect.contains(mesh.calc_bounds().center()) => { + out.push(mesh.texture_id); + } + _ => {} + } + } +} + +#[trial] +fn the_missing_font_warning_icon_is_a_filled_triangle() { + use std::cell::Cell; + + let catalog = catalog_of(&[INTER_REGULAR]); + let seen = Rc::new(Cell::new(None)); + let held = Rc::clone(&seen); + let mut family = "Gotham".to_owned(); + let mut fx = Fixture::new(move |ui| { + let out = FontPicker::new("Font family", Bind::bound(&mut family), &catalog).kind(FontPickerKind::Plain).shown_as("Inter").show(ui); + held.set(Some(out.edit.response.id)); + }); + fx.pixels_per_point(2.0); + fx.record_paint(); + fx.in_room(Room::Window); + fx.settle(); + let picker = seen.get().expect("the picker"); + let mark = fx.part_rect(picker, PartKey::new("missing")).expect("the field carries a mark while the family is not installed"); + let mut paint = fx.take_paint().expect("recorded paint output"); + let mut textures = Vec::new(); + for clipped in &paint.shapes { + mesh_textures(std::slice::from_ref(&clipped.shape), mark, &mut textures); + } + let texture = *textures.first().expect("the missing-font warning icon paints a texture"); + let image = paint + .textures_delta + .set + .get(&texture) + .and_then(|deltas| deltas.last()) + .map(|delta| match &delta.image { + egui::ImageData::Color(color) => color, + }) + .expect("the warning icon texture was uploaded"); + let [w, h] = image.size; + let alpha = |fx: f32, fy: f32| { + let x = ((w as f32 * fx) as usize).min(w - 1); + let y = ((h as f32 * fy) as usize).min(h - 1); + image.pixels[y * w + x].a() + }; + let (left, right, center) = (alpha(0.34, 0.69), alpha(0.66, 0.69), alpha(0.50, 0.48)); + paint.textures_delta.clear(); + assert!(left > 128 && right > 128, "the triangle interior is filled, not an outline (left={left}, right={right}, size={w}x{h})"); + assert!(center < 128, "the exclamation stem stays knocked out inside the filled triangle (center={center})"); +} + /// The library picker's family and settings, as the last pass left them. struct Library { family: String, diff --git a/crates/ui-contract/icons/ATTRIBUTION.md b/crates/ui-contract/icons/ATTRIBUTION.md index 4579d05c9..7baac2bd3 100644 --- a/crates/ui-contract/icons/ATTRIBUTION.md +++ b/crates/ui-contract/icons/ATTRIBUTION.md @@ -11,7 +11,7 @@ Each folder holds only the files `icons.toml` lists, unchanged from the pinned s Carbon's licence file is the repository's root `LICENSE` (the icons package has none of its own). -Every set folder's files come from the npm package of the version in the table (`@phosphor-icons/core` 2.0.8, `lucide-static` 1.63.0, `@carbon/icons` 11.91.0, `@tabler/icons` 3.50.0), the same releases as the tags above. Phosphor files are `regular` weight, except `star-filled.svg` and `circle-filled.svg`, which are Phosphor's `fill` weight (`star-fill.svg`, `circle-fill.svg`). `panel-left.svg` is Phosphor's `sidebar-simple` unchanged, and `panel-right.svg` is the same glyph mirrored. +Every set folder's files come from the npm package of the version in the table (`@phosphor-icons/core` 2.0.8, `lucide-static` 1.63.0, `@carbon/icons` 11.91.0, `@tabler/icons` 3.50.0), the same releases as the tags above. Phosphor files are `regular` weight, except `star-filled.svg`, `circle-filled.svg` and `warning-filled.svg`, which are Phosphor's `fill` weight (`star-fill.svg`, `circle-fill.svg`, `warning-fill.svg`). `panel-left.svg` is Phosphor's `sidebar-simple` unchanged, and `panel-right.svg` is the same glyph mirrored. `phosphor/` also holds drawings made for the suite, for glyphs the pinned Phosphor release lacks. They follow Phosphor's regular style (256 view box, 16-unit round-capped strokes, some converted to filled outlines), take their shapes from PhotoCraft's glyphs, and carry the suite's own licence: diff --git a/crates/ui-contract/icons/icons.toml b/crates/ui-contract/icons/icons.toml index 2a324cd10..7fdd9233c 100644 --- a/crates/ui-contract/icons/icons.toml +++ b/crates/ui-contract/icons/icons.toml @@ -454,6 +454,11 @@ phosphor = "warning" carbon = "warning--alt" tabler = "alert-triangle" +[[icon]] +name = "warning_filled" +directional = false +phosphor = "warning-filled" + [[icon]] name = "web_colors" directional = false diff --git a/crates/ui-contract/icons/phosphor/warning-filled.svg b/crates/ui-contract/icons/phosphor/warning-filled.svg new file mode 100644 index 000000000..f8ada0ad2 --- /dev/null +++ b/crates/ui-contract/icons/phosphor/warning-filled.svg @@ -0,0 +1 @@ + \ No newline at end of file From 1d8dc6c2b3f0689b168a294b70a413e52601f2cf Mon Sep 17 00:00:00 2001 From: batistalucasv Date: Tue, 24 Nov 2026 11:42:10 -0300 Subject: [PATCH 2/2] ci: retest flaky automation test