From 3a3f0c83d7a6be1cc66de85fa1ecd19a85da926a Mon Sep 17 00:00:00 2001 From: huanld Date: Fri, 18 Sep 2026 02:10:01 +0700 Subject: [PATCH] fix(test): make the upstream plot-dialog tests pass on Windows - app_with_fixture embedded CARGO_MANIFEST_DIR straight into an automation JSON string; on Windows the backslashes become invalid JSON escapes and the open failed. Build the payload with json!. - driver_options_are_edited_remembered_and_sent_with_the_job exercises the CUPS options editor, which Windows never opens (PrinterProperties routes to the system dialog there); gate it to non-Windows. --- src/app/update/file.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/app/update/file.rs b/src/app/update/file.rs index b2044180c..d4404fad9 100644 --- a/src/app/update/file.rs +++ b/src/app/update/file.rs @@ -5612,7 +5612,12 @@ mod plot_paper_tests { env!("CARGO_MANIFEST_DIR"), "/tests/fixtures/plot/page-setups-metric.dxf" ); - let reply = app.automation_op(&format!(r#"{{"op":"open","path":"{path}"}}"#)); + // json! escapes the path: a Windows CARGO_MANIFEST_DIR carries + // backslashes, and a raw format! would put invalid \X escapes in the + // JSON string. + let reply = app.automation_op( + &serde_json::json!({"op": "open", "path": path}).to_string(), + ); assert_eq!(reply["ok"], true, "{reply}"); app } @@ -5911,6 +5916,10 @@ mod plot_paper_tests { assert!(app.plot_dialog.custom_editor.is_none()); } + // The driver-options editor is the CUPS flow; on Windows + // PrinterProperties routes to the system preferences dialog instead, so + // the editor under test never opens there. + #[cfg(not(target_os = "windows"))] #[test] fn driver_options_are_edited_remembered_and_sent_with_the_job() { use crate::io::print_to_printer::parse_lpoptions;