diff options
| author | Gene Pasquet <dev@etenil.net> | 2026-04-18 05:59:07 +0100 |
|---|---|---|
| committer | Gene Pasquet <dev@etenil.net> | 2026-04-18 05:59:07 +0100 |
| commit | 84f251ee6e829d33a4f29aa4043924023a378724 (patch) | |
| tree | ab03d18fa192303bf2e1758743ac16c11d9da87f /tests/renderer-test.scm | |
| parent | c2085be2dd2a0cb3da05991847e35080915e547e (diff) | |
Re-format
Diffstat (limited to 'tests/renderer-test.scm')
| -rw-r--r-- | tests/renderer-test.scm | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/tests/renderer-test.scm b/tests/renderer-test.scm index 3a85c73..cd4c5d9 100644 --- a/tests/renderer-test.scm +++ b/tests/renderer-test.scm @@ -61,43 +61,43 @@ (let* ((cam (make-camera x: 10 y: 20)) (e (entity #:x 50 #:y 80 #:width 16 #:height 16))) (test "subtracts camera offset from x" - 40 - (car (entity-screen-coords e cam))) + 40 + (car (entity-screen-coords e cam))) (test "subtracts camera offset from y" - 60 - (cadr (entity-screen-coords e cam))) + 60 + (cadr (entity-screen-coords e cam))) (test "preserves width" - 16 - (caddr (entity-screen-coords e cam))) + 16 + (caddr (entity-screen-coords e cam))) (test "preserves height" - 16 - (cadddr (entity-screen-coords e cam)))) + 16 + (cadddr (entity-screen-coords e cam)))) (let* ((cam (make-camera x: 0 y: 0)) (e (entity #:x 100.7 #:y 200.3 #:width 16 #:height 16))) (test "floors fractional x" - 100 - (car (entity-screen-coords e cam))) + 100 + (car (entity-screen-coords e cam))) (test "floors fractional y" - 200 - (cadr (entity-screen-coords e cam)))) + 200 + (cadr (entity-screen-coords e cam)))) (let* ((cam (make-camera x: 0 y: 0)) (e (entity #:x 0 #:y 0 #:width 32 #:height 32))) (test "zero camera, zero position" - '(0 0 32 32) - (entity-screen-coords e cam)))) + '(0 0 32 32) + (entity-screen-coords e cam)))) (test-group "entity-flip" (test "facing 1: no flip" - '() - (entity-flip (entity #:facing 1))) + '() + (entity-flip (entity #:facing 1))) (test "facing -1: horizontal flip" - '(horizontal) - (entity-flip (entity #:facing -1))) + '(horizontal) + (entity-flip (entity #:facing -1))) (test "no facing key: defaults to no flip" - '() - (entity-flip (entity #:x 0)))) + '() + (entity-flip (entity #:x 0)))) (test-group "render-scene!" (let* ((cam (make-camera x: 0 y: 0)) @@ -134,34 +134,34 @@ (test-group "sprite-font" (test-group "make-sprite-font*" (let ((font (make-sprite-font* tile-size: 8 spacing: 1 - ranges: (list (list #\A #\C 100))))) + ranges: (list (list #\A #\C 100))))) (test "A maps to 100" - 100 - (sprite-font-char->tile-id font #\A)) + 100 + (sprite-font-char->tile-id font #\A)) (test "B maps to 101" - 101 - (sprite-font-char->tile-id font #\B)) + 101 + (sprite-font-char->tile-id font #\B)) (test "C maps to 102" - 102 - (sprite-font-char->tile-id font #\C)))) + 102 + (sprite-font-char->tile-id font #\C)))) (test-group "sprite-font-char->tile-id" (let ((font (make-sprite-font* tile-size: 8 spacing: 1 - ranges: (list (list #\A #\Z 100))))) + ranges: (list (list #\A #\Z 100))))) (test "returns #f for unmapped char" - #f - (sprite-font-char->tile-id font #\1)) + #f + (sprite-font-char->tile-id font #\1)) (test "auto-upcase: lowercase a maps to uppercase" - 100 - (sprite-font-char->tile-id font #\a)))) + 100 + (sprite-font-char->tile-id font #\a)))) (test-group "overlapping ranges" (import (chicken condition)) (let ((caught-error #f)) (condition-case - (make-sprite-font* tile-size: 8 spacing: 1 - ranges: (list (list #\A #\C 100) - (list #\B #\D 200))) + (make-sprite-font* tile-size: 8 spacing: 1 + ranges: (list (list #\A #\C 100) + (list #\B #\D 200))) (e (exn) (set! caught-error #t))) (test-assert "signals error on overlapping range" @@ -169,19 +169,19 @@ (test-group "sprite-text-width" (let ((font (make-sprite-font* tile-size: 8 spacing: 1 - ranges: (list (list #\A #\Z 100))))) + ranges: (list (list #\A #\Z 100))))) (test "empty string width is 0" - 0 - (sprite-text-width font "")) + 0 + (sprite-text-width font "")) (test "single char width is tile-size" - 8 - (sprite-text-width font "A")) + 8 + (sprite-text-width font "A")) (test "two chars: 2*tile-size + 1*spacing" - 17 - (sprite-text-width font "AB")) + 17 + (sprite-text-width font "AB")) (test "three chars: 3*tile-size + 2*spacing" - 26 - (sprite-text-width font "ABC")))) + 26 + (sprite-text-width font "ABC")))) (test-group "draw-sprite-text" (let* ((font (make-sprite-font* tile-size: 8 spacing: 1 @@ -303,7 +303,7 @@ (test-assert "render-scene! works with plist entities" (begin (render-scene! #f scene-ok) #t)) (test-error "render-scene! errors when entity list contains a vector" - (render-scene! #f scene-bad)) + (render-scene! #f scene-bad)) (test-assert "extracting entity from cell vector fixes the issue" (let ((scene-fixed (make-scene entities: (list (vector-ref cell 0)) tilemap: tilemap camera: cam |
