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("Titles/" + 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) func test_long_titles_keep_to_two_lines_each() -> void: _now_playing.size = Vector2(1088, 328) _now_playing.show_song("Final Fantasy Dissidia 012 Duodecim (Sista Fantasin " + "Meningsskiljaktigheter 012 Tolv) Final Mix Special Edition", "Cosmos (Arrangement) - Main Theme of the Warriors of Light, Long Version") await _runner.simulate_frames(2) for label_name: String in ["SoundtrackLabel", "SongLabel"]: assert_int(_label(label_name).get_visible_line_count()).is_less_equal(2) assert_float(_label("SongLabel").get_global_rect().end.y) \ .is_less_equal(_now_playing.get_global_rect().end.y)