summaryrefslogtreecommitdiff
path: root/examples/shaders/test/timeline.script
diff options
context:
space:
mode:
Diffstat (limited to 'examples/shaders/test/timeline.script')
-rw-r--r--examples/shaders/test/timeline.script71
1 files changed, 71 insertions, 0 deletions
diff --git a/examples/shaders/test/timeline.script b/examples/shaders/test/timeline.script
new file mode 100644
index 0000000..0041d73
--- /dev/null
+++ b/examples/shaders/test/timeline.script
@@ -0,0 +1,71 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# noc/test/accel_to_mouse.timeline.script. State is the example index, the
+# language and the time, summed from recorded ticks: a replay must land on
+# the same example, language and time to the bit, and draw the same picture.
+
+# 1. Record: keys and a click change example and language while time runs.
+frames 10
+console snapshot 1
+console record 0
+frames 20
+key right
+frames 15
+key l
+frames 10
+down 300 300
+up 300 300
+frames 20
+key right
+key right
+frames 10
+key l
+key left
+frames 25
+expect example 3
+expect language zig
+console save 2
+
+# 2. Played to the end, exactly.
+console play 0
+frames 150
+expect-snapshot 2
+screenshot .zig-cache/e2e/shaders-played.png
+# 5. Paused: `draw` must not move State (time included).
+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/shaders-sought.png
+# 7. What a seek shows equals what playing showed.
+expect-same-screenshot .zig-cache/e2e/shaders-played.png .zig-cache/e2e/shaders-sought.png
+console seek 1000
+console pause
+frames 10
+console pause
+frames 30
+console pause
+frames 150
+expect-snapshot 2
+
+# 4. Stepped 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/shaders-stepped.png
+expect-same-screenshot .zig-cache/e2e/shaders-played.png .zig-cache/e2e/shaders-stepped.png
+
+# 6. Live input (a click, a key), then the same replay.
+console stop
+down 100 100
+up 100 100
+key l
+frames 10
+console play 0
+frames 150
+expect-snapshot 2
+console stop