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
56e9fe66d3
commit
c985a6ce5b
559 files changed
+32474
-2100
No files matched your search
@@ -0,0 +1,27 @@
|
||||
class_name AutoloadSnapshot
|
||||
extends RefCounted
|
||||
## Saves and restores the script variables of autoloads such as Settings and Playlist,
|
||||
## so a test that changes global state does not leak into the next test.
|
||||
|
||||
var _values: Dictionary = {}
|
||||
|
||||
|
||||
## Records the current values of every script variable on [param autoloads].
|
||||
static func take(autoloads: Array[Node]) -> AutoloadSnapshot:
|
||||
var snapshot: AutoloadSnapshot = AutoloadSnapshot.new()
|
||||
for autoload: Node in autoloads:
|
||||
var values: Dictionary = {}
|
||||
for property: Dictionary in autoload.get_property_list():
|
||||
if property.usage & PROPERTY_USAGE_SCRIPT_VARIABLE:
|
||||
var value: Variant = autoload.get(property.name)
|
||||
values[property.name] = value.duplicate() if value is Array else value
|
||||
snapshot._values[autoload] = values
|
||||
return snapshot
|
||||
|
||||
|
||||
## Puts back the values recorded by [method take].
|
||||
func restore() -> void:
|
||||
for autoload: Node in _values:
|
||||
var values: Dictionary = _values[autoload]
|
||||
for property_name: String in values:
|
||||
autoload.set(property_name, values[property_name])
|
||||
Reference in new issue
Block a user