Files
stickman/tests/test_phase7_widgets.gd

18 lines
1.1 KiB
GDScript

extends SceneTree
const COLOR_SWATCH := preload("res://scripts/shared/ui/color_swatch_selector.gd")
const SIZE_TOGGLE := preload("res://scripts/shared/ui/preset_size_toggle.gd")
const FONT_PICKER := preload("res://scripts/shared/ui/font_preset_picker.gd")
const EMOJI_GRID := preload("res://scripts/shared/ui/emoji_quick_grid.gd")
var _failures: int = 0
func _init() -> void:
var swatch = COLOR_SWATCH.new(); swatch.configure([Color.RED], Color.RED); _check(swatch.get_selected() == Color.RED, "swatch selection")
var sizes = SIZE_TOGGLE.new(); sizes.configure([{"id":"small","label":"Small","value":20}], "small"); _check(sizes.get_selected_value() == 20, "size value")
var fonts = FONT_PICKER.new(); fonts.configure([{"id":"ui","label":"UI"}], "ui"); _check(fonts.get_selected_id() == "ui", "font id")
var emoji = EMOJI_GRID.new(); emoji.configure(["😀"], 1); _check(emoji.get_child_count() == 1, "emoji controls")
print("PASS" if _failures == 0 else "FAIL: %d" % _failures); quit(0 if _failures == 0 else 1)
func _check(condition: bool, message: String) -> void:
if not condition: _failures += 1; push_error("Phase 7 widgets: " + message)