Skip to content

Test the controller with calls in the orders a schedule produces - #49

Merged
514sid merged 1 commit into
mainfrom
controller-sequence-tests
Nov 23, 2026
Merged

514sid merged 1 commit into
mainfrom
controller-sequence-tests

Conversation

@514sid

@514sid 514sid commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Adds GaplessControllerSequenceTest, which drives GaplessController against a fake player in the orders a host's schedule produces when it changes under it. No library code changes; the tests found no bugs.

Fixed orders:

  • Playlist swapped mid-play: the new list's first asset replaces the staged one and plays at once, an unstaged cut waits for readiness and the old staged asset never plays, an asset from the old list that comes back is loaded again, and 30 swaps in a row keep one asset on screen and end each once.
  • stop() then start(): the new asset shows after its preload window, the staged asset is forgotten, a stop() during a cut waiting for readiness cancels it, late shown, preload error and playback error reports about the stopped asset are ignored, and 20 rapid start and stop pairs end with the last start() on screen.
  • A staged asset replaced before play(): playing the replaced one loads it again, playing the replacement cuts at once, staging the same asset twice uses the latest copy, and a late preload error for the replaced asset doesn't touch its replacement.

Random stream: 25 seeds of 600 steps mixing API calls with player reports (shown, including late ones, ready, preload error, playback error, preload missed, time passing). After every step it checks that each played item was prepared and played once, Started only names a played item, never while another is on screen and never twice, Ended only names what is on screen, and currentState matches the screen. Afterwards start() and play() still have to work. A failure names the seed and the last 12 steps. Across the seeds it produces about 450 Started, 230 PlaybackError, 160 Ended and 150 PreloadError, and runs in about 1.5 seconds.

The tests treat stop(), and a PlaybackError for the asset on screen, as taking it off screen without an Ended, which is the current behaviour.

Covers a playlist swapped mid-play, stop then start (including late
player reports about the stopped asset), a staged asset replaced before
its play, and a seeded random stream of 600 calls and player reports per
seed, checked after every step against the rules events follow: one
asset on screen, Ended only for it, each playback started once and
currentState matching the screen.
@514sid
514sid merged commit d4afa55 into main Nov 23, 2026
1 check passed
@514sid
514sid deleted the controller-sequence-tests branch November 23, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant