Files
MusicPlayer/tests/integration/test_main_window_startup.gd
T
Sansan 3c7b4e5c9d Split the main window into TopBar and Quiz scenes
The quiz (song, playlist, players, music player and the popups opened from
it) moves into Quiz.tscn and the top panel into TopBar.tscn. The main window
keeps only the top bar, the quiz and the popups opened from the top bar, so
other views can be added next to the quiz later. Every node keeps its place
on screen.

Screenshots of every UI state before and after are pixel-identical, and a
layout test checks each node against a baseline taken before the split.
2026-10-06 10:02:22 +02:00

42 lines
1.3 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_fetch_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)