From f8cc4a748bb8b6431a1023a876745b1bb473eb19 Mon Sep 17 00:00:00 2001 From: Gene Pasquet Date: Wed, 8 Apr 2026 00:30:11 +0100 Subject: Support entity groups --- tests/world-test.scm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/world-test.scm') diff --git a/tests/world-test.scm b/tests/world-test.scm index b8c1a98..dbae9d9 100644 --- a/tests/world-test.scm +++ b/tests/world-test.scm @@ -277,4 +277,21 @@ (test-equal "returns all friendly entities" 2 (length (scene-find-all-tagged s 'friendly))) (test-equal "returns empty list when none match" '() (scene-find-all-tagged s 'boss)))) + (test-group "scene-sync-groups!" + (let* ((gid 'g1) + (origin (list #:type 'group-origin #:group-origin? #t #:group-id gid + #:x 100 #:y 200 #:width 0 #:height 0)) + (m1 (list #:type 'part #:group-id gid #:group-local-x 5 #:group-local-y 0 + #:x 0 #:y 0 #:width 8 #:height 8)) + (m2 (list #:type 'part #:group-id gid #:group-local-x 0 #:group-local-y 7 + #:x 0 #:y 0 #:width 8 #:height 8)) + (s (make-scene entities: (list origin m1 m2) tilemap: #f + camera: (make-camera x: 0 y: 0) tileset-texture: #f camera-target: #f))) + (scene-sync-groups! s) + (let ((es (scene-entities s))) + (test-equal "member 1 follows origin" 105 (entity-ref (list-ref es 1) #:x)) + (test-equal "member 1 y" 200 (entity-ref (list-ref es 1) #:y)) + (test-equal "member 2 x" 100 (entity-ref (list-ref es 2) #:x)) + (test-equal "member 2 y" 207 (entity-ref (list-ref es 2) #:y))))) + (test-end "world-module") -- cgit v1.2.3