SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Sketch Fillet and Chamfer: a refused size's error goes once the size fits (#9316) (#9469)
DuBeartea1dc849e8db2
diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rsindex 3f827d9e3b..c935ad23cd 100644--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@ -2861,11 +2861,6 @@ fn error_rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui: &mut{d.refuse(app, error);}- // For Corner dialogs (fillet/chamfer), propagate preview errors to `d.error`- // so impossible sizes still show a refusal message and tests can check it.- if matches!(d.kind, Kind::SketchModify(crate::sketch_modify_ui::Mod::Corner { .. })) && app.preview.error.is_some() && d.error.is_none() {- d.error = app.preview.error.clone();- }let shown_id = egui::Id::new("sc_dialog_refusal_shown");if d.error.is_none() && app.preview.error.is_none() {ui.data_mut(|m| m.remove::<String>(shown_id));diff --git a/crates/ui-egui/src/sketch_corner_ui_tests.rs b/crates/ui-egui/src/sketch_corner_ui_tests.rsindex b51f486edc..cdc3cf6802 100644--- a/crates/ui-egui/src/sketch_corner_ui_tests.rs+++ b/crates/ui-egui/src/sketch_corner_ui_tests.rs@@ -545,6 +545,27 @@ fn escape_leaves_the_sketch_and_the_history_untouched() {assert_eq!((h.app.session.doc.to_json(), h.app.session.undo.len()), before);}+/// #9316: the refusal of a size being typed (`4 m` on the way to `4 mm`) goes once the size fits.+#[test]+fn a_refused_size_gives_way_to_one_that_fits() {+ let mut h = crate::scenario::Harness::new();+ h.app.run("sketch.create", json!({"plane":"XY"})).unwrap();+ h.app.run("sketch.rectangle.two_point", json!({"p0":[0,0],"p1":[20,30]})).unwrap();+ h.frames(2);+ h.step(&json!({"start":"sketch.fillet"})).unwrap();+ h.frames(2);+ h.step(&json!({"click":{"world":[0,0,0]}})).unwrap();+ h.frames(2);+ let shown = |h: &mut crate::scenario::Harness, size: &str| {+ set_size(&mut h.app, size);+ h.settle();+ h.frames(2);+ h.app.dialog.as_ref().and_then(|d| d.error.clone()).or_else(|| h.app.preview.error.clone())+ };+ assert!(shown(&mut h, "4 m").is_some_and(|e| e.contains("too large")));+ assert_eq!(shown(&mut h, "4 mm"), None);+}+/// A size the corner cannot take is refused with a reason, and the window stays open on it.#[test]fn an_impossible_size_keeps_the_window_open_with_its_reason() {