From acb57c169f95b6b4d35ed96f9b886c238680e5e5 Mon Sep 17 00:00:00 2001 From: BFlat Date: Fri, 9 Oct 2026 07:38:06 +0700 Subject: [PATCH] Fix #1387: the Type tool's font, style and size controls show in every theme (#1414) Outside the Pro themes the options bar showed only the hint "Click to add text" for the Type tools, so Studio, Studio Light and Classic had no way to pick a font while typing. The Type options bar now shows in every theme, as the Move tool's Auto-Select does since #1275. Claude-Session: https://claude.ai/code/session_01UHgFEHEsefoQoBParH47JA Co-authored-by: Claude --- crates/ui-egui/src/move_auto_select_tests.rs | 29 ++++++++++++++++++++ crates/ui-egui/src/panels.rs | 4 +-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/move_auto_select_tests.rs b/crates/ui-egui/src/move_auto_select_tests.rs index a718762304c..d3bcd97046f 100644 --- a/crates/ui-egui/src/move_auto_select_tests.rs +++ b/crates/ui-egui/src/move_auto_select_tests.rs @@ -151,3 +151,32 @@ fn every_theme_shows_the_auto_select_toggle() { assert!(!h.state().ui.tool_options.move_auto_select, "{theme:?}: the toggle turns Auto-Select off"); } } + +#[test] +fn every_theme_shows_the_type_options() { + // #1387: outside the Pro themes the Type tool's options bar was only the hint "Click to add + // text", so there was no font, style or size control while typing. + use egui_kittest::Harness; + use egui_kittest::kittest::{NodeT, Queryable}; + for theme in crate::theme::ThemeKind::ALL { + let (mut app, _, _) = app(); + app.ui.tool = Tool::Type; + let mut h = Harness::builder().with_size(egui::vec2(1600.0, 60.0)).build_ui_state( + |ui, app: &mut PhotocraftApp| { + if !ui.ctx().fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) { + return; + } + crate::panels::options_bar(app, ui); + }, + app, + ); + PhotocraftApp::setup_context(&h.ctx, theme); + h.run_steps(4); + let combos: Vec = h + .query_all_by_role(egui::accesskit::Role::ComboBox) + .map(|n| format!("{:?} {:?}", n.accesskit_node().label(), n.accesskit_node().value())) + .collect(); + let font = h.state().ui.tool_options.type_font.clone(); + assert!(combos.iter().any(|c| c.contains(&font)), "{theme:?}: the font picker shows {font:?}; combo boxes: {combos:?}"); + } +} diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index e57f790523a..71784c6c5de 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -789,7 +789,8 @@ pub fn options_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { } }); } - Tool::Type | Tool::VerticalType if t.pro => crate::type_tool::options_bar(app, ui), + // Every theme gets the font, style and size controls (#1387), as with Auto-Select (#1275). + Tool::Type | Tool::VerticalType => crate::type_tool::options_bar(app, ui), Tool::Move if t.pro => { let o = &mut app.ui.tool_options; widgets::checkbox(ui, &mut o.move_auto_select, tl!("Auto-Select:")); @@ -922,7 +923,6 @@ pub fn options_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { ), Tool::Gradient => hint(ui, tl!("Drag to draw a gradient")), Tool::PaintBucket => hint(ui, tl!("Click to fill similar colours")), - Tool::Type | Tool::VerticalType => hint(ui, tl!("Click to add text")), // Retouching and smart-selection tools draw their bar in `retouch_ui::options_bar`. _ => {} }