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:
Sansan committed 2026-10-06 08:32:56 +02:00
1 parent 56e9fe66d3
commit c985a6ce5b
559 files changed
+32474 -2100

No files matched your search

-94
View File
@@ -1,94 +0,0 @@
class_name SettingsTest
extends GdUnitTestSuite
func test_make_request2_calls_callback_on_success():
var callback_called = false
var received_data = null
var callback = func(data):
callback_called = true
received_data = data
# Mock the HTTP request behavior
var original_make_request = Settings.make_request2
Settings.make_request2 = func(address: String, func_name: Callable, expect_data: bool) -> void:
if expect_data:
func_name.call([{"SongNo": 1, "Soundtrack": "Test", "Song": "Test Song"}])
else:
func_name.call()
Settings.make_request2("/music/list", callback, true)
assert_true(callback_called)
assert_eq(received_data[0].SongNo, 1)
# Restore original
Settings.make_request2 = original_make_request
func test_make_request2_handles_error_response():
var error_called = false
var callback = func(data):
# This shouldn't be called for error responses
pass
# Mock error response
var original_make_request = Settings.make_request2
Settings.make_request2 = func(address: String, func_name: Callable, expect_data: bool) -> void:
# Simulate error by not calling the callback
pass
Settings.make_request2("/music/error", callback, true)
# Restore and verify callback wasn't called with data
Settings.make_request2 = original_make_request
assert_false(error_called)
func test_make_request3_does_not_expect_data():
var callback_called = false
var callback = func():
callback_called = true
var original_make_request = Settings.make_request3
Settings.make_request3 = func(address: String) -> void:
callback.call()
Settings.make_request3("/music/reset")
assert_true(callback_called)
Settings.make_request3 = original_make_request
func test_delete_children_removes_all():
var node = Node.new()
var child1 = Node.new()
var child2 = Node.new()
node.add_child(child1)
node.add_child(child2)
assert_eq(node.get_child_count(), 2)
Settings.delete_children(node)
assert_eq(node.get_child_count(), 0)
func test_delete_player_children_removes_all():
var node = Node.new()
var player1 = Player.new()
var player2 = Player.new()
node.add_child(player1)
node.add_child(player2)
assert_eq(node.get_child_count(), 2)
Settings.delete_player_children(node)
assert_eq(node.get_child_count(), 0)