diff --git a/crates/engine/src/cmd/fileio/save.rs b/crates/engine/src/cmd/fileio/save.rs index da710553b..301a7c79f 100644 --- a/crates/engine/src/cmd/fileio/save.rs +++ b/crates/engine/src/cmd/fileio/save.rs @@ -1094,11 +1094,11 @@ fn format_options(s: &mut Session, p: &Value) -> Result { } } } - // An EPS save that named artboards without Use Artboards had it on (the encoder reads them - // so): it shows on, with those artboards as the range. + // An EPS save that named artboards without Use Artboards, or with it on, had it on (the + // encoder reads them so): it shows on, with those artboards as the range. if f.id == "eps" && let Some(m) = &saved - && m.get("useArtboards").is_none_or(Value::is_null) + && m.get("useArtboards").and_then(Value::as_bool) != Some(false) { let range = m.get("range").and_then(Value::as_str).filter(|r| !r.trim().is_empty()); let boards = m diff --git a/crates/engine/src/tests/save.rs b/crates/engine/src/tests/save.rs index 2b31bddb3..22a0239fb 100644 --- a/crates/engine/src/tests/save.rs +++ b/crates/engine/src/tests/save.rs @@ -510,6 +510,21 @@ fn eps_save_keeps_all_editing_artboards_in_the_file_of_one_page() { assert!(s.execute("document.save", &json!({"format": "eps", "options": {"selectedOnly": true}})).is_err(), "selected-only is Export's job"); } +#[test] +fn eps_save_with_use_artboards_and_a_named_artboard_reports_it_as_the_range() { + let d = dir("eps-named-artboard"); + let eps_path = path(&d, "Art.eps"); + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 200, "height": 100, "artboards": 2})).unwrap(); + rect(&mut s); + let options = json!({"useArtboards": true, "artboard": 1, "previewFormat": "none", "thumbnails": false}); + s.execute("document.save", &json!({"path": eps_path, "options": options})).unwrap(); + let o = s.execute("file.formatOptions", &json!({})).unwrap(); + assert_eq!(o["options"]["useArtboards"]["value"], true); + assert_eq!(o["options"]["range"]["value"], "2", "the saved artboard, not All"); + std::fs::remove_dir_all(d).unwrap(); +} + #[test] fn eps_save_with_use_artboards_writes_the_central_file_and_one_per_artboard() { let d = dir("eps-artboards");