mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-28 12:08:46 -06:00
Keep Auto font size in the field properties Appearance tab
Fixes #2250 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 5.5
parent
50629eb6bf
commit
2f208a289b
@@ -977,7 +977,10 @@ pub(crate) fn body(ui: &mut egui::Ui, d: &mut FieldDraft, t: &crate::theme::Toke
|
||||
if ui.add(widgets::checkbox(&mut auto, tl!("Auto"))).changed() {
|
||||
d.font_size = if auto { 0.0 } else { 12.0 };
|
||||
}
|
||||
ui.add_enabled(!auto, egui::DragValue::new(&mut d.font_size).range(2.0..=100.0).speed(0.25).suffix(" pt"));
|
||||
ui.add_enabled(
|
||||
!auto,
|
||||
egui::DragValue::new(&mut d.font_size).range(2.0..=100.0).clamp_existing_to_range(false).speed(0.25).suffix(" pt"),
|
||||
);
|
||||
});
|
||||
ui.end_row();
|
||||
if let Some(l) = d.look.as_mut() {
|
||||
|
||||
@@ -193,6 +193,20 @@ fn appearance_tab_restyles_the_field() {
|
||||
assert_eq!((l.style, l.font, l.fill), (BorderStyle::Dashed, FieldFont::Courier, Some([1.0, 1.0, 0.8])));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn appearance_tab_keeps_auto_font_size() {
|
||||
let mut h = harness();
|
||||
h.state_mut().execute("form.prepare");
|
||||
h.run_steps(2);
|
||||
h.state_mut().open_field_props("city", 0);
|
||||
h.run_steps(2);
|
||||
h.get_by_label("Appearance").click();
|
||||
h.run_steps(2);
|
||||
h.state_mut().field_props.as_mut().unwrap().font_size = 0.0;
|
||||
h.run_steps(3);
|
||||
assert_eq!(h.state().field_props.as_ref().unwrap().font_size, 0.0, "Auto (0) must survive a frame");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn position_tab_rotates_a_field() {
|
||||
let mut h = harness();
|
||||
|
||||
Reference in New Issue
Block a user