test: land the remaining ignored regression tests from #548-#573 (#582)

Ignored regression tests for #530, #531, #541, #542, #545, #547 and #570, from #548, #549, #550, #552, #555, #573 and #572.

Co-authored-by: jonaswre <jonas.wrede@beyondit.gmbh>
This commit is contained in:
bherbruckandjonaswre authored and GitHub committed 2026-10-13 02:51:12 -04:00
1 parent b1740aeee5
commit 1abd989a67
5 files changed
+179

No files matched your search

+56
View File
@@ -454,3 +454,59 @@ fn screenshot_renders_a_saved_named_view() {
assert!(photo.starts_with("iVBORw0KGgo"), "not a PNG");
assert_ne!(photo, iso, "the named view rendered like the standard iso view");
}
/// #530: in a design with many bodies every feature result lists all of them, so a batch reply
/// is mostly the same body list once per step. A compact batch reply names only what each step
/// added or changed.
#[test]
#[ignore = "fails until #530 is fixed"]
fn compact_batch_reply_does_not_repeat_the_body_list() {
let mut s = server();
let cube =
|x: i64, y: i64| json!({"command": "solid.box", "params": {"length": 1, "width": 1, "height": 1, "corner": [x, y, 0], "operation": "new"}});
let existing: Vec<Value> = (0..50).map(|i| cube(2 * i, 0)).collect();
tool(&mut s, "batch", json!({"commands": existing}));
let more: Vec<Value> = (0..3).map(|i| cube(2 * i, 5)).collect();
let r = raw_tool(&mut s, "batch", json!({"commands": more, "verbose": false}));
assert!(r.get("error").is_none() && r["result"]["isError"] != json!(true), "{r}");
let reply = r["result"]["content"][0]["text"].as_str().unwrap_or_default();
assert_eq!(tool(&mut s, "measure", json!({}))["body_count"], 53);
// The new bodies are named; the 50 untouched ones are not repeated.
for new in ["Body51", "Body52", "Body53"] {
assert!(reply.contains(&format!("\"{new}\"")), "{new} missing from the compact reply: {reply}");
}
for old in ["Body1", "Body25", "Body50"] {
assert!(!reply.contains(&format!("\"{old}\"")), "untouched {old} repeated in the compact reply ({} bytes): {reply}", reply.len());
}
}
/// #531: a product model keeps an optional variant hidden in its default presentation. Hiding
/// it must survive saving and reopening the design (suppressing it would change the design).
#[test]
#[ignore = "fails until #531 is fixed"]
fn hidden_body_stays_hidden_after_save_and_reopen() {
let mut s = server();
tool(&mut s, "execute", json!({"command": "solid.box", "params": {"length": 10, "width": 10, "height": 10, "body_name": "Base"}}));
tool(
&mut s,
"execute",
json!({"command": "solid.box", "params": {"length": 5, "width": 5, "height": 5, "corner": [20, 0, 0], "operation": "new", "body_name": "Variant"}}),
);
tool(&mut s, "execute", json!({"command": "browser.visibility", "params": {"items": ["Variant"], "visible": false}}));
let visible = |s: &mut Server, body: &str| {
let d = tool(s, "inspect_design", json!({"measure": false}));
d["bodies"].as_array().into_iter().flatten().find(|b| b["name"] == body).map(|b| b["visible"].clone()).unwrap_or(Value::Null)
};
assert_eq!(visible(&mut s, "Variant"), false);
let dir = std::env::temp_dir().join(format!("solidcraft-mcp-visibility-{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let design = dir.join("variants.solidcraft");
tool(&mut s, "save", json!({"path": design.to_string_lossy()}));
tool(&mut s, "new_design", json!({"name": "Empty"}));
tool(&mut s, "open", json!({"path": design.to_string_lossy()}));
let (base, variant) = (visible(&mut s, "Base"), visible(&mut s, "Variant"));
let _ = std::fs::remove_dir_all(&dir);
assert_eq!(base, true);
assert_eq!(variant, false, "the hidden body is visible again after reopening");
}