From 3f55ed9e5fb15f6cdc61159ffccb5580bdd363ff Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 21 Nov 2026 19:41:06 -0500 Subject: [PATCH] Make fill text border controls usable in floating toolbar --- crates/ui-egui/src/hotbar.rs | 10 +++++++++- crates/ui-egui/tests/it/fill_sign.rs | 19 +++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/hotbar.rs b/crates/ui-egui/src/hotbar.rs index edd7252542..d7d28b620e 100644 --- a/crates/ui-egui/src/hotbar.rs +++ b/crates/ui-egui/src/hotbar.rs @@ -349,7 +349,15 @@ fn fill_text_controls(ui: &mut egui::Ui, app: &mut PdfCraftApp) { app.apply_edit(ui.ctx(), Edit::FontSizeAnnotation { page, index, size }); } - fill_text_border_controls(ui, app, picked); + comments::popover_from( + ui, + tl!("Border"), + |ui| IconButton::new(IconId::new("square")).label(tl!("Border")).show(ui).response, + |ui| { + fill_text_border_controls(ui, app, picked); + false + }, + ); } /// Fill & Sign's Border controls for typed text: its width, colour and shape, for the selected text (`picked`), or diff --git a/crates/ui-egui/tests/it/fill_sign.rs b/crates/ui-egui/tests/it/fill_sign.rs index 3e29909111..016a4fd243 100644 --- a/crates/ui-egui/tests/it/fill_sign.rs +++ b/crates/ui-egui/tests/it/fill_sign.rs @@ -511,6 +511,8 @@ fn typed_text_takes_an_oval_or_a_circle_from_the_toolbar() { let mut h = harness(); h.execute("sign.fill.text"); h.run_steps(2); + h.get_by_role_and_label(egui::accesskit::Role::Button, "Border").click(); + h.run_steps(2); assert_eq!(h.query_all_by_label("Border shape").count(), 0, "no shape without a border"); h.state_mut().fill_text_border = 1.0; h.run_steps(2); @@ -547,6 +549,8 @@ fn typed_text_takes_an_oval_or_a_circle_from_the_toolbar() { // Selected, an oval from the toolbar: one undo step. h.state_mut().views[0].session.comments.select_only((page, index)); h.run_steps(3); + h.get_by_role_and_label(egui::accesskit::Role::Button, "Border").click(); + h.run_steps(2); h.query_all_by_role(egui::accesskit::Role::ComboBox) .find(|n| n.value().as_deref() == Some("Circle")) .expect("shows the text's own") @@ -597,6 +601,10 @@ fn no_border_takes_the_oval_or_circle_away_too() { let props = |h: &Harness<'static, PdfCraftApp>| h.state().session.get(h.state().views[0].id).unwrap().comment_props(page, index).unwrap(); assert_eq!(props(&h).border_shape, Some(BorderShape::Circle)); let no_border = |h: &mut Harness<'static, PdfCraftApp>| { + if h.query_all_by_role_and_label(egui::accesskit::Role::Dialog, "Border").count() == 0 { + h.get_by_role_and_label(egui::accesskit::Role::Button, "Border").click(); + h.run_steps(2); + } h.query_all_by_role(egui::accesskit::Role::ComboBox).find(|n| n.value().as_deref() == Some("1 pt")).expect("the Border control").click(); h.run_steps(2); h.get_by_label("None").click(); @@ -629,7 +637,11 @@ fn fill_text_border_frames_new_and_selected_text() { let mut h = harness(); h.execute("sign.fill.text"); h.run_steps(2); + h.get_by_role_and_label(egui::accesskit::Role::Button, "Border").click(); + h.run_steps(2); h.get_by_label("Border:"); + h.get_by_role_and_label(egui::accesskit::Role::Button, "Border").click(); + h.run_steps(2); let type_at = |h: &mut Harness<'static, PdfCraftApp>, y: f32| { click(h, 50.0, y); h.event(egui::Event::Text("Same".into())); @@ -656,9 +668,12 @@ fn fill_text_border_frames_new_and_selected_text() { // The plain text selected, then framed with 2 pt from the toolbar. h.state_mut().views[0].session.comments.select_only((page, index)); + h.run_steps(2); + h.get_by_role_and_label(egui::accesskit::Role::Button, "Border").click(); + h.run_steps(2); h.query_all_by_role(egui::accesskit::Role::ComboBox) - .find(|n| n.value().as_deref() == Some("1.5 pt")) - .expect("the Border control, showing the border for new text") + .find(|n| n.value().as_deref() == Some("None")) + .expect("the Border control, showing the selected text's border") .click(); h.run_steps(2); h.get_by_label("2 pt").click();