diff --git a/crates/engine/src/cmd/effectcmd/tests.rs b/crates/engine/src/cmd/effectcmd/tests.rs index c23c578d0..e5279391a 100644 --- a/crates/engine/src/cmd/effectcmd/tests.rs +++ b/crates/engine/src/cmd/effectcmd/tests.rs @@ -68,7 +68,7 @@ fn solid_effects_apply_save_edit_export_expand_and_undo() { assert!(s.execute("effect.setParams", &json!({"index": 0, "params": {"bevel": "nope"}, "ids": [id.0], "item": null})).is_err()); let svg = s.execute("document.serialize", &json!({"format": "svg"})).unwrap(); let svg = svg["data"].as_str().or_else(|| svg["text"].as_str()).map(str::to_string).unwrap_or_else(|| svg.to_string()); - assert!(svg.matches("= 2, "{effect}: exported as vector faces"); + assert!(vectorcraft_testkit::svg_shapes(&svg) >= 2, "{effect}: exported as vector faces"); s.execute("effect.expandAppearance", &json!({"ids": [id.0]})).unwrap(); assert!(matches!(node(&s, id).kind, NodeKind::Group { .. }), "{effect}"); assert!(!effects::has_solid(&node(&s, id))); diff --git a/crates/engine/src/cmd/fileio/tests_dxf.rs b/crates/engine/src/cmd/fileio/tests_dxf.rs index 6bea6dad7..eec800d74 100644 --- a/crates/engine/src/cmd/fileio/tests_dxf.rs +++ b/crates/engine/src/cmd/fileio/tests_dxf.rs @@ -101,7 +101,7 @@ fn selected_only_exports_the_selection_in_its_layers() { // Other formats take it too. s.execute("select.set", &json!({"ids": [line]})).unwrap(); let svg = s.execute("document.serialize", &json!({"format": "svg", "selectedOnly": true})).unwrap()["text"].as_str().unwrap().to_string(); - assert_eq!((svg.matches("") && o.contains("class=\"cls-1\"")); changed(&mut s, json!({"objectIds": "minimal"}), &|o| !o.contains(" id=\"")); changed(&mut s, json!({"objectIds": "unique"}), &|o| o.contains(" id=\"u") && o.contains("-Layer_1\"")); - changed(&mut s, json!({"decimals": 1}), &|o| o.contains("M10.1 ") && !o.contains("10.123")); + changed(&mut s, json!({"decimals": 1}), &|o| o.contains("x=\"10.1\"") && !o.contains("10.123")); changed(&mut s, json!({"decimals": 6}), &|o| o.contains("10.123456")); changed(&mut s, json!({"minify": true}), &|o| !o.trim_end().contains('\n') && !o.contains("") && text.matches("") && vectorcraft_testkit::svg_shapes(&text) == 2, "Save reuses the options: {text}"); assert!(s.execute("document.save", &json!({"path": dir.join("x.png").to_string_lossy()})).is_err(), "PNG is an export"); // A native save switches back. let native = dir.join("doc.vectorcraft").to_string_lossy().to_string(); diff --git a/crates/engine/src/cmd/fileio/tests_svgenc.rs b/crates/engine/src/cmd/fileio/tests_svgenc.rs index f901115d1..d1d912313 100644 --- a/crates/engine/src/cmd/fileio/tests_svgenc.rs +++ b/crates/engine/src/cmd/fileio/tests_svgenc.rs @@ -61,7 +61,7 @@ fn a_chosen_artboard_s_svg_holds_only_its_own_art() { s.execute("shape.rectangle", &json!({"x": first + 10.0, "y": 10, "width": 30, "height": 30})).unwrap(); s.execute("shape.ellipse", &json!({"x": third + 10.0, "y": 10, "width": 30, "height": 30})).unwrap(); // A rectangle has straight sides only; the ellipse is curves. - let shapes = |svg: &str| (svg.matches("