M5: the edit-composer whitespace test opens a note's composer from its menu

The test #5954 added on main double-clicks a sticky note and expects the
edit composer. On this branch a double-click on a note opens its pop-up
window instead, so for a note the test now checks that the pop-up opened,
then opens the edit composer with the page menu's "Edit text…" and goes on
as before: the composer still trims trailing whitespace from a non-typewriter
comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyDBXygTf7jcqdsjcfn
This commit is contained in:
mtlcl410andClaude Opus 5.5 committed 2026-11-04 01:56:46 +08:00
1 parent 390704d856
commit 03da84523b
1 file changed
+19 -1
+19 -1
View File
@@ -4035,7 +4035,25 @@ fn edit_composer_preserves_only_typewriter_whitespace(kind: u8) {
};
support::input::double_click(&mut h, point);
h.run_steps(3);
let c = h.state().views[0].comments.composer.as_ref().expect("double-click opens the edit composer");
if kind == 2 {
// A double-click on a sticky note opens its pop-up window, as in Acrobat; its edit
// composer is the page menu's "Edit text…".
let popup_open = |h: &Harness<'static, PdfCraftApp>| {
let s = h.state();
let doc = s.session.get(s.views[0].id).unwrap();
doc.info.annotations.iter().find(|a| a.page == 1 && a.index == 0).unwrap().popup.is_some_and(|p| p.open)
};
assert!(h.state().views[0].comments.composer.is_none(), "a note's double-click opens no composer");
assert!(popup_open(&h), "a note's double-click opens its pop-up");
h.hover_at(point);
h.run_steps(1);
h.event(egui::Event::PointerButton { pos: point, button: egui::PointerButton::Secondary, pressed: true, modifiers: Default::default() });
h.event(egui::Event::PointerButton { pos: point, button: egui::PointerButton::Secondary, pressed: false, modifiers: Default::default() });
h.run_steps(3);
h.get_all_by_label("Edit text…").last().unwrap().click();
h.run_steps(3);
}
let c = h.state().views[0].comments.composer.as_ref().expect("the edit composer is open");
assert_eq!(c.page, 1);
assert_eq!(c.kind, pdfcraft_ui_egui::comments::ComposerKind::Edit(0));
h.input_mut().events.push(egui::Event::Text(" edited\n\n".into()));