aboutsummaryrefslogtreecommitdiff
path: root/tests/world-test.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/world-test.scm')
-rw-r--r--tests/world-test.scm17
1 files changed, 17 insertions, 0 deletions
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")