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,62 @@
|
||||
extends GdUnitTestSuite
|
||||
|
||||
const SearchWindowScript: GDScript = preload("res://SearchWindow.gd")
|
||||
|
||||
var _search: Control
|
||||
|
||||
|
||||
func before_test() -> void:
|
||||
_search = auto_free(SearchWindowScript.new())
|
||||
_search.set_soundtracks([
|
||||
"Chrono Trigger",
|
||||
"Final Fantasy VI",
|
||||
"Mario & Luigi: Superstar Saga",
|
||||
"Pokémon Red",
|
||||
"Q*bert",
|
||||
"Super Mario 64",
|
||||
"The Legend of Zelda: A Link to the Past",
|
||||
])
|
||||
|
||||
|
||||
func test_plain_text_matches_case_insensitively() -> void:
|
||||
assert_array(_search.find_matches("chrono")).contains_exactly(["Chrono Trigger"])
|
||||
|
||||
|
||||
func test_contains_matches_come_before_letter_order_matches() -> void:
|
||||
var matches: Array[String] = _search.find_matches("mario")
|
||||
|
||||
assert_array(matches).contains_exactly([
|
||||
"Mario & Luigi: Superstar Saga",
|
||||
"Super Mario 64",
|
||||
])
|
||||
|
||||
|
||||
func test_ignores_spaces() -> void:
|
||||
assert_array(_search.find_matches("finalfantasy")).contains_exactly(["Final Fantasy VI"])
|
||||
|
||||
|
||||
func test_and_matches_ampersand() -> void:
|
||||
assert_array(_search.find_matches("mario and luigi")).contains(["Mario & Luigi: Superstar Saga"])
|
||||
|
||||
|
||||
func test_accented_letters_match_plain_letters() -> void:
|
||||
assert_array(_search.find_matches("pokemon")).contains_exactly(["Pokémon Red"])
|
||||
|
||||
|
||||
func test_letters_in_order_match_abbreviations() -> void:
|
||||
assert_array(_search.find_matches("lozlttp")).contains_exactly([
|
||||
"The Legend of Zelda: A Link to the Past",
|
||||
])
|
||||
|
||||
|
||||
func test_regex_characters_are_matched_literally() -> void:
|
||||
assert_array(_search.find_matches("q*b")).contains_exactly(["Q*bert"])
|
||||
|
||||
|
||||
func test_no_matches() -> void:
|
||||
assert_array(_search.find_matches("metroid")).is_empty()
|
||||
|
||||
|
||||
func test_clean_term() -> void:
|
||||
assert_str(_search.clean_term("Rock 'n Roll Racing")).is_equal("rockandrollracing")
|
||||
assert_str(_search.clean_term("Ys I & II")).is_equal("ysiandii")
|
||||
Reference in new issue
Block a user