Type: test that a locked current layer sends Create Font Sheet to the topmost editable layer

This commit is contained in:
dotCooCoo committed 2026-12-01 01:01:44 -08:00
1 parent 54dc83187b
commit f80c7d33ac
1 file changed
+14
@@ -416,3 +416,17 @@ fn a_locked_layer_takes_no_sheet() {
assert!(s.execute(COMMAND, &json!({"families": ["Inter"]})).is_err());
assert_eq!(steps(&s), before);
}
#[test]
fn a_locked_current_layer_sends_the_sheet_to_the_topmost_editable_layer() {
let mut s = session();
let editable = s.doc().unwrap().doc.layers[0].id;
let locked = NodeId(s.execute("layer.new", &json!({})).unwrap()["id"].as_u64().unwrap());
s.execute("layer.setProps", &json!({"id": locked.0, "locked": true})).unwrap();
let r = s.execute(COMMAND, &json!({"families": ["Inter"]})).unwrap();
let gid = NodeId(r["id"].as_u64().unwrap());
let doc = &s.doc().unwrap().doc;
let holds = |layer: NodeId| doc.children(Some(layer)).is_some_and(|c| c.iter().any(|n| n.id == gid));
assert!(holds(editable), "the sheet goes to the layer that is shown and unlocked");
assert!(!holds(locked));
}