22 lines
580 B
GDScript3
22 lines
580 B
GDScript3
|
extends Node
|
||
|
class_name CoreTestUtils
|
||
|
|
||
|
var core: Core
|
||
|
|
||
|
# Framework management
|
||
|
func load_framework(config: CoreConfiguration = CoreConfiguration.new()) -> Core:
|
||
|
core = Core.new(config)
|
||
|
get_tree().root.add_child(core)
|
||
|
await get_tree().process_frame
|
||
|
await core.complete_init()
|
||
|
return core
|
||
|
|
||
|
func unload_framework() -> void:
|
||
|
if is_framework_loaded(): get_tree().root.remove_child(core)
|
||
|
core = null
|
||
|
|
||
|
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
|