@@ -1616,6 +1616,42 @@ void NonFragmentingChildOf_depth_after_parent_remove_other_sibling_parent(void)
16161616 ecs_fini (world );
16171617}
16181618
1619+ void NonFragmentingChildOf_depth_after_parent_set_parent_sibling_traversable_no_children (void ) {
1620+ ecs_world_t * world = ecs_mini ();
1621+
1622+ ecs_entity_t root = ecs_new (world );
1623+ ecs_entity_t p = ecs_new (world );
1624+ ecs_entity_t c1 = ecs_insert (world , ecs_value (EcsParent , {p }));
1625+ ecs_entity_t c2 = ecs_insert (world , ecs_value (EcsParent , {p }));
1626+ ecs_add_id (world , c2 , EcsOrderedChildren );
1627+ ecs_entity_t gc2 = ecs_insert (world , ecs_value (EcsParent , {c2 }));
1628+
1629+ /* Make first sibling traversable without creating ChildOf record for it. */
1630+ ecs_new_w_pair (world , EcsIsA , c1 );
1631+
1632+ ecs_entities_t children = ecs_get_ordered_children (world , p );
1633+ test_int (children .count , 2 );
1634+ test_uint (children .ids [0 ], c1 );
1635+ test_uint (children .ids [1 ], c2 );
1636+
1637+ test_assert (ecs_has_id (world , c1 , ecs_value_pair (EcsParentDepth , 1 )));
1638+ test_assert (ecs_has_id (world , c2 , ecs_value_pair (EcsParentDepth , 1 )));
1639+ test_assert (ecs_has_id (world , gc2 , ecs_value_pair (EcsParentDepth , 2 )));
1640+
1641+ ecs_set (world , p , EcsParent , {root });
1642+
1643+ test_assert (ecs_has_id (world , c1 , ecs_value_pair (EcsParentDepth , 2 )));
1644+ test_assert (!ecs_has_id (world , c1 , ecs_value_pair (EcsParentDepth , 1 )));
1645+
1646+ test_assert (ecs_has_id (world , c2 , ecs_value_pair (EcsParentDepth , 2 )));
1647+ test_assert (!ecs_has_id (world , c2 , ecs_value_pair (EcsParentDepth , 1 )));
1648+
1649+ test_assert (ecs_has_id (world , gc2 , ecs_value_pair (EcsParentDepth , 3 )));
1650+ test_assert (!ecs_has_id (world , gc2 , ecs_value_pair (EcsParentDepth , 2 )));
1651+
1652+ ecs_fini (world );
1653+ }
1654+
16191655void NonFragmentingChildOf_depth_after_parent_reparent (void ) {
16201656 ecs_world_t * world = ecs_mini ();
16211657
0 commit comments