diff options
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 |
