CORE/Test.gd

56 lines
1.9 KiB
GDScript3
Raw Normal View History

2024-03-31 18:04:30 +02:00
# CORE FRAMEWORK TEST FILE
2024-03-03 18:53:09 +01:00
# Copyright (c) 2024 The StarOpenSource Project & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
## CORE testing playground
##
## This script is used to test CORE's behaviour during development.
## It's state should be reverted to how it was before committing (if modified).
2024-04-08 20:14:38 +02:00
## For more permanent tests write a unit test instead.
2024-02-04 21:36:30 +01:00
extends Node
var core: Core
2024-04-08 20:15:00 +02:00
var config: CoreConfiguration = CoreConfiguration.new()
@onready var logger: CoreLoggerInstance = core.logger.get_instance("Test.gd", self)
2024-02-04 21:36:30 +01:00
2024-03-03 19:07:59 +01:00
func _init() -> void:
2024-04-08 20:15:00 +02:00
# Update config keys
config.headless = false
2024-04-09 00:53:43 +02:00
config.development = true
2024-02-04 21:36:30 +01:00
# Initialize CORE with custom config
core = await Core.new(config)
2024-05-10 19:16:45 +02:00
config.free()
2024-03-03 19:07:59 +01:00
func _ready() -> void:
2024-02-04 21:36:30 +01:00
# Inject CORE
2024-03-03 19:07:59 +01:00
await get_tree().process_frame
2024-03-24 15:43:31 +01:00
get_tree().root.add_child(core)
2024-03-22 21:12:11 +01:00
await core.complete_init()
2024-04-08 20:15:00 +02:00
2024-02-04 21:36:30 +01:00
# Print information about CORE
logger.info(await core.get_formatted_string("""Version information:
Release (semantic) = %version_semantic%
Release = %version%
2024-04-08 20:18:49 +02:00
Typerelease = %version_typerelease%
2024-04-08 20:15:00 +02:00
Type = %version_type%
Type (technical) = %version_type_technical%
2024-02-10 21:21:18 +01:00
Development mode = %devmode%
Headless mode = %headless%
Custom module support = %custommodules%"""))
# Print hi
logger.info("Hi there!")