Files
MusicPlayer/tests/integration/test_now_playing.gd
T
Sansan e94c75e84d Split now playing, the quiz buttons and song loading out of the quiz
NowPlaying, QuizToolbar and SongControls become their own scenes, the auto
repeat switch moves into the music player scene, and downloading songs moves
into a SongLoader node. The quiz only wires the parts together. Every node
keeps its place on screen.

Screenshots of every UI state are pixel-identical to before, the layout test
still matches the original baseline, and each new part has its own tests.
2026-10-06 11:11:18 +02:00

35 lines
1022 B
GDScript

extends GdUnitTestSuite
## The soundtrack and song shown at the top of the quiz.
var _runner: GdUnitSceneRunner
var _now_playing: NowPlaying
func before_test() -> void:
_runner = scene_runner("res://NowPlaying.tscn")
_now_playing = _runner.scene()
func _label(label_name: String) -> Label:
return _now_playing.get_node(label_name)
func test_starts_empty() -> void:
assert_str(_label("SoundtrackLabel").text).is_empty()
assert_str(_label("SongLabel").text).is_empty()
func test_show_song_shows_soundtrack_and_song() -> void:
_now_playing.show_song("Chrono Trigger", "Corridors of Time")
assert_str(_label("SoundtrackLabel").text).is_equal("Chrono Trigger")
assert_str(_label("SongLabel").text).is_equal("Corridors of Time")
func test_soundtrack_is_above_song() -> void:
_now_playing.show_song("Chrono Trigger", "Corridors of Time")
await _runner.simulate_frames(1)
assert_float(_label("SoundtrackLabel").get_global_rect().end.y) \
.is_less_equal(_label("SongLabel").get_global_rect().position.y)