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.
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 264 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 317 B After Width: | Height: | Size: 319 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 393 B After Width: | Height: | Size: 395 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 402 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 238 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 662 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 314 B After Width: | Height: | Size: 316 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 358 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 412 B After Width: | Height: | Size: 414 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 373 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 420 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 299 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 588 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 580 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 311 B |
@@ -86,7 +86,7 @@ static func round_button(icon_path: String, size: int = 48) -> Button:
|
|||||||
var b := Button.new()
|
var b := Button.new()
|
||||||
b.custom_minimum_size = Vector2(size, size)
|
b.custom_minimum_size = Vector2(size, size)
|
||||||
b.icon = load(icon_path)
|
b.icon = load(icon_path)
|
||||||
b.expand_icon = false
|
b.expand_icon = true
|
||||||
b.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
b.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
b.alignment = HORIZONTAL_ALIGNMENT_CENTER
|
b.alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
b.add_theme_stylebox_override("normal", _round_style(Palette.PAPER))
|
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_top_right = 26
|
||||||
s.corner_radius_bottom_left = 26
|
s.corner_radius_bottom_left = 26
|
||||||
s.corner_radius_bottom_right = 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_color = Color(0.29, 0.20, 0.14, 0.12)
|
||||||
s.shadow_size = 4
|
s.shadow_size = 4
|
||||||
s.shadow_offset = Vector2(0, 2)
|
s.shadow_offset = Vector2(0, 2)
|
||||||
|
|||||||
@@ -43,11 +43,47 @@ func _run() -> void:
|
|||||||
_test_daily(save)
|
_test_daily(save)
|
||||||
_test_frames(save)
|
_test_frames(save)
|
||||||
_test_game_data(save)
|
_test_game_data(save)
|
||||||
|
_test_icons()
|
||||||
|
|
||||||
_reset_to_clean(save)
|
_reset_to_clean(save)
|
||||||
_finish()
|
_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:
|
func _finish() -> void:
|
||||||
if failures == 0:
|
if failures == 0:
|
||||||
print("QA CORE: PASS")
|
print("QA CORE: PASS")
|
||||||
|
|||||||