From b11841b0bc79ff07198ed58365d3994d37f41611 Mon Sep 17 00:00:00 2001 From: Jonas Wrede Date: Tue, 13 Oct 2026 08:28:01 +0200 Subject: [PATCH] test: failing regression test for #532 (ignored until fixed): Physical materials: no user-defined materials (library is fixed to 14 entries) (#554) Adds an ignored regression test for #532; it runs once #532 is fixed. --- .../engine/src/cmd/component_properties_tests.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/crates/engine/src/cmd/component_properties_tests.rs b/crates/engine/src/cmd/component_properties_tests.rs index aeace213..a4e1fae3 100644 --- a/crates/engine/src/cmd/component_properties_tests.rs +++ b/crates/engine/src/cmd/component_properties_tests.rs @@ -127,3 +127,19 @@ fn excessively_nested_assembly_refuses_partial_totals() { let error = s.execute("component.properties", &json!({"component": 0})).unwrap_err(); assert!(error.to_string().contains("traversal limits"), "{error}"); } + +/// #532: a product BOM needs materials outside the built-in library (walnut, polypropylene, +/// rubber, leather). A user-defined material with its density is assigned like a built-in one +/// and sets the body's mass: a 10 mm walnut cube at 0.65 g/cm³ weighs 0.65 g. +#[test] +#[ignore = "fails until #532 is fixed"] +fn user_defined_material_sets_the_body_mass() { + let mut s = Session::default(); + run(&mut s, "solid.box", json!({"length": 10, "width": 10, "height": 10, "body_name": "Slat"})); + run(&mut s, "material.create", json!({"name": "Walnut", "density_g_cm3": 0.65})); + run(&mut s, "material.assign", json!({"bodies": ["Slat"], "material": "Walnut"})); + let props = run(&mut s, "component.properties", json!({"component": "root"})); + assert_eq!(props["bodies"][0]["material"], "Walnut", "{props}"); + close(&props["bodies"][0]["density_g_cm3"], 0.65); + close(&props["total"]["mass_g"], 0.65); +}