CORE/tests/unitbase.gd
JeremyStarTM 32b82c8f5b Remove stupid core_test variable and return value
I somehow fucked up and thought that the 'core' variable in unitbase.gd is used for some other stuff and therefore assigned it a new variable called 'core_test'. Seems like I was wrong however and slipped up the code I wrote just days before. Anyway, fixed this slip up, have a nice day :)
2024-03-31 16:20:34 +02:00

31 lines
787 B
GDScript

extends BessereTestsTest
# CORE
var core: Core
# Used during testing
var callback: String = ""
# Unload framework after each test
func after_each() -> void:
callback = ""
await unload_framework()
# Framework management
func load_framework(config: CoreConfiguration = CoreConfiguration.new()) -> void:
core = Core.new(config)
get_tree().root.add_child(core)
await get_tree().process_frame
await core.complete_init()
func unload_framework() -> void:
if is_framework_loaded():
await core.cleanup()
get_tree().root.remove_child.call_deferred(core)
core = null
await get_tree().process_frame
func is_framework_loaded() -> bool: return get_node_or_null("/root/CORE") != null
# Helper functions
func wait_process_time() -> void: await get_tree().create_timer(0.1).timeout