diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-30 21:34:41 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-12 13:22:02 -0300 |
| commit | 2348776791e9dd17afeb12a06ba42a4a71917bcf (patch) | |
| tree | 780c4b12b76c8b97a28408dd40944d65f159fdc7 /test/replay.script | |
| parent | 590ba7b9b579b97e34b51ab7e3460ebc85713343 (diff) | |
| download | sketchbook-2348776791e9dd17afeb12a06ba42a4a71917bcf.tar.gz sketchbook-2348776791e9dd17afeb12a06ba42a4a71917bcf.zip | |
sketchbook: a drawing layer on top, host fixes for replay and migration
Diffstat (limited to 'test/replay.script')
| -rw-r--r-- | test/replay.script | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/test/replay.script b/test/replay.script new file mode 100644 index 0000000..1c19d3f --- /dev/null +++ b/test/replay.script @@ -0,0 +1,73 @@ +# A recording replays to the state it stopped at: played, seeked, stepped, +# resumed from the middle, and after the live pointer moved elsewhere. +# The button is down before recording starts: the recording begins with it. +move 100 80 +down 100 80 +console snapshot 1 +console record 0 +frames 5 +move 300 200 +frames 5 +up 300 200 +hold left_shift +move 500 300 +frames 3 +click 400 100 +release left_shift +click 120 140 +frames 20 +# Saving stops the recording first: slot 2 holds the state at the stop. +console save 2 +# The button held from before the recording came up at 300,200. +expect dots.len 3 +expect dots.buffer[0].pos[0] 300 +expect dots.buffer[1].kind big +expect dots.buffer[1].pos[0] 400 +expect dots.buffer[2].pos[1] 140 +expect dots.buffer[2].kind small +expect position[0] 120 ~60 +console set dots.buffer[3].pos[1] 7.5 +expect dots.buffer[3].pos[1] 7.5 +# Reading takes no frame: `print` and `console get` leave `updates` alone, +# and vectors and structs print every value in them. +expect updates 46 +print dots.buffer[1] +console get dots.buffer[0].pos +expect-log dots.buffer[0].pos = { 300, 200 } +console get dots.buffer[1] +expect-log dots.buffer[1] = { .pos[0] = 400, .pos[1] = 100, .kind = .big } +expect updates 46 + +# Played to the end, one recorded frame per frame. +console play 0 +frames 60 +expect-snapshot 2 +# Paused at the end: the state does not move. +frames 10 +expect-snapshot 2 +console seek end +expect-snapshot 2 +console seek start +console step 1000 +expect-snapshot 2 +console step -7 +console step 7 +expect-snapshot 2 +# From the middle, played on. +console seek 200 +console pause +frames 60 +expect-snapshot 2 +console diff 2 +expect-log same + +# A live move, then the same replay. +console stop +move 600 20 +down 600 20 +frames 3 +console play 0 +frames 60 +expect-snapshot 2 +expect-no-log another build +console stop |
