mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-29 04:36:47 -06:00
feat(ui): the Typography panel has its own OT icon in the dock
The icon column's Typography entry reused the Character icon. It now uses an "OT" glyph (panel-typography), and a test checks it is neither the placeholder nor the Character icon. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 5.5
parent
be98657a22
commit
fbfc1dca76
@@ -20,7 +20,7 @@ pub const ICON_PANELS: &[(&str, &str, &str)] = &[
|
||||
("paragraphStyles", "Paragraph Styles", "panel-pstyles"),
|
||||
("characterStyles", "Character Styles", "panel-cstyles"),
|
||||
("character", "Character", "panel-character"),
|
||||
("typography", "Typography", "panel-character"),
|
||||
("typography", "Typography", "panel-typography"),
|
||||
("glyphs", "Glyphs", "panel-character"),
|
||||
("paragraph", "Paragraph", "panel-paragraph"),
|
||||
("textWrap", "Text Wrap", "panel-wrap"),
|
||||
|
||||
@@ -301,6 +301,7 @@ pub fn paint(p: &Painter, r: Rect, name: &str, c: Color32) {
|
||||
}
|
||||
"panel-effects" => pen.text(10.0, 10.0, "fx", 11.0),
|
||||
"panel-character" => pen.text(10.0, 10.5, "A", 15.0),
|
||||
"panel-typography" => pen.text(10.0, 10.5, "OT", 11.5),
|
||||
"panel-paragraph" => pen.text(10.0, 10.5, "¶", 15.0),
|
||||
"panel-pstyles" => {
|
||||
pen.text(8.0, 10.0, "¶", 13.0);
|
||||
@@ -878,6 +879,7 @@ mod tests {
|
||||
/// What icon `name` paints into a 20×20 rect, as the painter's shape list.
|
||||
fn drawing(name: &str) -> String {
|
||||
let ctx = egui::Context::default();
|
||||
crate::theme::install_fonts(&ctx, "en");
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| {
|
||||
paint(ui.painter(), Rect::from_min_size(pos2(0.0, 0.0), vec2(20.0, 20.0)), name, Color32::WHITE);
|
||||
});
|
||||
@@ -897,4 +899,12 @@ mod tests {
|
||||
assert_ne!(drawn[0], drawn[2], "Shear draws like Free Transform");
|
||||
assert_ne!(drawn[1], drawn[2], "Scale and Shear draw alike");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn typography_panel_has_its_own_icon() {
|
||||
let unknown = drawing("no-such-icon");
|
||||
let typography = drawing("panel-typography");
|
||||
assert_ne!(typography, unknown, "panel-typography falls back to the placeholder");
|
||||
assert_ne!(typography, drawing("panel-character"), "Typography draws the Character icon");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user