From 0da7712a29f44471db4d8d9fc7894fc06e0505c0 Mon Sep 17 00:00:00 2001 From: MaheshDesu Date: Sat, 28 Nov 2026 00:25:29 +0530 Subject: [PATCH] test: cover supported save paths after the format guard (#2383) Signed-off-by: MaheshDesu --- crates/engine/src/tests.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index cd19803ed..ac983327a 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -7533,6 +7533,25 @@ fn extensionless_export_with_an_explicit_format_still_writes() { let _ = std::fs::remove_dir_all(&dir); } +#[test] +fn supported_paths_still_save() { + let dir = std::env::temp_dir().join(format!("deckcraft-save-ok-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).unwrap(); + for (name, magic) in [("a.pptx", b"PK".as_slice()), ("a.deckcraft", b"PK".as_slice()), ("a.txt", b"")] { + let mut s = Session::new(); + sample::open_sample(&mut s).unwrap(); + let path = dir.join(name).to_string_lossy().to_string(); + s.execute("file.saveAs", &json!({"path": path})).unwrap(); + let bytes = std::fs::read(&path).unwrap(); + assert!(!bytes.is_empty(), "{name}"); + if !magic.is_empty() { + assert!(bytes.starts_with(magic), "{name}: not a ZIP"); + } + } + let _ = std::fs::remove_dir_all(&dir); +} + /// `shape.connect` glues to a shape inside a group, as PowerPoint does: the connector's /// end is set to the grouped shape and follows it when the group moves. The glue was dropped at /// once (the end stayed `None`) because rerouting only looked at the slide's top-level shapes,