summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-16 22:55:10 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commit7e3475a779f9e8dcb14b96cfc59e2b92a20c0cda (patch)
treefe1111672776bb131b7698d0aa3d69b94a082fff /test
parent0c10f9668b3ef67ce1eb83db435aaa94b35df012 (diff)
downloadsketchbook-7e3475a779f9e8dcb14b96cfc59e2b92a20c0cda.tar.gz
sketchbook-7e3475a779f9e8dcb14b96cfc59e2b92a20c0cda.zip
anim: the stock player runs on the Deck
The player's State is an anim.Deck plus the viewer's settings; keys and clicks become an Ask: click, space and page down step (space plays or pauses a scene with no pause), page up and backspace go back a step, ] and [ go a slide, P plays or pauses, left/right/home/end/,/. seek through Ask.to and Ask.end. A compiled scene is a talk without gates. The HUD shows the slide and step, and when the talk waits. Exported, each pause holds the scene file's hold (1 s). Its frozen hold (held, stopBetween, proceed) is gone. Scripts read deck.t and deck.playing where they read t and playing.
Diffstat (limited to 'test')
-rw-r--r--test/scene_compiled.script2
-rw-r--r--test/scene_live.script21
2 files changed, 14 insertions, 9 deletions
diff --git a/test/scene_compiled.script b/test/scene_compiled.script
index 3c9ef44..df2d62f 100644
--- a/test/scene_compiled.script
+++ b/test/scene_compiled.script
@@ -2,7 +2,7 @@
# 30 fps, 640x360, so half size, played once without the player's controls).
frames 30
screenshot .zig-cache/anim/compiled-written.png
-console set t 1.5
+console set deck.t 1.5
frames 1
screenshot .zig-cache/anim/compiled-morph.png
# Frame 68 is 2.27 s in: the dot over the panel's corner, at half size.
diff --git a/test/scene_live.script b/test/scene_live.script
index 30b2087..e480d8d 100644
--- a/test/scene_live.script
+++ b/test/scene_live.script
@@ -1,6 +1,9 @@
-# The live test scene, through the player. It holds at the pause.
+# The live test scene, through the player. At the pause it waits for a
+# click, time running on and nothing after the pause starting.
frames 150
-expect t 2
+expect deck.waiting true
+expect deck.t 2.5 ~0.02
+expect deck.log.len 0
screenshot .zig-cache/anim/live.png
# The custom panel is over the circle added before it,
expect-pixel .zig-cache/anim/live.png 600 330 32 64 96 255 1
@@ -11,23 +14,25 @@ expect-pixel .zig-cache/anim/live.png 725 400 131 193 103 255 1
expect-pixel .zig-cache/anim/live.png 600 390 240 172 95 255 1
expect-pixel .zig-cache/anim/live.png 680 390 32 64 96 255 1
# Half way through its move it is half way.
-console set playing false
-console set t 1.5
+console set deck.playing false
+console set deck.t 1.5
screenshot .zig-cache/anim/live-moving.png
expect-pixel .zig-cache/anim/live-moving.png 400 330 32 64 96 255 1
expect-pixel .zig-cache/anim/live-moving.png 600 330 252 98 85 255 1
# The CPU renderer layers the same way.
-console set t 2
+console set deck.t 2
key b
expect backend cpu
screenshot .zig-cache/anim/live-cpu.png
expect-pixel .zig-cache/anim/live-cpu.png 600 330 32 64 96 255 1
expect-pixel .zig-cache/anim/live-cpu.png 725 400 131 193 103 255 1
key b
-# A click continues: the camera zooms to 2 and the panel fades to half,
-# over the background where it now reaches.
+# A click opens the pause and plays on: the camera zooms to 2 and the
+# panel fades to half, over the background where it now reaches.
click 640 360
-expect playing true
+expect deck.playing true
+expect deck.log.len 1
+expect deck.waiting false
frames 70
screenshot .zig-cache/anim/live-zoom.png
expect-pixel .zig-cache/anim/live-zoom.png 800 300 30 46 64 255 2