* claim: #8100 * History: say why an edited feature behind the marker changes nothing (#8100) Editing a feature that sits after the history marker (double-clicking its greyed-out item) rolls back to it, previews the change, and on OK puts the marker back where it was: the feature stays rolled back, so nothing in the view changes and nothing says why. That is the silent "pattern of a cut does nothing" in #8100 (the reporter's design has its pattern behind the marker; on main the pattern itself builds fine once rolled forward). - timeline.redefine replies `rolled_back` and, when true, a `note`; it also carries the feature's `warning` (for a rolled-back feature, the one its constructor met building it at its place). - The window shows that note in the status line after such an edit. - A rolled-back item's tooltip in both History layouts says it is after the history marker and not built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Pending locale: Arabic, Hebrew, Japanese, Vietnamese and Chinese for the rolled-back notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
This commit is contained in:
@@ -1049,3 +1049,41 @@ fn pattern_count_integer_parameters_survive_save_and_reject_fractional_edits() -
|
||||
assert!(invalid.model.results.iter().any(|r| r.error.as_ref().is_some_and(|e| e.contains("a count must be a whole number;"))));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Editing a pattern behind the history marker (double-clicking its greyed-out item and pressing
|
||||
/// OK) changes nothing in the model: the reply says so, where the edit used to look as if it had
|
||||
/// silently failed, and it still carries what building the copies met (#8100).
|
||||
#[test]
|
||||
fn editing_a_rolled_back_pattern_says_it_is_not_built() {
|
||||
let mut s = Session::default();
|
||||
run(&mut s, "solid.box", json!({"length":40,"width":30,"height":10,"corner":[0,0,0],"body_name":"Plate"}));
|
||||
run(&mut s, "solid.cylinder", json!({"radius":2,"height":20,"base":[10,15,-5],"operation":"cut","targets":["Plate"],"name":"Cut"}));
|
||||
let pattern = |count: u32, origin: [f64; 3]| json!({"features":["Cut"],"axis":{"origin":origin,"dir":[0,0,1]},"count":count});
|
||||
let redefine = |count, origin| json!({"feature":"Pattern","command":"solid.pattern.circular","params":pattern(count, origin)});
|
||||
let centre = [20.0, 15.0, 0.0];
|
||||
let hole = PI * 4.0 * 10.0;
|
||||
let mut first = pattern(2, centre);
|
||||
first["name"] = json!("Pattern");
|
||||
let id = run(&mut s, "solid.pattern.circular", first)["feature"].as_u64().unwrap();
|
||||
assert!(rel(volume(&mut s), 12000.0 - 2.0 * hole) < 1e-4);
|
||||
// A pattern that is built: the edit is built at once, with nothing to say.
|
||||
let reply = run(&mut s, "timeline.redefine", redefine(3, centre));
|
||||
assert_eq!(reply["rolled_back"], json!(false), "{reply}");
|
||||
assert!(reply.get("note").is_none(), "{reply}");
|
||||
assert!(rel(volume(&mut s), 12000.0 - 3.0 * hole) < 1e-4);
|
||||
// Behind the marker: the edit is kept but not built, and the reply says why nothing changed.
|
||||
run(&mut s, "timeline.roll_to", json!({"position": 2}));
|
||||
let reply = run(&mut s, "timeline.redefine", redefine(4, centre));
|
||||
assert_eq!(reply["rolled_back"], json!(true), "{reply}");
|
||||
assert_eq!(reply["note"], "Pattern is after the history marker, so it is not built: move the marker past it to build it");
|
||||
assert!(reply.get("warning").is_none(), "{reply}");
|
||||
assert!(rel(volume(&mut s), 12000.0 - hole) < 1e-4);
|
||||
assert!(s.model.result(id).is_some_and(|r| r.skipped && r.error.is_none()));
|
||||
run(&mut s, "timeline.roll_to", json!({}));
|
||||
assert!(rel(volume(&mut s), 12000.0 - 4.0 * hole) < 1e-4);
|
||||
// What building the rolled-back copies met still reaches the reply: here a copy that misses.
|
||||
run(&mut s, "timeline.roll_to", json!({"position": 2}));
|
||||
let reply = run(&mut s, "timeline.redefine", redefine(2, [0.0, 0.0, 0.0]));
|
||||
assert_eq!(reply["rolled_back"], json!(true), "{reply}");
|
||||
assert_eq!(reply["warning"], "1 of 1 cut copies remove no material", "{reply}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user