mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-29 20:47:18 -06:00
#1061: Enter renames the selected effect, text animator, mask or shape group
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
470ea7a3af
commit
42c7a7141e
@@ -167,3 +167,26 @@ fn delete_removes_selected_groups_not_their_layer() {
|
||||
delete(&mut s);
|
||||
assert!(s.active_comp().unwrap().layer(LayerId(t)).is_none(), "a fixed group selected: the layer goes");
|
||||
}
|
||||
|
||||
/// #1061: text animators, masks and shape groups rename like effects, with undo; fixed groups and
|
||||
/// empty names are refused.
|
||||
#[test]
|
||||
fn text_animators_masks_and_shape_groups_rename() {
|
||||
let mut s = Session::default();
|
||||
s.execute("comp.new", json!({"name": "C", "width": 64, "height": 64, "duration": 1})).unwrap();
|
||||
let t = s.execute("layer.newText", json!({"text": "ABCD"})).unwrap()["layer"].as_u64().unwrap();
|
||||
s.execute("layer.addTextAnimator", json!({"layer": t, "properties": ["tracking"]})).unwrap();
|
||||
let sh = s.execute("layer.newShape", json!({"kind": "star"})).unwrap()["layer"].as_u64().unwrap();
|
||||
s.execute("layer.addMask", json!({"layer": sh, "shape": "ellipse"})).unwrap();
|
||||
let uid = |s: &Session, l: u64, path: &str| s.active_comp().unwrap().layer(LayerId(l)).unwrap().props.group(path).unwrap().groups().next().unwrap().uid;
|
||||
let name = |s: &Session, l: u64, u: u64| s.active_comp().unwrap().layer(LayerId(l)).unwrap().props.find_group(u).unwrap().name.clone();
|
||||
for (l, path, new) in [(t, "text/animators", "Wiggle In"), (sh, "masks", "Reveal"), (sh, "contents", "Star Body")] {
|
||||
let u = uid(&s, l, path);
|
||||
let old = name(&s, l, u);
|
||||
s.execute("prop.renameGroup", json!({"layer": l, "prop": u, "name": new})).unwrap();
|
||||
assert_eq!(name(&s, l, u), new, "{path}");
|
||||
s.execute("edit.undo", json!({})).unwrap();
|
||||
assert_eq!(name(&s, l, u), old, "{path} undone");
|
||||
assert!(s.execute("prop.renameGroup", json!({"layer": l, "prop": u, "name": " "})).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user