Stroke: a test that stroke.set refuses a bad target with an id

stroke.set names its appearance item through item_target_at as the paint commands do. The test
fails without the change to item_target_at: stroke.set with `target: "content"` and an `id`
answered {objects: 1}.
This commit is contained in:
dotCooCoo committed 2026-11-28 12:22:26 -08:00
1 parent 38f28d231b
commit 8285a7b2cf
1 file changed
+17
+17
View File
@@ -513,6 +513,23 @@ fn a_bad_target_is_refused_with_an_id_or_selected_characters() {
}
}
/// The other commands that name their appearance item the same way refuse a bad `target` with an
/// `id` or `ids` too, and leave the document alone; a good one still edits the object.
#[test]
fn a_stroke_edit_refuses_a_bad_target_with_an_id() {
let mut s = session();
let r = rect(&mut s, 10.0);
select(&mut s, &[r]);
let doc = s.doc().unwrap().doc.clone();
for p in [json!({"weight": 9, "target": "content", "id": r.0}), json!({"weight": 9, "target": "content", "ids": [r.0]})] {
let e = s.execute("stroke.set", &p).unwrap_err();
assert!(e.to_string().contains("`target` must be"), "{p}: {e}");
assert_eq!(*s.doc().unwrap().doc, *doc, "{p}");
}
s.execute("stroke.set", &json!({"weight": 9, "target": "object", "id": r.0})).unwrap();
assert_ne!(*s.doc().unwrap().doc, *doc);
}
/// A gradient mesh point picked with the Mesh tool takes a fill opacity itself, and the proxy shows
/// it; the object's fill item and the other points stay as they were.
#[test]