Merge pull request #10539 from dotCooCoo/fix/ai-save-options-compatibility-default

Scripts: new IllustratorSaveOptions reads compatibility as ILLUSTRATOR19
This commit is contained in:
.CooCoo authored and GitHub committed 2026-12-02 02:01:50 -08:00
commit e3e84bd4fb
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> {
@@ -276,6 +276,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)]