From e5df2445e39b00d9ee2fcccda695405554719efc Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 1 Dec 2026 21:31:56 -0800 Subject: [PATCH] Scripts: new IllustratorSaveOptions reads compatibility as ILLUSTRATOR19 A new IllustratorSaveOptions left compatibility unset, so a script that read it before setting it got undefined. It now starts at Compatibility.ILLUSTRATOR19, the documented default, which saveAs already accepts without changing what it writes. --- crates/engine/src/script/dom/save_open.rs | 7 ++++++- crates/engine/src/tests/script_save_open.rs | 22 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/script/dom/save_open.rs b/crates/engine/src/script/dom/save_open.rs index fd933f7d60..237576b64d 100644 --- a/crates/engine/src/script/dom/save_open.rs +++ b/crates/engine/src/script/dom/save_open.rs @@ -366,7 +366,12 @@ const AI_KEPT: &[(&str, Default)] = &[ ]; fn ai_starts() -> Vec<(&'static str, Data)> { - vec![("compressed", Data::Bool(true)), ("pdfCompatible", Data::Bool(true)), ("embedICCProfile", Data::Bool(false))] + vec![ + ("compatibility", text("Compatibility.ILLUSTRATOR19")), + ("compressed", Data::Bool(true)), + ("pdfCompatible", Data::Bool(true)), + ("embedICCProfile", Data::Bool(false)), + ] } fn eps_map(name: &str, d: &Data, p: &mut Map) -> std::result::Result { diff --git a/crates/engine/src/tests/script_save_open.rs b/crates/engine/src/tests/script_save_open.rs index 12db366846..04cfbeb2fc 100644 --- a/crates/engine/src/tests/script_save_open.rs +++ b/crates/engine/src/tests/script_save_open.rs @@ -212,6 +212,28 @@ fn omitted_options_are_a_new_options_objects_defaults() { let _ = std::fs::remove_dir_all(base); } +/// A new `IllustratorSaveOptions` reads `compatibility` as its default, ILLUSTRATOR19, and saves +/// with it untouched. +#[test] +fn illustrator_save_options_start_at_illustrator19_compatibility() { + let base = folder("aicompat"); + let mut s = session(&base); + let dir = data_folder(&mut s, &base); + s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap(); + let out = logged( + &mut s, + &base, + &format!( + "Folder.userData; var o = new IllustratorSaveOptions(); vc.log(o.compatibility);\ + app.activeDocument.saveAs(new File({}), o);", + quoted(&dir.join("a.ai")) + ), + ); + assert_eq!(out[0], json!("Compatibility.ILLUSTRATOR19")); + assert!(dir.join("a.ai").is_file()); + let _ = std::fs::remove_dir_all(base); +} + /// A path that resolves to a name that is not valid UTF-8 is refused before anything is written or /// opened, so no file with a lossy copy of the name is touched. #[cfg(unix)]