Merge feat/eps-save-use-artboards into fix/options-dialog-menus

This commit is contained in:
dotCooCoo
2026-11-11 20:48:58 -08:00
2 changed files with 18 additions and 3 deletions
+3 -3
View File
@@ -1094,11 +1094,11 @@ fn format_options(s: &mut Session, p: &Value) -> Result<Value> {
}
}
}
// 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
+15
View File
@@ -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");