mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
Tests: the Expand Appearance reply test fails when the reply leaves out the expanded object (#3374)
the_reply_names_each_expanded_copy_by_its_own_id checked that no id in the effect.expandAppearance reply repeats and that each one names a node in the document. Only for group copies did it check which ids the reply holds. In the other four cases a reply that left out the expanded object, or held no ids at all, passed. The test now checks in every case that the reply starts with the id of the selected object, and keeps the exact check of the group and the two copies of the square for group copies.
This commit is contained in:
@@ -159,9 +159,10 @@ fn expanded_art_keeps_the_random_transforms_the_canvas_drew() {
|
||||
assert_eq!(differ, RANDOM_CASES.map(|case| (case, 0)));
|
||||
}
|
||||
|
||||
/// The reply lists each object whose appearance expanded once, by the id it has in the document.
|
||||
/// In "group copies" the two copies of the square share an id until Expand Appearance gives them
|
||||
/// ids of their own, and the reply names the group, then each copy by its new id.
|
||||
/// The reply lists each object whose appearance expanded once, by the id it has in the document,
|
||||
/// starting with the selected object. In "group copies" the two copies of the square share an id
|
||||
/// until Expand Appearance gives them ids of their own, and the reply names the group, then each
|
||||
/// copy by its new id.
|
||||
#[test]
|
||||
fn the_reply_names_each_expanded_copy_by_its_own_id() {
|
||||
for case in RANDOM_CASES {
|
||||
@@ -169,6 +170,7 @@ fn the_reply_names_each_expanded_copy_by_its_own_id() {
|
||||
let id = random_transforms(&mut s, case);
|
||||
let r = run(&mut s, "effect.expandAppearance", json!({}));
|
||||
let ids: Vec<u64> = r["ids"].as_array().unwrap().iter().map(|v| v.as_u64().unwrap()).collect();
|
||||
assert_eq!(ids.first(), Some(&id.0), "{case}: {ids:?}");
|
||||
let unique: std::collections::HashSet<_> = ids.iter().collect();
|
||||
assert_eq!(unique.len(), ids.len(), "{case}: {ids:?}");
|
||||
assert!(ids.iter().all(|&i| s.doc().unwrap().doc.node(NodeId(i)).is_some()), "{case}: {ids:?}");
|
||||
|
||||
Reference in New Issue
Block a user