From a1dc849e8db28ee9718cb2ce089cf4bc8bf18588 Mon Sep 17 00:00:00 2001 From: DuBearte <130190089+DuBearte@users.noreply.github.com> Date: Sun, 1 Nov 2026 21:25:21 +0000 Subject: [PATCH] Sketch Fillet and Chamfer: a refused size's error goes once the size fits (#9316) (#9469) A corner dialog copied the preview's error into its own, where nothing cleared it when the preview recovered. The dialog already shows the preview's error, so the copy is gone. Co-authored-by: Claude Opus 5.5 --- crates/ui-egui/src/dialogs.rs | 5 ----- crates/ui-egui/src/sketch_corner_ui_tests.rs | 21 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 3f827d9e3..c935ad23c 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::(shown_id)); diff --git a/crates/ui-egui/src/sketch_corner_ui_tests.rs b/crates/ui-egui/src/sketch_corner_ui_tests.rs index b51f486ed..cdc3cf680 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() {