From 312575ddaab3c216480782f264ca2daa520fbb98 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 19 Nov 2026 23:54:51 -0500 Subject: [PATCH] pipe comments-1: fixes for comments (10 tests) --- crates/ui-egui/src/app/clipboard.rs | 3 +++ crates/ui-egui/tests/it/comments.rs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/app/clipboard.rs b/crates/ui-egui/src/app/clipboard.rs index e304e3add4..5d7fcd9bec 100644 --- a/crates/ui-egui/src/app/clipboard.rs +++ b/crates/ui-egui/src/app/clipboard.rs @@ -186,6 +186,9 @@ impl PdfCraftApp { } return; } + // An explicit empty paste can fall back to the app's copied comments, after object and + // image precedence has been resolved using the actual clipboard contents. + let text = pasted.and_then(|c| c.text.as_deref()).filter(|t| t.is_empty()).map(str::to_owned).or(text); if let Some(text) = text { if !text.is_empty() { self.last_copied_image = None; diff --git a/crates/ui-egui/tests/it/comments.rs b/crates/ui-egui/tests/it/comments.rs index e003afb799..f70c40ad6f 100644 --- a/crates/ui-egui/tests/it/comments.rs +++ b/crates/ui-egui/tests/it/comments.rs @@ -5133,7 +5133,7 @@ fn comment_menu_rows_follow_permissions_and_run_their_action() { assert_eq!(h.state().views[0].session.comments.selection(), vec![(0, 0)], "{what}: the click selected the comment"); } right_click_pt(&mut h, point); - let disabled = h.get_by_label(label).accesskit_node().is_disabled(); + let disabled = h.get_by_role_and_label(Role::MenuItem, label).accesskit_node().is_disabled(); assert_eq!(disabled, matches!(does, Does::Disabled), "{what}: the row is greyed out only where the rights forbid it"); if disabled { h.key_press(egui::Key::Escape); @@ -5143,7 +5143,7 @@ fn comment_menu_rows_follow_permissions_and_run_their_action() { assert_eq!(h.state().session.get(id).unwrap().can_undo(), None, "{what}: no edit was made"); continue; } - h.get_by_label(label).click(); + h.get_by_role_and_label(Role::MenuItem, label).click(); h.run_steps(4); match does { Does::Marks => assert!(comments(&h).iter().any(|a| a.state.as_deref() == Some("Marked")), "{what}"),