Fix core.gd test

This commit is contained in:
JeremyStar™ 2024-03-28 15:00:11 +01:00
parent 9608d6b0ab
commit 5dfac5458a
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -21,6 +21,7 @@ func test_initialization() -> void:
if !utils.is_framework_loaded(): if !utils.is_framework_loaded():
test_status = 2 test_status = 2
test_message = "utils.is_framework_loaded() returned 'false'" test_message = "utils.is_framework_loaded() returned 'false'"
return
test_status = 0 test_status = 0
test_message = "Framework did initialize correctly" test_message = "Framework did initialize correctly"
@ -44,23 +45,28 @@ func test_custom_module_support() -> void:
if callback != "_initialize" and callback != "_pull_config": if callback != "_initialize" and callback != "_pull_config":
test_status = 2 test_status = 2
test_message = "Module did not register" test_message = "Module did not register"
return
elif core.get_node_or_null("Custom Modules/test_module") == null: elif core.get_node_or_null("Custom Modules/test_module") == null:
test_status = 2 test_status = 2
test_message = "Could not find module node" test_message = "Could not find module node"
return
# Get module # Get module
var module_get: CoreBaseModule = core.get_custom_module("test_module") var module_get: CoreBaseModule = core.get_custom_module("test_module")
if module_get == null: if module_get == null:
test_status = 2 test_status = 2
test_message = "Got null from get_custom_module method" test_message = "Got null from get_custom_module method"
return
if module_get != module: if module_get != module:
test_status = 2 test_status = 2
test_message = "Got invalid node from get_custom_module method" test_message = "Got invalid node from get_custom_module method"
return
# Get string # Get string
if module.hello_test() != "Hello Test!": if module.hello_test() != "Hello Test!":
test_status = 2 test_status = 2
test_message = "Module did not return test string" test_message = "Module did not return test string"
return
# Unregister module # Unregister module
core.unregister_custom_module("test_module") core.unregister_custom_module("test_module")
@ -70,6 +76,7 @@ func test_custom_module_support() -> void:
if core.get_node_or_null("Custom Modules/test_module") == null: if core.get_node_or_null("Custom Modules/test_module") == null:
test_status = 0 test_status = 0
test_message = "Successfully registered, got, used and unregistered a custom module" test_message = "Successfully registered, got, used and unregistered a custom module"
return
func test_reload_config() -> void: func test_reload_config() -> void:
# Variables # Variables
@ -90,11 +97,13 @@ func test_reload_config() -> void:
if core.config != config: if core.config != config:
test_status = 2 test_status = 2
test_message = "Got invalid node from config variable" test_message = "Got invalid node from config variable"
return
# Check config in modules # Check config in modules
if core.logger.config_colored != false or core.logger.config_level != CoreTypes.LoggerLevel.NONE or core.logui.background.visible != false: if core.logger.config_colored != false or core.logger.config_level != CoreTypes.LoggerLevel.NONE or core.logui.background.visible != false:
test_status = 2 test_status = 2
test_message = "Configuration did not apply all values correctly" test_message = "Configuration did not apply all values correctly"
return
test_status = 0 test_status = 0
test_message = "Framework applied all modified keys correctly" test_message = "Framework applied all modified keys correctly"