extends SceneTree var failures := 0 func _initialize() -> void: call_deferred("_run") func _run() -> void: var theme_service = root.get_node("UIThemeService") var prior_dark_mode: bool = theme_service.is_dark_mode() var host := Control.new() host.size = Vector2(1280, 800) root.add_child(host) var screen = load("res://scripts/ui/donation_screen.gd").new() screen.size = host.size host.add_child(screen) await process_frame _assert(screen.content_grid.columns == 2, "wide donation layouts should use two columns") _assert(screen.selected_amount_cents == 500, "the default preset should be $5") _assert(screen.donate_button.text.contains("$5.00"), "the donation action should state the selected amount") screen.size = Vector2(760, 800) screen._update_layout() _assert(screen.content_grid.columns == 1, "narrow donation layouts should stack") screen.size = Vector2(360, 800) screen._update_layout() _assert(screen.preset_grid.columns == 2, "phone donation layouts should use a two-column amount grid") screen.custom_amount.text = "4" screen._on_custom_amount_changed("4") await process_frame _assert(screen.donate_button.disabled, "amounts below $5 should disable checkout") theme_service.set_dark_mode(false) await process_frame var light_box := screen.mission_panel.get_theme_stylebox("panel") as StyleBoxFlat _assert(light_box.bg_color.is_equal_approx(Color.WHITE), "donation cards should use light surfaces in light mode") _assert(screen.muted_labels[0].get_theme_color("font_color").is_equal_approx(Color("64748b")), "secondary donation text should use the readable light-mode color") 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)