From 138acad0186111e91dfe371056a042a93ab970af Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Wed, 28 Oct 2026 23:48:58 -0400 Subject: [PATCH] UI tests: a frame member's volume is compared to the accuracy SMLib measures at MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit a_whole_sketch_section_stays_whole_through_an_edit compared the ring member's volume before and after turning its section 30° to 1e-6. kernel::measure integrates at SMLib's finest relative accuracy, 1e-4 (measure::ACCURACY, the clamp SmApiBrepComputeMassProperties documents): the exact π (20² − 17²) 600 = 209230.07 mm³ came out 209229.86 before and 209230.43 after. The test compares to 1e-4; the filled circle it guards against is 3.6 times the ring. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/dialogs_frame_tests.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/dialogs_frame_tests.rs b/crates/ui-egui/src/dialogs_frame_tests.rs index 4a825f55c..6cfdd64df 100644 --- a/crates/ui-egui/src/dialogs_frame_tests.rs +++ b/crates/ui-egui/src/dialogs_frame_tests.rs @@ -139,7 +139,11 @@ fn a_whole_sketch_section_stays_whole_through_an_edit() { let c = apply_commands(&app, &e).unwrap(); assert!(c[0].1["params"].get("profiles").is_none(), "{}", c[0].1); run_all(&mut app, c); - assert!((volume(&mut app) - before).abs() < 1e-6 * before, "still the ring, not the filled circle"); + // To the accuracy SMLib measures at (1e-4 relative, the finest it takes: kernel + // `measure::ACCURACY`); the ring's exact π (20² − 17²) 600 = 209230.07 mm³ came out + // 209229.86 before the turn and 209230.43 after it. The filled circle would be 3.6 times it. + let after = volume(&mut app); + assert!((after - before).abs() < 1e-4 * before, "still the ring, not the filled circle: {after} mm³, {before} before"); // Unticked, the section is a built-in profile again. let mut e = edit_dialog(&app, f, None).unwrap(); member(&mut e).whole = None;