From b9eaaeb23b011b7a1e96568a4101f6d0d3cc13b9 Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Mon, 2 Nov 2026 17:03:02 -0600 Subject: [PATCH] Test: hidden media controls are written as PowerPoint's p14 extension The round trip now also checks the written presProps.xml: inside p:showPr, the extension uri and p14:showMediaCtrls with its namespace declared on the element; the default writes nothing. Co-Authored-By: Claude Opus 5.5 --- crates/pptx/tests/it/roundtrip.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/pptx/tests/it/roundtrip.rs b/crates/pptx/tests/it/roundtrip.rs index c61e6e433..521956a06 100644 --- a/crates/pptx/tests/it/roundtrip.rs +++ b/crates/pptx/tests/it/roundtrip.rs @@ -1970,11 +1970,30 @@ fn default_durations_match_powerpoint() { } } -/// Show media controls is PowerPoint's `p14:showMediaCtrls` extension inside `p:showPr`. +/// Show media controls is PowerPoint's `p14:showMediaCtrls` extension inside `p:showPr`: off is +/// written there, under its extension uri and with the p14 namespace declared on the element; +/// on (the default) writes nothing. #[test] fn hidden_media_controls_survive_save_and_reopen() { + let props = |p: &Presentation| { + let bytes = deckcraft_pptx::export(p).expect("export"); + let mut zip = zip::ZipArchive::new(std::io::Cursor::new(bytes)).expect("zip"); + let mut x = String::new(); + std::io::Read::read_to_string(&mut zip.by_name("ppt/presProps.xml").expect("presProps"), &mut x).expect("read"); + x + }; let mut p = Presentation::default(); p.show.show_media_controls = false; + let xml = props(&p); + let show = xml.split("").next()).expect("p:showPr"); + assert!( + show.contains( + "" + ), + "{xml}" + ); assert!(!round(&p).show.show_media_controls); - assert!(round(&Presentation::default()).show.show_media_controls); + let default = Presentation::default(); + assert!(!props(&default).contains("showMediaCtrls")); + assert!(round(&default).show.show_media_controls); }