From 7abd1226cb276021adc8aeb5747d090c7eeecfe9 Mon Sep 17 00:00:00 2001 From: Ratdoku Builder Date: Wed, 2 Dec 2026 23:24:03 -0600 Subject: [PATCH] fix(ui): sharpen round-button icons Import icon SVGs at 120px intrinsic size, expand them in round buttons with content margins preserving the original visual size, and assert icon resolution in QA. --- assets/icons/arrow-left.svg | 4 ++-- assets/icons/bed.svg | 4 ++-- assets/icons/bell.svg | 4 ++-- assets/icons/book-open.svg | 4 ++-- assets/icons/chevron-down.svg | 4 ++-- assets/icons/fish.svg | 4 ++-- assets/icons/flame.svg | 4 ++-- assets/icons/key.svg | 4 ++-- assets/icons/leaf.svg | 4 ++-- assets/icons/lightbulb.svg | 4 ++-- assets/icons/paw-print.svg | 4 ++-- assets/icons/rotate-ccw.svg | 4 ++-- assets/icons/settings.svg | 4 ++-- assets/icons/star.svg | 4 ++-- assets/icons/undo-2.svg | 4 ++-- scripts/UI.gd | 8 +++++++- tools/qa_core.gd | 36 +++++++++++++++++++++++++++++++++++ 17 files changed, 73 insertions(+), 31 deletions(-) diff --git a/assets/icons/arrow-left.svg b/assets/icons/arrow-left.svg index b40bff8..3ee3ed0 100644 --- a/assets/icons/arrow-left.svg +++ b/assets/icons/arrow-left.svg @@ -1,7 +1,7 @@ Button: var b := Button.new() b.custom_minimum_size = Vector2(size, size) b.icon = load(icon_path) - b.expand_icon = false + b.expand_icon = true b.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER b.alignment = HORIZONTAL_ALIGNMENT_CENTER b.add_theme_stylebox_override("normal", _round_style(Palette.PAPER)) @@ -186,6 +186,12 @@ static func _round_style(color: Color) -> StyleBoxFlat: s.corner_radius_top_right = 26 s.corner_radius_bottom_left = 26 s.corner_radius_bottom_right = 26 + # Keep high-resolution icons near their original visual size inside the + # round button instead of letting expand_icon fill the whole control. + s.content_margin_left = 10 + s.content_margin_right = 10 + s.content_margin_top = 10 + s.content_margin_bottom = 10 s.shadow_color = Color(0.29, 0.20, 0.14, 0.12) s.shadow_size = 4 s.shadow_offset = Vector2(0, 2) diff --git a/tools/qa_core.gd b/tools/qa_core.gd index 09d3dbe..f886819 100644 --- a/tools/qa_core.gd +++ b/tools/qa_core.gd @@ -43,11 +43,47 @@ func _run() -> void: _test_daily(save) _test_frames(save) _test_game_data(save) + _test_icons() _reset_to_clean(save) _finish() +func _test_icons() -> void: + _note("5. icon assets") + # Load at runtime so UI.gd does not compile before the autoload exists. + var ui_script = load("res://scripts/UI.gd") + _check(ui_script != null, "UI script missing") + if ui_script == null: + return + + var dir := DirAccess.open("res://assets/icons") + _check(dir != null, "icons directory missing") + if dir == null: + return + + var count := 0 + for file in dir.get_files(): + if not file.ends_with(".svg"): + continue + count += 1 + var texture = load("res://assets/icons/" + file) + _check(texture != null, "icon failed to load: %s" % file) + if texture != null: + var size: Vector2 = texture.get_size() + _check(size.x >= 96 and size.y >= 96, "icon too small: %s (%dx%d)" % [file, size.x, size.y]) + _check(count >= 10, "expected the full icon set") + + var button = ui_script.round_button("res://assets/icons/arrow-left.svg", 44) + _check(button.expand_icon, "round buttons should expand high-res icons") + var style := button.get_theme_stylebox("normal") as StyleBoxFlat + _check(style != null and style.content_margin_left >= 8, "round buttons should use margins to keep icon size") + var small_icon = ui_script.icon("res://assets/icons/settings.svg", 18) + _check(small_icon.texture.get_size().x >= 96, "UI.icon should use high-res textures") + button.free() + small_icon.free() + + func _finish() -> void: if failures == 0: print("QA CORE: PASS")