Replace the broken test suite with working GdUnit4 tests
The previous tests never compiled: they used GUT's assert functions, Godot 3 APIs and reassigned autoload functions, so no test ran. - 90 tests: unit tests for the playlist, songs, player scoring, time formatting, search and the server client, plus integration tests that run MainWindow and SyncWindow against a fake server - Keybind tests check that Alt+<number> and Ctrl+Alt+<number> keep following the player rows while players are added and removed - run_tests.sh finds Godot and runs the suite headless (~10 seconds) - CI runs the tests before the build job in gitea-build.yaml; the separate test.yml used a GitHub action that does not exist - GdUnit4 is committed instead of ignored, since the project enables it, and .gitea/ is no longer ignored - Exported builds leave out tests/ and addons/gdUnit4/
This commit is contained in:
1 parent
87ff3d899b
commit
91adf52cf4
559 files changed
+32474
-2100
No files matched your search
@@ -0,0 +1,60 @@
|
||||
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"])
|
||||
Reference in new issue
Block a user