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.
This commit is contained in:
dotCooCoo committed 2026-12-01 21:31:56 -08:00
1 parent f2f7727305
commit e5df2445e3
2 files changed
+28 -1

No files matched your search

+6 -1
View File
@@ -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<String, Value>) -> std::result::Result<bool, HostError> {
@@ -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)]