main/ holds the main window and top bar, quiz/ the quiz and its parts, player/ the music player, popups/ every popup and what they share, data/ the songs, players, playlist and settings, server/ the MusicServer client, common/ the list row and GameLog, and themes/ the themes and style boxes.
35 lines
1.0 KiB
GDScript
35 lines
1.0 KiB
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://quiz/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)
|