Make the music list, player list and inspiration list their own scenes
MusicListPanel, PlayersPanel (was Players) and InspirationList (was ScrollContainer) each get their own scene and script. They report what happens through signals, and the quiz wires them to the playlist, the music player, the log and the popups. 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 part is tested on its own as well as through the quiz.
This commit is contained in:
1 parent
3c7b4e5c9d
commit
8c1987807c
24 files changed
+932
-466
No files matched your search
@@ -50,6 +50,12 @@ func test_top_bar_is_drawn_below_the_quiz() -> void:
|
||||
.is_less(_window.get_node("Quiz").get_index())
|
||||
|
||||
|
||||
func test_quiz_parts_are_their_own_scenes() -> void:
|
||||
for node_name: String in ["MusicListPanel", "PlayersPanel", "InspirationList"]:
|
||||
assert_str(_quiz.get_node(node_name).scene_file_path) \
|
||||
.is_equal("res://%s.tscn" % node_name)
|
||||
|
||||
|
||||
func test_top_bar_holds_only_title_and_buttons() -> void:
|
||||
assert_array(_children(_window.get_node("TopBar"))) \
|
||||
.contains_exactly_in_any_order(TOP_BAR_CHILDREN)
|
||||
@@ -89,6 +95,48 @@ func test_clicking_quiz_buttons_plays_and_shows_answer() -> void:
|
||||
.is_equal("Chrono Trigger")
|
||||
|
||||
|
||||
func test_clicking_a_song_in_the_music_list_plays_it() -> void:
|
||||
_next_song_is(SONG_INFO[1])
|
||||
await _play_first_song()
|
||||
_press("NextButton")
|
||||
# Changing song waits a moment for the old one to stop
|
||||
await get_tree().create_timer(0.7).timeout
|
||||
assert_int(Playlist.currently_playing_song).is_equal(1)
|
||||
var rows: Array[Node] = _quiz.get_node("MusicListPanel/ScrollContainer/MusicList") \
|
||||
.get_children()
|
||||
var first_row: Control = rows.filter(
|
||||
func(row: SongListObject) -> bool: return row.song_object.song_number == 0)[0]
|
||||
|
||||
await _click_at(first_row.get_global_rect().position + Vector2(20, first_row.size.y / 2))
|
||||
await get_tree().create_timer(0.7).timeout
|
||||
|
||||
assert_int(Playlist.currently_playing_song).is_equal(0)
|
||||
|
||||
|
||||
func test_points_from_the_player_list_reach_the_song_and_log() -> void:
|
||||
await _play_first_song()
|
||||
var crono: PlayerObject = _add_player("Crono")
|
||||
|
||||
(_player_row(crono).get_node("HBoxContainer/AddPoint") as BaseButton).pressed.emit()
|
||||
|
||||
assert_array(Playlist.song_object_array[0].players_given_point).contains_exactly([crono.id])
|
||||
assert_int((_quiz.get_node("%Log").get_node("%LogVBoxContainer") as Node).get_child_count()) \
|
||||
.is_equal(1)
|
||||
|
||||
|
||||
func test_character_button_in_the_player_list_picks_a_new_character() -> void:
|
||||
var crono: PlayerObject = _add_player("Crono")
|
||||
var character_select: PopupWindow = _quiz.get_node("NewCharacterSelect")
|
||||
|
||||
(_player_row(crono).get_node("HBoxContainer/Character") as BaseButton).pressed.emit()
|
||||
|
||||
assert_bool(character_select.visible).is_true()
|
||||
var texture: ImageTexture = ImageTexture.create_from_image(
|
||||
Image.create(4, 4, false, Image.FORMAT_RGBA8))
|
||||
character_select.new_new_character_selected.emit(texture)
|
||||
assert_object(crono.character).is_same(texture)
|
||||
|
||||
|
||||
func test_quiz_popup_backdrop_covers_the_top_bar() -> void:
|
||||
var settings: PopupWindow = _quiz.get_node("SettingsWindow")
|
||||
settings.open()
|
||||
|
||||
Reference in new issue
Block a user