mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-14 19:26:51 -04:00
Fix #1387: the Type tool's font, style and size controls show in every theme
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. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UHgFEHEsefoQoBParH47JA
This commit is contained in:
2 files changed
+31
-2
No files matched your search
@@ -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<String> = 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:?}");
|
||||
}
|
||||
}
|
||||
@@ -799,7 +799,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:"));
|
||||
@@ -911,7 +912,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`.
|
||||
_ => {}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user