extends SceneTree const Style := preload("res://scripts/ui/ui_style.gd") const Brand := preload("res://scripts/ui/medmind_style.gd") var failures := 0 func _initialize() -> void: Style.set_dark_mode(true) var root := Control.new() var background := ColorRect.new() background.color = Style.BACKGROUND root.add_child(background) var panel := PanelContainer.new() panel.add_theme_stylebox_override("panel", Style.panel_box(Color("172337"), Color("405475"))) root.add_child(panel) Style.set_dark_mode(false) Style.refresh_tree(root, true) _assert(background.color.is_equal_approx(Style.BACKGROUND), "background should switch to light mode") _assert(root.theme.get_color("default_color", "RichTextLabel").is_equal_approx(Style.TEXT), "rich text should use the light text color") var light_box := panel.get_theme_stylebox("panel") as StyleBoxFlat _assert(light_box.bg_color.is_equal_approx(Color("fffffe")), "custom panel surface should switch to light mode") _assert(Brand.background_color(false).is_equal_approx(Color("f1f5f9")), "MedMind light background should match the style guide") var light_card := Brand.content_card_box(false, true, Brand.ROYAL_BLUE) _assert(light_card.bg_color.is_equal_approx(Color.WHITE), "MedMind light cards should use white surfaces") _assert(light_card.border_color.is_equal_approx(Brand.ROYAL_BLUE), "active light cards should use the primary blue border") var light_field := Brand.field_box(false) _assert(light_field.border_color.is_equal_approx(Brand.LIGHT_BORDER), "light fields should use the semantic cool-gray border") Style.set_dark_mode(true) Style.refresh_tree(root, false) _assert(background.color.is_equal_approx(Style.BACKGROUND), "background should switch back to dark mode") _assert(root.theme.get_color("default_color", "RichTextLabel").is_equal_approx(Style.TEXT), "rich text should use the dark text color") var dark_box := panel.get_theme_stylebox("panel") as StyleBoxFlat _assert(dark_box.bg_color.is_equal_approx(Color("172337")), "custom panel surface should switch back to dark mode") root.free() quit(1 if failures > 0 else 0) func _assert(condition: bool, message: String) -> void: if condition: return failures += 1 push_error(message)