61 lines
1.6 KiB
GDScript
61 lines
1.6 KiB
GDScript
extends GdUnitTestSuite
|
|
|
|
var _is_debug: bool
|
|
var _song: SongObject
|
|
|
|
|
|
func before_test() -> void:
|
|
_is_debug = Settings.is_debug
|
|
Settings.is_debug = false
|
|
_song = SongObject.new()
|
|
_song.song_number = 4
|
|
_song.soundtrack_title = "Final Fantasy VI"
|
|
_song.song_title = "Dancing Mad"
|
|
|
|
|
|
func after_test() -> void:
|
|
Settings.is_debug = _is_debug
|
|
|
|
|
|
func test_titles_are_hidden_until_answered() -> void:
|
|
assert_str(_song.get_soundtrack_title()).is_equal("????????")
|
|
assert_str(_song.get_song_title()).is_equal("??????")
|
|
assert_str(_song.get_song_info()).is_equal("??? - ???")
|
|
|
|
|
|
func test_titles_are_shown_once_answered() -> void:
|
|
_song.is_answered = true
|
|
|
|
assert_str(_song.get_soundtrack_title()).is_equal("Final Fantasy VI")
|
|
assert_str(_song.get_song_title()).is_equal("Dancing Mad")
|
|
assert_str(_song.get_song_info()).is_equal("5. Final Fantasy VI - Dancing Mad")
|
|
|
|
|
|
func test_debug_info_shows_unanswered_songs() -> void:
|
|
Settings.is_debug = true
|
|
|
|
assert_str(_song.get_song_info()).is_equal(
|
|
"5. Final Fantasy VI - Dancing Mad | played: false | answered: false")
|
|
|
|
|
|
func test_points_are_kept_in_the_order_given() -> void:
|
|
_song.add_point("marle-id")
|
|
_song.add_point("crono-id")
|
|
|
|
assert_array(_song.players_given_point).contains_exactly(["marle-id", "crono-id"])
|
|
|
|
|
|
func test_player_gets_at_most_one_point_per_song() -> void:
|
|
_song.add_point("crono-id")
|
|
_song.add_point("crono-id")
|
|
|
|
assert_array(_song.players_given_point).contains_exactly(["crono-id"])
|
|
|
|
|
|
func test_removing_point_of_player_without_point_changes_nothing() -> void:
|
|
_song.add_point("crono-id")
|
|
|
|
_song.remove_point("marle-id")
|
|
|
|
assert_array(_song.players_given_point).contains_exactly(["crono-id"])
|