summaryrefslogtreecommitdiff
path: root/examples/noc/test/lsystem.timeline.script
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-16 21:28:20 -0300
committerGabriel Schneider <[email protected]>2026-11-16 21:28:20 -0300
commit6933f99ddb2d7103515d26838496309a807bba26 (patch)
tree991c2fe7d4a57957222876e190fa4d16a0fb889c /examples/noc/test/lsystem.timeline.script
parent82fca5c9f29124f37f6dcd08e73e6999ce44a69d (diff)
downloadsketchbook-6933f99ddb2d7103515d26838496309a807bba26.tar.gz
sketchbook-6933f99ddb2d7103515d26838496309a807bba26.zip
Move standalone sketches into sketchbook examples
Diffstat (limited to 'examples/noc/test/lsystem.timeline.script')
-rw-r--r--examples/noc/test/lsystem.timeline.script68
1 files changed, 68 insertions, 0 deletions
diff --git a/examples/noc/test/lsystem.timeline.script b/examples/noc/test/lsystem.timeline.script
new file mode 100644
index 0000000..285900c
--- /dev/null
+++ b/examples/noc/test/lsystem.timeline.script
@@ -0,0 +1,68 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The interaction: clicks, each one more
+# generation. State holds only the generation; the sentence and its picture are rebuilt in
+# Session when it changes, so the screenshots after a seek or a step
+# check that the derived data follows State.
+
+# 1. Record.
+frames 30
+console record 0
+frames 20
+click 320 180
+frames 20
+click 320 180
+frames 20
+click 320 180
+frames 20
+console save 2
+expect generation 1
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 150
+expect-snapshot 2
+screenshot .zig-cache/e2e/lsystem-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/lsystem-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/lsystem-played.png .zig-cache/e2e/lsystem-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 150
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+screenshot .zig-cache/e2e/lsystem-stepped.png
+frames 1
+expect-same-screenshot .zig-cache/e2e/lsystem-played.png .zig-cache/e2e/lsystem-stepped.png
+# Back before the last click: the previous generation's picture.
+console step -30
+screenshot .zig-cache/e2e/lsystem-earlier.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/lsystem-played.png .zig-cache/e2e/lsystem-earlier.png
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 150
+expect-snapshot 2
+console stop