47 lines
1.7 KiB
GDScript
47 lines
1.7 KiB
GDScript
extends SceneTree
|
|
|
|
var failures := 0
|
|
|
|
|
|
func _initialize() -> void:
|
|
call_deferred("_run")
|
|
|
|
|
|
func _run() -> void:
|
|
var prior_environment: String = ProjectSettings.get_setting("step3/deployment_environment", "development")
|
|
ProjectSettings.set_setting("step3/deployment_environment", "uat")
|
|
var main_screen = load("res://scripts/ui/main.gd").new()
|
|
root.add_child(main_screen)
|
|
await process_frame
|
|
var nav_button := main_screen.sidebar.find_child("NavCcsCases2", true, false) as Button
|
|
_assert(nav_button != null and nav_button.visible, "UAT should expose a CCS Cases 2 navigation item")
|
|
_assert(main_screen.screens.has("ccs_cases_2"), "UAT should register the graphical CCS screen")
|
|
main_screen.queue_free()
|
|
await process_frame
|
|
ProjectSettings.set_setting("step3/deployment_environment", prior_environment)
|
|
|
|
var host := Control.new()
|
|
host.size = Vector2(1200.0, 700.0)
|
|
root.add_child(host)
|
|
var screen = load("res://scripts/ui/ccs_cases_2_screen.gd").new()
|
|
host.add_child(screen)
|
|
await process_frame
|
|
screen.on_show()
|
|
await process_frame
|
|
_assert(screen.current_view == "doctor_office", "CCS Cases 2 should open directly in the doctor office")
|
|
_assert(screen.active_scene != null, "CCS Cases 2 should instantiate the doctor-office scene")
|
|
_assert(is_equal_approx(screen.stage_root.scale.x, screen.stage_root.scale.y), "the graphical stage should preserve its aspect ratio")
|
|
screen.on_hide()
|
|
await process_frame
|
|
_assert(screen.active_scene == null and screen.current_view.is_empty(), "hiding CCS Cases 2 should release the prototype scene")
|
|
host.queue_free()
|
|
await process_frame
|
|
quit(1 if failures > 0 else 0)
|
|
|
|
|
|
func _assert(condition: bool, message: String) -> void:
|
|
if condition:
|
|
return
|
|
failures += 1
|
|
push_error(message)
|