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 <noreply@anthropic.com>
This commit is contained in:
DuBearteandClaude Opus 5.5 authored and GitHub committed 2026-11-01 21:25:21 +00:00
1 parent 446590dca1
commit a1dc849e8d
2 files changed
+21 -5

No files matched your search

-5
View File
@@ -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));
@@ -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() {