58 lines
2.5 KiB
GDScript
58 lines
2.5 KiB
GDScript
extends SceneTree
|
|
|
|
var failures := 0
|
|
|
|
|
|
func _initialize() -> void:
|
|
call_deferred("_run")
|
|
|
|
|
|
func _run() -> void:
|
|
var service = root.get_node("CCSService")
|
|
var theme_service = root.get_node("UIThemeService")
|
|
var prior_dark_mode: bool = theme_service.is_dark_mode()
|
|
service.cases = [{"externalId": "case-1"}]
|
|
service.attempt = {"id": "active", "state": "active", "createdUtc": "2026-07-19T12:00:00Z", "deadlineUtc": "2026-07-19T12:20:00Z", "location": "emergency_department"}
|
|
service.rating = {"elo": 1040, "ratedCaseCount": 3}
|
|
service.prediction = {"ccsScore": 72.0, "contributingCases": 3}
|
|
service.history = [{"id": "completed", "caseTitle": "Completed case", "state": "completed", "createdUtc": "2026-07-18T12:00:00Z", "score": 80.0}]
|
|
service.history_next_cursor = "next-page"
|
|
var host := Control.new()
|
|
host.size = Vector2(1400, 800)
|
|
root.add_child(host)
|
|
var screen = load("res://scripts/ui/ccs_hub.gd").new()
|
|
screen.size = host.size
|
|
host.add_child(screen)
|
|
await process_frame
|
|
screen._update_responsive_layout()
|
|
screen._render_active_section()
|
|
screen._render_history()
|
|
await process_frame
|
|
_assert(screen.history_list.get_child_count() == 1, "CCS history should render terminal attempts")
|
|
_assert(screen.load_more_button.visible, "CCS history should expose cursor pagination")
|
|
var active_layout: BoxContainer = screen.find_child("ActiveCardLayout", true, false)
|
|
_assert(active_layout != null and not active_layout.vertical, "wide CCS screens should use the horizontal active card")
|
|
var primary: Button = screen.find_child("PrimaryCcsAction", true, false)
|
|
_assert(primary != null and primary.text == "Resume Case", "an unfinished case should expose Resume Case")
|
|
theme_service.set_dark_mode(false)
|
|
await process_frame
|
|
var light_box := screen.active_section.get_theme_stylebox("panel") as StyleBoxFlat
|
|
_assert(light_box.bg_color.is_equal_approx(screen._section_box(false).bg_color), "CCS should apply its light surface after a theme change")
|
|
screen.size = Vector2(760, 800)
|
|
screen._update_responsive_layout()
|
|
await process_frame
|
|
active_layout = screen.find_child("ActiveCardLayout", true, false)
|
|
_assert(active_layout != null and active_layout.vertical, "narrow CCS screens should stack the active card")
|
|
_assert(not screen.table_header.visible, "narrow CCS screens should render history cards without a table header")
|
|
host.queue_free()
|
|
await process_frame
|
|
theme_service.set_dark_mode(prior_dark_mode)
|
|
quit(1 if failures > 0 else 0)
|
|
|
|
|
|
func _assert(condition: bool, message: String) -> void:
|
|
if condition:
|
|
return
|
|
failures += 1
|
|
push_error(message)
|