diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 1bcf3801c3..46ab4e82d8 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -9386,3 +9386,119 @@ fn repeated_backdrop_artwork_survives_background_undo_redo_and_both_save_modes() s.apply(rewritten, Edit::RemoveMarks { kind: MarkKind::Background }).unwrap(); black(&s, rewritten); } + +/// A page still exists after its only master widget is hidden: its master nodes stay in the +/// script model, so a later script can address them again (test from wireless89's review of +/// #5368). +#[test] +fn xfa_page_master_instance_survives_hiding_its_last_widget() { + let template = pdfcraft_xfa::fixtures::repeated_print_button_template() + .replace(r#"xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);"#, r#"this.presence = "hidden";"#) + .replace( + "", + r#"