Fix research xp generation

This commit is contained in:
2026-04-18 00:56:44 +02:00
parent 2bc81a73fd
commit dfb1161854
29 changed files with 485 additions and 47 deletions

View File

@@ -1,18 +1,18 @@
extends Node
extends SceneTree
var test_scripts: Array[String] = []
var test_index: int = 0
var total_passed: int = 0
var total_failed: int = 0
func _ready():
func _init():
print("\n=== GODOT TEST RUNNER ===\n")
_discover_tests()
if test_scripts.is_empty():
print("[ERROR] No test scripts found in res://tests/")
print("[RESULT] FAIL")
get_tree().quit(1)
quit(1)
return
print("Found %d test(s): %s\n" % [test_scripts.size(), str(test_scripts)])
@@ -25,10 +25,10 @@ func _ready():
if total_failed == 0:
print("[OVERALL_RESULT] PASS")
get_tree().quit(0)
quit(0)
else:
print("[OVERALL_RESULT] FAIL")
get_tree().quit(1)
quit(1)
func _discover_tests() -> void:
var dir = DirAccess.open("res://tests")
@@ -53,11 +53,26 @@ func _run_next_test() -> void:
# Load and run test
var test_instance = load(test_script).new()
add_child(test_instance)
await test_instance.run()
get_root().add_child(test_instance)
total_passed += test_instance.get_passed()
total_failed += test_instance.get_failed()
# Check if test has run() method (new pattern) or uses _ready() (old pattern)
if test_instance.has_method("run"):
await test_instance.run()
# Clean up test instance
test_instance.queue_free()
else:
# For old pattern, wait a bit for _ready() to complete
await create_timer(0.2).timeout
# Clean up test instance
test_instance.queue_free()
# Get results if available
if test_instance.has_method("get_passed"):
total_passed += test_instance.get_passed()
total_failed += test_instance.get_failed()
# Wait for cleanup
await create_timer(0.1).timeout
print("")
test_index += 1