Make fill text border controls usable in floating toolbar

This commit is contained in:
Dylan M. Taylor
2026-11-21 19:41:06 -05:00
parent 732dff771c
commit 3f55ed9e5f
2 changed files with 26 additions and 3 deletions
+9 -1
View File
@@ -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
+17 -2
View File
@@ -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();