From f80c7d33ac62a9e37956fdd675fa99af1eaf49da Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 30 Nov 2026 22:39:51 -0800 Subject: [PATCH] Type: test that a locked current layer sends Create Font Sheet to the topmost editable layer --- .../src/cmd/addons/typetools/font_sheet/tests.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/engine/src/cmd/addons/typetools/font_sheet/tests.rs b/crates/engine/src/cmd/addons/typetools/font_sheet/tests.rs index 5119d6c339..a64d79c7a2 100644 --- a/crates/engine/src/cmd/addons/typetools/font_sheet/tests.rs +++ b/crates/engine/src/cmd/addons/typetools/font_sheet/tests.rs @@ -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)); +}