aboutsummaryrefslogtreecommitdiff
path: root/tests/tween-test.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tween-test.scm')
-rw-r--r--tests/tween-test.scm30
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/tween-test.scm b/tests/tween-test.scm
index 31b4de3..1e19a4b 100644
--- a/tests/tween-test.scm
+++ b/tests/tween-test.scm
@@ -69,7 +69,7 @@
(let ((calls 0))
(let* ((ent (entity #:type 'a #:x 0))
(tw (make-tween ent props: '((#:x . 10)) duration: 10 delay: 0 ease: 'linear
- on-complete: (lambda (_) (set! calls (+ calls 1))))))
+ on-complete: (lambda (_) (set! calls (+ calls 1))))))
(receive (tw2 e2) (tween-step tw ent 10)
(test "one call" 1 (begin calls))
(receive (tw3 e3) (tween-step tw2 e2 5)
@@ -88,7 +88,7 @@
(test-group "repeat: 1 plays twice"
(let* ((ent (entity #:type 'a #:x 0))
(tw (make-tween ent props: '((#:x . 100)) duration: 100
- ease: 'linear repeat: 1)))
+ ease: 'linear repeat: 1)))
(receive (tw2 e2) (tween-step tw ent 100)
(test-assert "not finished after first play" (not (tween-finished? tw2)))
(test "x at target" 100.0 (entity-ref e2 #:x))
@@ -99,7 +99,7 @@
(test-group "repeat: -1 never finishes"
(let* ((ent (entity #:type 'a #:x 0))
(tw (make-tween ent props: '((#:x . 10)) duration: 10
- ease: 'linear repeat: -1)))
+ ease: 'linear repeat: -1)))
(let loop ((tw tw) (ent ent) (i 0))
(if (>= i 5) (test-assert "still active after 5 cycles" (tween-active? tw))
(receive (tw2 e2) (tween-step tw ent 10)
@@ -116,8 +116,8 @@
(let ((calls 0))
(let* ((ent (entity #:type 'a #:x 0))
(tw (make-tween ent props: '((#:x . 10)) duration: 10
- ease: 'linear repeat: 1
- on-complete: (lambda (_) (set! calls (+ calls 1))))))
+ ease: 'linear repeat: 1
+ on-complete: (lambda (_) (set! calls (+ calls 1))))))
(receive (tw2 e2) (tween-step tw ent 10)
(test "no call after first play" 0 (begin calls))
(receive (tw3 e3) (tween-step tw2 e2 10)
@@ -127,8 +127,8 @@
(let ((calls 0))
(let* ((ent (entity #:type 'a #:x 0))
(tw (make-tween ent props: '((#:x . 10)) duration: 10
- ease: 'linear repeat: -1
- on-complete: (lambda (_) (set! calls (+ calls 1))))))
+ ease: 'linear repeat: -1
+ on-complete: (lambda (_) (set! calls (+ calls 1))))))
(let loop ((tw tw) (ent ent) (i 0))
(if (>= i 5) (test "never called" 0 (begin calls))
(receive (tw2 e2) (tween-step tw ent 10)
@@ -138,7 +138,7 @@
(test-group "yoyo: #t with repeat: 1 reverses"
(let* ((ent (entity #:type 'a #:x 0))
(tw (make-tween ent props: '((#:x . 100)) duration: 100
- ease: 'linear repeat: 1 yoyo?: #t)))
+ ease: 'linear repeat: 1 yoyo?: #t)))
(receive (tw2 e2) (tween-step tw ent 100)
(test "x at target after forward" 100.0 (entity-ref e2 #:x))
(receive (tw3 e3) (tween-step tw2 e2 50)
@@ -150,7 +150,7 @@
(test-group "yoyo: #t with repeat: -1 ping-pongs forever"
(let* ((ent (entity #:type 'a #:x 0))
(tw (make-tween ent props: '((#:x . 100)) duration: 100
- ease: 'linear repeat: -1 yoyo?: #t)))
+ ease: 'linear repeat: -1 yoyo?: #t)))
;; Forward
(receive (tw2 e2) (tween-step tw ent 100)
(test "at target" 100.0 (entity-ref e2 #:x))
@@ -165,7 +165,7 @@
(test-group "yoyo: #f with repeat: 1 replays same direction"
(let* ((ent (entity #:type 'a #:x 0))
(tw (make-tween ent props: '((#:x . 100)) duration: 100
- ease: 'linear repeat: 1 yoyo?: #f)))
+ ease: 'linear repeat: 1 yoyo?: #f)))
(receive (tw2 e2) (tween-step tw ent 100)
(test "x at target" 100.0 (entity-ref e2 #:x))
;; Second play starts from same starts (0→100), but entity is at 100
@@ -176,7 +176,7 @@
(test-group "yoyo: #t without repeat has no effect"
(let* ((ent (entity #:type 'a #:x 0))
(tw (make-tween ent props: '((#:x . 100)) duration: 100
- ease: 'linear repeat: 0 yoyo?: #t)))
+ ease: 'linear repeat: 0 yoyo?: #t)))
(receive (tw2 e2) (tween-step tw ent 100)
(test-assert "finishes normally" (tween-finished? tw2))
(test "x at target" 100.0 (entity-ref e2 #:x))))))
@@ -185,7 +185,7 @@
(test-group "advances #:tween on entity"
(let* ((ent (entity #:type 'a #:x 0
#:tween (make-tween (entity #:x 0) props: '((#:x . 100))
- duration: 100 ease: 'linear)))
+ duration: 100 ease: 'linear)))
(e2 (step-tweens #f ent 50)))
(test "x moved to midpoint" 50.0 (entity-ref e2 #:x))
(test-assert "tween still attached" (entity-ref e2 #:tween #f))))
@@ -193,7 +193,7 @@
(test-group "removes #:tween when finished"
(let* ((ent (entity #:type 'a #:x 0
#:tween (make-tween (entity #:x 0) props: '((#:x . 100))
- duration: 100 ease: 'linear)))
+ duration: 100 ease: 'linear)))
(e2 (step-tweens #f ent 100)))
(test "x at target" 100.0 (entity-ref e2 #:x))
(test "tween removed" #f (entity-ref e2 #:tween #f))))
@@ -206,7 +206,7 @@
(test-group "keeps repeating tween attached"
(let* ((ent (entity #:type 'a #:x 0
#:tween (make-tween (entity #:x 0) props: '((#:x . 100))
- duration: 100 ease: 'linear repeat: -1 yoyo?: #t)))
+ duration: 100 ease: 'linear repeat: -1 yoyo?: #t)))
(e2 (step-tweens #f ent 100)))
(test "x at target" 100.0 (entity-ref e2 #:x))
(test-assert "tween still attached (repeating)" (entity-ref e2 #:tween #f))))
@@ -215,7 +215,7 @@
(let* ((ent (entity #:type 'a #:x 0
#:skip-pipelines '(tweens)
#:tween (make-tween (entity #:x 0) props: '((#:x . 100))
- duration: 100 ease: 'linear)))
+ duration: 100 ease: 'linear)))
(e2 (step-tweens #f ent 100)))
(test "x unchanged (skipped)" 0 (entity-ref e2 #:x))
(test-assert "tween still there" (entity-ref e2 #:tween #f)))))