summaryrefslogtreecommitdiff
path: root/test/talk.script
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-16 23:59:29 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commitaabb92d26f6b46cd4c482e0e2cbc8e9e9751db0d (patch)
treef5139ed90cf1747f3aa3aaa0f6266bab2a335c10 /test/talk.script
parentc7ebfb6d18c44fec676da3d683e0b4e54001bd21 (diff)
parentbc6fe168278957ad15cf87826c8410e7358e0849 (diff)
downloadsketchbook-aabb92d26f6b46cd4c482e0e2cbc8e9e9751db0d.tar.gz
sketchbook-aabb92d26f6b46cd4c482e0e2cbc8e9e9751db0d.zip
Merge the session recorder and the talk primitives
Recording (sessions, marks, clips, the reload speed-ups under them) and anim's Deck with its example talk, together; no conflicts; zig build test: 161/161 steps, 127/127 tests. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test/talk.script')
-rw-r--r--test/talk.script104
1 files changed, 104 insertions, 0 deletions
diff --git a/test/talk.script b/test/talk.script
new file mode 100644
index 0000000..e123d59
--- /dev/null
+++ b/test/talk.script
@@ -0,0 +1,104 @@
+# The talk example (examples/talk.zig): a Deck in the sketch's own State,
+# stepped by the clicks and keys the sketch turns into asks.
+frames 90
+expect deck.waiting false
+expect deck.slide 1
+# Slide 2 lies after the choice, which has not been made.
+expect deck.slides 1
+# A click during the first step finishes it: held at the first pause.
+click 100 100
+expect deck.t 2.5 ~0.0001
+expect deck.waiting true
+expect deck.log.len 0
+# The mass bobs while the deck waits.
+screenshot .zig-cache/talk/bob-a.png
+frames 14
+screenshot .zig-cache/talk/bob-b.png
+expect-different-screenshot .zig-cache/talk/bob-a.png .zig-cache/talk/bob-b.png
+# The next click opens the pause where it lands: the slider comes in, and
+# the deck waits at the choice.
+click 100 100
+expect deck.log.len 1
+expect deck.log.buffer[0].wait 0.2833 ~0.001
+await deck.waiting true
+frames 5
+# Reloaded mid-wait, the first step retimed from 2 s to 3: the same step,
+# as far into it, a second later.
+console set deck.playing false
+expect deck.t 3.4833 ~0.001
+load {v2}
+expect deck.t 4.4833 ~0.001
+expect deck.waiting true
+expect deck.log.len 1
+expect deck.log.buffer[0].wait 0.2833 ~0.001
+console set deck.playing true
+# A click on the slider is the slider's: zeta goes there, the deck stays.
+click 790 580
+expect app.zeta 1.5 ~0.01
+expect deck.log.len 1
+expect deck.waiting true
+# So is a drag along it, let go and all.
+down 640 580
+move 400 580
+up 400 580
+expect app.zeta 0.2 ~0.01
+expect app.dragging false
+expect deck.log.len 1
+expect deck.waiting true
+# Going on chooses by the slider: under 1, it rings; slide 2 is laid.
+key space
+expect deck.log.len 2
+expect deck.log.buffer[1].value 0
+expect deck.slides 2
+frames 90
+screenshot .zig-cache/talk/rings.png
+# Back: held at the choice again; over 1, it creeps.
+key page_up
+expect deck.log.len 1
+expect deck.waiting true
+click 840 580
+expect app.zeta 1.667 ~0.01
+key space
+expect deck.log.len 2
+expect deck.log.buffer[1].value 1
+frames 90
+screenshot .zig-cache/talk/creeps.png
+expect-different-screenshot .zig-cache/talk/rings.png .zig-cache/talk/creeps.png
+# Slide 2 at rest: it holds no pause, so its end.
+key right_bracket
+expect deck.slide 2
+expect deck.log.len 3
+expect deck.waiting false
+# Back a slide: slide 1 at rest, held at its first pause (3 s of writing
+# in this build, then the mass).
+key left_bracket
+expect deck.slide 1
+expect deck.log.len 0
+expect deck.t 3.5 ~0.0001
+expect deck.waiting true
+# Recorded, clicks, the slider and keys replay to the same State: the deck
+# opens gates in update, from events and State alone.
+console record 0
+click 100 100
+frames 40
+click 790 580
+key space
+frames 30
+key page_up
+key right_bracket
+frames 10
+console save 2
+console play 0
+frames 120
+expect-snapshot 2
+console stop
+# Exported ({a}, {b}: 30 fps, half size), each gate holds 2 s: the mass
+# bobs through the first hold (to 4.5 s), nothing moves at the choice
+# (5.1 to 7.1 s), and the verdict writes after it. Twice, the same frames.
+expect-different-screenshot {a}/000080.png {a}/000090.png
+expect-different-screenshot {a}/000130.png {a}/000170.png
+expect-same-screenshot {a}/000170.png {a}/000200.png
+expect-different-screenshot {a}/000200.png {a}/000230.png
+expect-same-screenshot {a}/000080.png {b}/000080.png
+expect-same-screenshot {a}/000230.png {b}/000230.png
+expect-same-screenshot {a}/000350.png {b}/000350.png