Files
MusicPlayer/tests/integration/test_main_window_startup.gd
T
Sansan e1e05f3904
Build / test (push) Successful in 38s
Build / build (push) Successful in 1m12s
Show a graph of the game on the Winner popup
The Winner popup now shows every player's score after each song as a
step line, with the winning score marked, and three facts under it: the
longest streak, the longest standstill and the song most players scored
on. The data comes from the points each song already records, through
the new ScoreHistory. The popup grows to 1600x920 with the graph across
the full width, so a 60-song game with five players stays readable.

Reset points now starts a new game: it clears the points on the songs
and the graph starts after the song that was playing. Songs already on
the server at startup count as an earlier game.

The screenshot tour has a long five-player game, and only the Winner
popup differs from before.
2026-10-07 10:40:46 +02:00

51 lines
1.5 KiB
GDScript

extends MainWindowTestSuite
## Startup with a slow /music/list response.
func _before_window_starts() -> void:
_server.respond_json("/music/list", [
{"SongNo": 0, "Soundtrack": "Chrono Trigger", "Song": "Corridors of Time"},
])
_next_song_is({"SongNo": 1, "Soundtrack": "Final Fantasy VI", "Song": "Dancing Mad"})
_server.hold("/music/list")
func test_preloaded_song_survives_a_slow_song_list() -> void:
_server.release("/music/list")
# The song already on the server, then the preloaded one
assert_int(Playlist.song_object_array.size()).is_equal(2)
assert_str(Playlist.song_object_array[1].song_title).is_equal("Dancing Mad")
assert_int(Playlist.get_preloaded_songs()).is_equal(1)
func test_next_plays_the_preloaded_song_after_a_slow_song_list() -> void:
_server.release("/music/list")
await _play_first_song()
assert_int(Playlist.currently_playing_song).is_equal(1)
func test_failed_song_list_is_retried_before_preloading() -> void:
_quiz.song_loader.retry_seconds = 0.05
_server.respond_json("/music/list", [], 503)
_server.release("/music/list")
assert_int(_server.count("/music/rand")).is_equal(0)
_server.respond_json("/music/list", [])
await await_millis(200)
assert_int(_server.count("/music/rand")).is_equal(1)
assert_int(Playlist.get_preloaded_songs()).is_equal(1)
func test_game_starts_after_the_songs_already_on_the_server() -> void:
_server.release("/music/list")
await _play_first_song()
assert_int(Playlist.game_start_song).is_equal(1)
assert_int(ScoreHistory.from_playlist(Settings.player_array).songs.size()).is_equal(1)