forked from 1b-agent/opencadstudio-upstream
fix(layers): push undo for transparency edits
LayerTransparencyEdit applied without begin/commit_layer_undo, so the edit was permanent while every sibling arm is undoable. Mirrors the color arm inside the non-empty guard. Test: layer_transparency_edit_pushes_undo asserts the entry plus undo-restores (RED first). Full suite: 1991 passed / 0 failed / 25 ignored.
This commit is contained in:
1 parent
1bf584a1c1
commit
4471260c00
2 files changed
+47
-14
No files matched your search
@@ -4656,6 +4656,37 @@ mod layer_name_target_tests {
|
||||
.collect();
|
||||
assert_eq!(before, after, "unknown name must change nothing");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn layer_transparency_edit_pushes_undo() {
|
||||
// #43: every sibling layer arm pushes an undo entry; transparency must too.
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
app.automation_op(r#"{"op":"new"}"#);
|
||||
let i = app.active_tab;
|
||||
app.finish_pending_history(i);
|
||||
let before = app.tabs[i].history.undo_stack.len();
|
||||
let _ = app.update(Message::LayerTransparencyEdit("0".to_string(), "50".to_string()));
|
||||
assert_eq!(
|
||||
app.tabs[i].history.undo_stack.len(),
|
||||
before + 1,
|
||||
"transparency edit must push an undo entry like its siblings"
|
||||
);
|
||||
let panel = app.tabs[i]
|
||||
.layers
|
||||
.layers
|
||||
.iter()
|
||||
.find(|l| l.name == "0")
|
||||
.expect("layer 0 in panel");
|
||||
assert_eq!(panel.transparency, 50);
|
||||
app.undo_active_tab();
|
||||
let panel = app.tabs[i]
|
||||
.layers
|
||||
.layers
|
||||
.iter()
|
||||
.find(|l| l.name == "0")
|
||||
.expect("layer 0 in panel");
|
||||
assert_eq!(panel.transparency, 0, "undo must restore transparency");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in new issue
Block a user