Fix #263: explain property-group references in property commands

This commit is contained in:
DWAA1660
2026-10-08 08:49:42 -06:00
parent 6943872cf6
commit 69310216fb
5 changed files with 55 additions and 4 deletions
+20
View File
@@ -402,6 +402,26 @@ fn set_text_paragraph_fill_and_leading() {
assert_eq!((d.h_scale, d.v_scale, d.baseline_shift, d.small_caps, d.stroke_over_fill), (120.0, 80.0, 4.0, true, true));
}
#[test]
fn property_groups_report_actionable_errors() {
let mut s = Session::default();
s.execute("comp.new", json!({"name": "T"})).unwrap();
let l = s.execute("layer.newText", json!({"text": "Hi"})).unwrap()["layer"].as_u64().unwrap();
let uid = s.active_comp().unwrap().layer(crate::project::LayerId(l)).unwrap().props.group("text/pathOptions").unwrap().uid;
for selector in [json!({"path": "text"}), json!({"path": "text/pathOptions"}), json!({"path": format!("@{uid}")}), json!({"prop": uid})] {
let mut params = selector;
params["layer"] = json!(l);
for cmd in ["prop.get", "prop.set"] {
let err = s.execute(cmd, params.clone()).unwrap_err().to_string();
assert!(err.contains("is a property group"), "{cmd}: {err}");
assert!(err.contains("get_layer"), "{cmd}: {err}");
}
}
assert!(s.execute("prop.get", json!({"layer": l, "path": "text/sourceText"})).is_ok());
let err = s.execute("prop.get", json!({"layer": l, "path": "missing"})).unwrap_err().to_string();
assert!(err.contains("no property `missing`"), "{err}");
}
#[test]
fn prop_get_and_render_rgba8() {
let mut s = Session::default();