Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

test: failing regression test for #370 (ignored until fixed) (#378)

Jonas Wreded470bfc52a62
diff --git a/crates/engine/src/cmd/sheet_tests.rs b/crates/engine/src/cmd/sheet_tests.rs
index 6fad4990f1..a99ce69557 100644
--- a/crates/engine/src/cmd/sheet_tests.rs
+++ b/crates/engine/src/cmd/sheet_tests.rs
@@ -1715,3 +1715,25 @@ fn hole_beside_two_adjacent_edge_flanges_cuts_and_bends_stay_guarded() {
let error = hole(&mut bend, "Bend", [78.5, 20.0]).unwrap_err().to_string();
assert!(error.contains("bend"), "{error}");
}
+
+/// A fold whose stored `fixed` point ends up off the sheet after a parameter change keeps working:
+/// the point still says which side stays (#370). Only a new pick off the sheet is refused (#263).
+#[test]
+#[ignore = "fails until #370 is fixed"]
+fn fold_keeps_working_when_a_parameter_moves_the_sheet_off_its_fixed_point() {
+ let mut s = Session::default();
+ run(&mut s, "parameters.change", json!({"name": "w", "expression": "100 mm"}));
+ run(&mut s, "sketch.create", json!({"plane": "XY", "name": "Blank"}));
+ run(&mut s, "sketch.rectangle.two_point", json!({"p0": [0, 0], "p1": [100, 60]}));
+ run(&mut s, "sketch.dimension", json!({"entities": ["l1"], "value": "w"}));
+ run(&mut s, "sketch.finish", json!({}));
+ run(&mut s, "sheet.flange", json!({"sketch": "Blank"}));
+ run(&mut s, "sheet.fold", json!({"points": [[40, 0, 2.5], [40, 60, 2.5]], "fixed": [90, 30, 2.5], "name": "Fold1"}));
+ run(&mut s, "parameters.change", json!({"name": "w", "expression": "80 mm"}));
+ let fold = run(&mut s, "timeline.inspect", json!({"feature": "Fold1"}));
+ assert!(fold["error"].is_null(), "the fold fails after the width change: {}", fold["error"]);
+ // The +x side (where the point is) stays flat out to the new width; the -x side stands up.
+ let bb = &run(&mut s, "inspect.measure", json!({}))["bodies"][0]["bbox"];
+ assert!((bb["max"][0].as_f64().unwrap_or(0.0) - 80.0).abs() < 1e-6, "{bb}");
+ assert!(bb["max"][2].as_f64().unwrap_or(0.0) > 30.0, "{bb}");
+}