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.
This commit is contained in:
huanld committed 2026-09-18 08:39:01 +07:00
1 parent 36d5c4db79
commit 3a3f0c83d7
1 file changed
+10 -1
+10 -1
View File
@@ -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;