Merge PR #3953: M5: a Replace text comment is named Replace text, not Strikethrough (#3947)

This commit is contained in:
aiongg
2026-10-22 01:46:25 +00:00
3 changed files with 10 additions and 1 deletions
+1
View File
@@ -347,6 +347,7 @@ pub fn tool_for(a: &Annotation) -> Option<CommentTool> {
("FreeText", _) => CommentTool::TextBox,
("Highlight", _) => CommentTool::Highlight,
("Underline", _) => CommentTool::Underline,
("StrikeOut", Some("StrikeOutTextEdit")) => CommentTool::ReplaceText,
("StrikeOut", _) => CommentTool::StrikeOut,
("Squiggly", _) => CommentTool::Squiggly,
("Ink", _) => CommentTool::Ink,
+2 -1
View File
@@ -35,9 +35,10 @@ pub fn subtype_label(s: &str) -> &str {
}
}
/// The comment type as the panel names it, telling callouts and clouds apart by `/IT`.
/// The comment type as the panel names it, telling callouts, clouds and replaced text apart by `/IT`.
pub fn kind_label(a: &Annotation) -> &str {
match a.intent.as_deref() {
Some("StrikeOutTextEdit") => "Replace text",
Some("FreeTextCallout") => "Callout",
Some("PolygonCloud") => "Cloud",
Some("FreeTextTypeWriter") => "Typewriter",
+7
View File
@@ -1616,6 +1616,13 @@ fn replacing_text_strikes_it_and_adds_a_caret() {
assert_eq!(caret.in_reply_to, strike.name, "grouped with the strikeout");
assert_eq!(h.state().session.get(h.state().views[0].id).unwrap().can_undo(), Some("Replace text"));
assert_eq!(h.state().quick_tool, QuickTool::Select);
// The strikeout is the Replace text tool's, not Strikethrough's (#3947): the panel names it
// so, and Make Current Properties Default updates the Replace text tool.
assert_eq!(pdfcraft_ui_egui::comments::tool_for(strike), Some(pdfcraft_ui_egui::comments::CommentTool::ReplaceText));
h.state_mut().set_option("panel", "comments").unwrap();
h.run_steps(3);
assert!(h.query_by_role_and_label(egui::accesskit::Role::Label, "Replace text").is_some(), "the panel names the comment Replace text");
assert!(h.query_by_role_and_label(egui::accesskit::Role::Label, "Strikethrough").is_none(), "not Strikethrough");
}
#[test]