Merge pull request #3809 from dotCooCoo/fix/stroke-round-accessible-names

Name the Stroke editor's round cap and join separately
This commit is contained in:
BFlat authored and GitHub committed 2026-11-27 14:08:08 +07:00
commit dd9bd2f06b
3 files changed
+25 -2

No files matched your search

+2 -2
View File
@@ -345,12 +345,12 @@ impl Body<'_> {
];
let cap = [
(LineCap::Butt, "stroke_cap_butt", &words.butt),
(LineCap::Round, "stroke_cap_round", &words.round_cap),
(LineCap::Round, "stroke_cap_round", if icons { &words.round_cap_icon } else { &words.round_cap }),
(LineCap::Square, "stroke_cap_square", &words.square),
];
let join = [
(LineJoin::Miter, "stroke_join_miter", &words.miter),
(LineJoin::Round, "stroke_join_round", &words.round_join),
(LineJoin::Round, "stroke_join_round", if icons { &words.round_join_icon } else { &words.round_join }),
(LineJoin::Bevel, "stroke_join_bevel", &words.bevel),
];
let event = choice(ui, &words.alignment, "align", held(mixed.align, style.align), &align, self.closed, icons);
+4
View File
@@ -30,6 +30,8 @@ craft_ui::words! {
butt: "strokeEditor.butt" = "Butt / Flat";
/// The round cap.
round_cap: "strokeEditor.roundCap" = "Round";
/// The tooltip and accessible name of the round cap icon.
round_cap_icon: "strokeEditor.roundCapIcon" = "Round Cap";
/// The square cap.
square: "strokeEditor.square" = "Square";
/// The Corners row.
@@ -38,6 +40,8 @@ craft_ui::words! {
miter: "strokeEditor.miter" = "Miter";
/// The round corner.
round_join: "strokeEditor.roundJoin" = "Round";
/// The tooltip and accessible name of the round join icon.
round_join_icon: "strokeEditor.roundJoinIcon" = "Round Join";
/// The bevelled corner.
bevel: "strokeEditor.bevel" = "Bevel";
/// The Miter limit row.
+19
View File
@@ -78,3 +78,22 @@ fn dash_fields_add_after_the_pattern_and_a_cleared_field_ends_it() {
type_into(&mut fixture, "Dash 1", "");
assert_eq!(style.borrow().dashes, [4.0], "the first field never clears");
}
#[trial]
fn round_cap_and_round_join_names_lead_to_their_own_actions() {
use craft_draw::ui::stroke::{LineCap, LineJoin};
use craft_ui::testing::{access::focused_key, focus::AccessActionKind};
let (mut fixture, style) = editor(vec![4.0, 2.0]);
let cap = fixture.by_label("Round Cap").expect("the cap has its own accessible name");
let join = fixture.by_label("Round Join").expect("the join has its own accessible name");
assert_ne!(cap.node, join.node, "the names find independent choices");
fixture.click(&cap).settle();
assert_eq!(style.borrow().cap, LineCap::Round);
assert_eq!(style.borrow().join, LineJoin::Miter);
fixture.access(AccessActionKind::Focus, &join).settle();
assert_eq!(focused_key(fixture.tree()), join.node);
fixture.key(Key::Enter, Modifiers::NONE).settle();
assert_eq!(style.borrow().join, LineJoin::Round);
assert_eq!(style.borrow().cap, LineCap::Round);
}