Indent every script with tabs, like the Godot editor does
This commit is contained in:
1 parent
8c1987807c
commit
bad4b3ad8b
35 files changed
+1653
-1653
No files matched your search
@@ -10,143 +10,143 @@ var _lucca: PlayerObject
|
||||
|
||||
|
||||
func before_test() -> void:
|
||||
super()
|
||||
_crono = _add_player("Crono")
|
||||
_marle = _add_player("Marle")
|
||||
_lucca = _add_player("Lucca")
|
||||
await _play_first_song()
|
||||
super()
|
||||
_crono = _add_player("Crono")
|
||||
_marle = _add_player("Marle")
|
||||
_lucca = _add_player("Lucca")
|
||||
await _play_first_song()
|
||||
|
||||
|
||||
func _song_points() -> Array[String]:
|
||||
return Playlist.song_object_array[Playlist.currently_playing_song].players_given_point
|
||||
return Playlist.song_object_array[Playlist.currently_playing_song].players_given_point
|
||||
|
||||
|
||||
func test_alt_number_gives_point_to_player_in_that_row() -> void:
|
||||
await _give_point_with_keybind(2)
|
||||
await _give_point_with_keybind(2)
|
||||
|
||||
assert_array(_scores()).contains_exactly([0, 1, 0])
|
||||
assert_array(_song_points()).contains_exactly([_marle.id])
|
||||
assert_array(_scores()).contains_exactly([0, 1, 0])
|
||||
assert_array(_song_points()).contains_exactly([_marle.id])
|
||||
|
||||
|
||||
func test_ctrl_alt_number_takes_point_from_player_in_that_row() -> void:
|
||||
await _give_point_with_keybind(3)
|
||||
await _give_point_with_keybind(3)
|
||||
await _give_point_with_keybind(3)
|
||||
await _give_point_with_keybind(3)
|
||||
|
||||
await _take_point_with_keybind(3)
|
||||
await _take_point_with_keybind(3)
|
||||
|
||||
assert_array(_scores()).contains_exactly([0, 0, 1])
|
||||
assert_array(_scores()).contains_exactly([0, 0, 1])
|
||||
|
||||
|
||||
func test_taking_last_point_removes_player_from_song() -> void:
|
||||
await _give_point_with_keybind(1)
|
||||
await _give_point_with_keybind(1)
|
||||
|
||||
await _take_point_with_keybind(1)
|
||||
await _take_point_with_keybind(1)
|
||||
|
||||
assert_int(_crono.player_score).is_equal(0)
|
||||
assert_array(_song_points()).is_empty()
|
||||
assert_int(_crono.player_score).is_equal(0)
|
||||
assert_array(_song_points()).is_empty()
|
||||
|
||||
|
||||
func test_each_keybind_only_affects_its_own_player() -> void:
|
||||
await _give_point_with_keybind(1)
|
||||
await _give_point_with_keybind(3)
|
||||
await _give_point_with_keybind(3)
|
||||
await _give_point_with_keybind(1)
|
||||
await _give_point_with_keybind(3)
|
||||
await _give_point_with_keybind(3)
|
||||
|
||||
assert_int(_crono.player_score).is_equal(1)
|
||||
assert_int(_marle.player_score).is_equal(0)
|
||||
assert_int(_lucca.player_score).is_equal(2)
|
||||
assert_array(_song_points()).contains_exactly([_crono.id, _lucca.id])
|
||||
assert_int(_crono.player_score).is_equal(1)
|
||||
assert_int(_marle.player_score).is_equal(0)
|
||||
assert_int(_lucca.player_score).is_equal(2)
|
||||
assert_array(_song_points()).contains_exactly([_crono.id, _lucca.id])
|
||||
|
||||
|
||||
func test_number_without_player_does_nothing() -> void:
|
||||
await _give_point_with_keybind(4)
|
||||
await _give_point_with_keybind(4)
|
||||
|
||||
assert_array(_scores()).contains_exactly([0, 0, 0])
|
||||
assert_array(_song_points()).is_empty()
|
||||
assert_array(_scores()).contains_exactly([0, 0, 0])
|
||||
assert_array(_song_points()).is_empty()
|
||||
|
||||
|
||||
func test_keybinds_move_up_when_first_player_is_removed() -> void:
|
||||
await _remove_player(_crono)
|
||||
await _remove_player(_crono)
|
||||
|
||||
await _give_point_with_keybind(1)
|
||||
await _give_point_with_keybind(2)
|
||||
await _give_point_with_keybind(2)
|
||||
await _give_point_with_keybind(1)
|
||||
await _give_point_with_keybind(2)
|
||||
await _give_point_with_keybind(2)
|
||||
|
||||
assert_int(_marle.player_score).is_equal(1)
|
||||
assert_int(_lucca.player_score).is_equal(2)
|
||||
assert_array(_song_points()).contains_exactly([_marle.id, _lucca.id])
|
||||
assert_int(_marle.player_score).is_equal(1)
|
||||
assert_int(_lucca.player_score).is_equal(2)
|
||||
assert_array(_song_points()).contains_exactly([_marle.id, _lucca.id])
|
||||
|
||||
|
||||
func test_keybind_after_last_row_does_nothing_after_removal() -> void:
|
||||
await _remove_player(_marle)
|
||||
await _remove_player(_marle)
|
||||
|
||||
await _give_point_with_keybind(3)
|
||||
await _give_point_with_keybind(3)
|
||||
|
||||
assert_int(_crono.player_score).is_equal(0)
|
||||
assert_int(_lucca.player_score).is_equal(0)
|
||||
assert_int(_crono.player_score).is_equal(0)
|
||||
assert_int(_lucca.player_score).is_equal(0)
|
||||
|
||||
|
||||
func test_removing_player_removes_only_their_points() -> void:
|
||||
await _give_point_with_keybind(1)
|
||||
await _give_point_with_keybind(2)
|
||||
await _give_point_with_keybind(3)
|
||||
await _give_point_with_keybind(1)
|
||||
await _give_point_with_keybind(2)
|
||||
await _give_point_with_keybind(3)
|
||||
|
||||
await _remove_player(_marle)
|
||||
await _remove_player(_marle)
|
||||
|
||||
assert_array(_song_points()).contains_exactly([_crono.id, _lucca.id])
|
||||
assert_int(_crono.player_score).is_equal(1)
|
||||
assert_int(_lucca.player_score).is_equal(1)
|
||||
assert_array(_song_points()).contains_exactly([_crono.id, _lucca.id])
|
||||
assert_int(_crono.player_score).is_equal(1)
|
||||
assert_int(_lucca.player_score).is_equal(1)
|
||||
|
||||
|
||||
func test_new_player_gets_next_free_keybind_after_removal() -> void:
|
||||
await _remove_player(_marle)
|
||||
var robo: PlayerObject = _add_player("Robo")
|
||||
await _remove_player(_marle)
|
||||
var robo: PlayerObject = _add_player("Robo")
|
||||
|
||||
await _give_point_with_keybind(2)
|
||||
await _give_point_with_keybind(3)
|
||||
await _give_point_with_keybind(2)
|
||||
await _give_point_with_keybind(3)
|
||||
|
||||
assert_int(_lucca.player_score).is_equal(1)
|
||||
assert_int(robo.player_score).is_equal(1)
|
||||
assert_int(_crono.player_score).is_equal(0)
|
||||
assert_array(_song_points()).contains_exactly([_lucca.id, robo.id])
|
||||
assert_int(_lucca.player_score).is_equal(1)
|
||||
assert_int(robo.player_score).is_equal(1)
|
||||
assert_int(_crono.player_score).is_equal(0)
|
||||
assert_array(_song_points()).contains_exactly([_lucca.id, robo.id])
|
||||
|
||||
|
||||
func test_new_player_does_not_inherit_removed_players_points() -> void:
|
||||
await _give_point_with_keybind(3)
|
||||
await _remove_player(_lucca)
|
||||
await _give_point_with_keybind(3)
|
||||
await _remove_player(_lucca)
|
||||
|
||||
var robo: PlayerObject = _add_player("Robo")
|
||||
var robo: PlayerObject = _add_player("Robo")
|
||||
|
||||
assert_int(robo.player_score).is_equal(0)
|
||||
assert_array(_song_points()).is_empty()
|
||||
assert_int(robo.player_score).is_equal(0)
|
||||
assert_array(_song_points()).is_empty()
|
||||
|
||||
|
||||
func test_points_follow_players_through_several_changes() -> void:
|
||||
await _give_point_with_keybind(1)
|
||||
await _remove_player(_crono)
|
||||
var robo: PlayerObject = _add_player("Robo")
|
||||
await _give_point_with_keybind(1)
|
||||
await _remove_player(_marle)
|
||||
var ayla: PlayerObject = _add_player("Ayla")
|
||||
await _give_point_with_keybind(3)
|
||||
await _give_point_with_keybind(2)
|
||||
await _take_point_with_keybind(2)
|
||||
await _give_point_with_keybind(1)
|
||||
await _remove_player(_crono)
|
||||
var robo: PlayerObject = _add_player("Robo")
|
||||
await _give_point_with_keybind(1)
|
||||
await _remove_player(_marle)
|
||||
var ayla: PlayerObject = _add_player("Ayla")
|
||||
await _give_point_with_keybind(3)
|
||||
await _give_point_with_keybind(2)
|
||||
await _take_point_with_keybind(2)
|
||||
|
||||
# Rows are now: Lucca, Robo, Ayla
|
||||
assert_array(Settings.player_array).contains_exactly([_lucca, robo, ayla])
|
||||
assert_int(_lucca.player_score).is_equal(0)
|
||||
assert_int(robo.player_score).is_equal(0)
|
||||
assert_int(ayla.player_score).is_equal(1)
|
||||
assert_array(_song_points()).contains_exactly([ayla.id])
|
||||
# Rows are now: Lucca, Robo, Ayla
|
||||
assert_array(Settings.player_array).contains_exactly([_lucca, robo, ayla])
|
||||
assert_int(_lucca.player_score).is_equal(0)
|
||||
assert_int(robo.player_score).is_equal(0)
|
||||
assert_int(ayla.player_score).is_equal(1)
|
||||
assert_array(_song_points()).contains_exactly([ayla.id])
|
||||
|
||||
|
||||
func test_player_list_shows_rows_in_player_order() -> void:
|
||||
await _remove_player(_crono)
|
||||
var robo: PlayerObject = _add_player("Robo")
|
||||
await _remove_player(_crono)
|
||||
var robo: PlayerObject = _add_player("Robo")
|
||||
|
||||
var rows: Array[Node] = _quiz.get_node(
|
||||
"PlayersPanel/VBoxContainer/ScrollContainer/PlayersListVBoxContainer").get_children()
|
||||
var rows: Array[Node] = _quiz.get_node(
|
||||
"PlayersPanel/VBoxContainer/ScrollContainer/PlayersListVBoxContainer").get_children()
|
||||
|
||||
assert_array(rows.map(func(row: Player) -> PlayerObject: return row.player_object)) \
|
||||
.contains_exactly([_marle, _lucca, robo])
|
||||
assert_array(rows.map(func(row: Player) -> int: return row.list_index)) \
|
||||
.contains_exactly([0, 1, 2])
|
||||
assert_array(rows.map(func(row: Player) -> PlayerObject: return row.player_object)) \
|
||||
.contains_exactly([_marle, _lucca, robo])
|
||||
assert_array(rows.map(func(row: Player) -> int: return row.list_index)) \
|
||||
.contains_exactly([0, 1, 2])
|
||||
Reference in new issue
Block a user