Save: a native save's precision is not kept for new documents

This commit is contained in:
dotCooCoo
2026-10-29 10:27:33 -07:00
parent 3131b7db33
commit f41e40bbc6
2 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -871,7 +871,7 @@ impl SaveJob {
let saved = self.plan.retargets() && self.plan.path.is_some();
if saved && self.plan.format.id == "vectorcraft" {
let mut last = self.plan.options.clone();
last.retain(|k, _| !ARTBOARD_PARAMS.contains(&k.as_str()) && !matches!(k.as_str(), "separateArtboards" | "compress"));
last.retain(|k, _| !ARTBOARD_PARAMS.contains(&k.as_str()) && !matches!(k.as_str(), "separateArtboards" | "compress" | "precision"));
s.prefs.native_save_options = last;
}
// The other open documents that place this one show the new version.
+13
View File
@@ -403,6 +403,19 @@ fn precision_rounds_the_paths_of_that_save_only() {
assert!(e.contains("`document.save`") && !e.contains("document.export"), "{e}");
}
#[test]
fn precision_is_not_remembered_for_new_documents() {
let dir = Folder::new("precision-preferences");
let mut s = Session::new();
s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap();
s.execute("document.save", &json!({"path": dir.file("rounded.vectorcraft"), "precision": 3})).unwrap();
assert!(!s.prefs.native_save_options.contains_key("precision"));
s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap();
let options = s.execute("file.formatOptions", &json!({"format": "vectorcraft"})).unwrap();
assert!(options["options"]["precision"]["value"].is_null(), "{}", options["options"]["precision"]);
}
#[test]
fn a_ai_file_ignores_precision_as_save_does() {
let mut s = Session::new();