test: capture final HUD polish feedback
This commit is contained in:
@@ -270,7 +270,6 @@ func test_compact_1280_layout_contains_live_hud_regions_without_covering_the_pla
|
||||
hud.get_node_or_null("AchievementToast") as Control,
|
||||
hud.get_node_or_null("TitleLabel") as Control,
|
||||
hud.get_node_or_null("HeaderValuesLabel") as Control,
|
||||
layout.get_node_or_null("HeaderOrnament") as Control,
|
||||
], "compact TopBar")
|
||||
_assert_controls_enclosed(left_rail, [
|
||||
stats_panel,
|
||||
@@ -659,3 +658,150 @@ func _combined_label_text(labels: Array[Label]) -> String:
|
||||
for label in labels:
|
||||
text += label.text + "\n"
|
||||
return text
|
||||
|
||||
func test_hud_shell_frames_use_the_dark_fantasy_nine_patch_texture() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
var layout := hud.get_node_or_null("ResponsiveLayout") as Control
|
||||
assert_not_null(layout, "HUD requires ResponsiveLayout")
|
||||
if layout == null:
|
||||
return
|
||||
|
||||
for frame_name: String in [
|
||||
"TopBar", "LeftRail", "RightRail", "CommandBar",
|
||||
"CharacterSection", "ObjectivesSection", "StatusSection", "JournalSection", "MapSection",
|
||||
]:
|
||||
var frame := layout.get_node_or_null(frame_name) as Panel
|
||||
assert_not_null(frame, "ResponsiveLayout requires %s" % frame_name)
|
||||
if frame == null:
|
||||
continue
|
||||
var style := frame.get_theme_stylebox(&"panel")
|
||||
assert_true(style is StyleBoxTexture, "%s must use StyleBoxTexture rather than StyleBoxFlat" % frame_name)
|
||||
var texture_style := style as StyleBoxTexture
|
||||
if texture_style != null:
|
||||
assert_true(_texture_uses_path(texture_style.texture, "res://assets/ui/dark_fantasy/panel_64x64_nine_patch_source.png"), "%s must use panel_64x64_nine_patch_source.png" % frame_name)
|
||||
|
||||
func test_play_area_masks_use_the_dungeon_background_texture() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
var layout := hud.get_node_or_null("ResponsiveLayout") as Control
|
||||
assert_not_null(layout, "HUD requires ResponsiveLayout")
|
||||
if layout == null:
|
||||
return
|
||||
|
||||
const DUNGEON_BACKGROUND := "res://assets/ui/dark_fantasy/dungeon_ui_background.png"
|
||||
assert_file_exists(DUNGEON_BACKGROUND, "The required dungeon background asset must exist")
|
||||
for mask_name: String in ["PlayAreaMaskTop", "PlayAreaMaskLeft", "PlayAreaMaskRight", "PlayAreaMaskBottom"]:
|
||||
var mask := layout.get_node_or_null(mask_name) as Panel
|
||||
assert_not_null(mask, "ResponsiveLayout requires %s" % mask_name)
|
||||
if mask == null:
|
||||
continue
|
||||
var style := mask.get_theme_stylebox(&"panel")
|
||||
assert_true(style is StyleBoxTexture, "%s must use a StyleBoxTexture/AtlasTexture dungeon background" % mask_name)
|
||||
var texture_style := style as StyleBoxTexture
|
||||
if texture_style != null:
|
||||
assert_true(_texture_uses_path(texture_style.texture, DUNGEON_BACKGROUND), "%s must use the new dungeon_ui_background.png asset" % mask_name)
|
||||
|
||||
func test_decorative_equipment_and_header_art_are_absent_or_hidden() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
var layout := hud.get_node_or_null("ResponsiveLayout") as Control
|
||||
assert_not_null(layout, "HUD requires ResponsiveLayout")
|
||||
if layout == null:
|
||||
return
|
||||
for decorative_name: String in ["EquipmentIllustration", "HeaderOrnament"]:
|
||||
var decorative := layout.get_node_or_null(decorative_name) as Control
|
||||
assert_true(decorative == null or not decorative.visible, "%s must be absent or invisible rather than adding decorative visual noise" % decorative_name)
|
||||
|
||||
func test_objectives_and_status_keep_the_requested_vertical_breathing_room() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
hud.apply_viewport_layout(Vector2(1920, 1080))
|
||||
await get_tree().process_frame
|
||||
var layout := hud.get_node_or_null("ResponsiveLayout") as Control
|
||||
var objectives := layout.get_node_or_null("ObjectivesSection") as Control if layout != null else null
|
||||
var status := layout.get_node_or_null("StatusSection") as Control if layout != null else null
|
||||
var status_title := layout.get_node_or_null("StatusSectionTitle") as Label if layout != null else null
|
||||
assert_not_null(objectives)
|
||||
assert_not_null(status)
|
||||
assert_not_null(status_title)
|
||||
if objectives == null or status == null or status_title == null:
|
||||
return
|
||||
assert_gte(status.get_global_rect().position.y - objectives.get_global_rect().end.y, 24.0, "Objectives and Status need at least 24px of vertical separation at 1920x1080")
|
||||
assert_gte(status_title.get_global_rect().position.y - status.get_global_rect().position.y, 14.0, "ÉTAT title needs at least 14px top inset")
|
||||
|
||||
func test_character_and_journal_titles_are_outlined_light_and_readable() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
hud.apply_viewport_layout(Vector2(1920, 1080))
|
||||
await get_tree().process_frame
|
||||
var layout := hud.get_node_or_null("ResponsiveLayout") as Control
|
||||
assert_not_null(layout)
|
||||
if layout == null:
|
||||
return
|
||||
for title_name: String in ["CharacterSectionTitle", "JournalSectionTitle"]:
|
||||
var title := layout.get_node_or_null(title_name) as Label
|
||||
assert_not_null(title, "ResponsiveLayout requires %s" % title_name)
|
||||
if title == null:
|
||||
continue
|
||||
assert_gte(title.get_theme_font_size(&"font_size"), 16, "%s needs at least a 16px font at 1920x1080" % title_name)
|
||||
assert_gte(title.get_theme_constant(&"outline_size"), 2, "%s needs a >=2px contour" % title_name)
|
||||
assert_gte(title.get_theme_color(&"font_color").get_luminance(), 0.60, "%s needs a light font color" % title_name)
|
||||
|
||||
func test_command_bar_keeps_all_three_zones_readable_at_reference_and_compact_sizes() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
for viewport_size: Vector2 in [Vector2(1920, 1080), Vector2(1280, 720)]:
|
||||
hud.apply_viewport_layout(viewport_size)
|
||||
await get_tree().process_frame
|
||||
var layout := hud.get_node_or_null("ResponsiveLayout") as Control
|
||||
var command_bar := layout.get_node_or_null("CommandBar") as Control if layout != null else null
|
||||
var quick_slots := layout.get_node_or_null("QuickSlotStrip") as Control if layout != null else null
|
||||
var prompt_panel := layout.get_node_or_null("PromptPanel") as Control if layout != null else null
|
||||
var help_panel := layout.get_node_or_null("HelpPanel") as Control if layout != null else null
|
||||
var quick_hint := layout.get_node_or_null("QuickSlotHint") as Label if layout != null else null
|
||||
var prompt := hud.get_node_or_null("ContextPromptLabel") as Label
|
||||
var help := hud.get_node_or_null("HelpLabel") as Label
|
||||
assert_not_null(command_bar, "CommandBar is required at %s" % viewport_size)
|
||||
assert_not_null(quick_slots)
|
||||
assert_not_null(prompt_panel)
|
||||
assert_not_null(help_panel)
|
||||
assert_not_null(quick_hint)
|
||||
assert_not_null(prompt)
|
||||
assert_not_null(help)
|
||||
if command_bar == null or quick_slots == null or prompt_panel == null or help_panel == null or quick_hint == null or prompt == null or help == null:
|
||||
continue
|
||||
for zone: Control in [quick_slots, prompt_panel, help_panel]:
|
||||
assert_true(command_bar.get_global_rect().encloses(zone.get_global_rect()), "%s must remain contained at %s" % [zone.name, viewport_size])
|
||||
for index in 3:
|
||||
var zones: Array[Control] = [quick_slots, prompt_panel, help_panel]
|
||||
for other_index in range(index + 1, 3):
|
||||
assert_false(zones[index].get_global_rect().intersects(zones[other_index].get_global_rect()), "%s and %s must not overlap at %s" % [zones[index].name, zones[other_index].name, viewport_size])
|
||||
assert_true(quick_slots.get_global_rect().encloses(quick_hint.get_global_rect()))
|
||||
assert_true(prompt_panel.get_global_rect().encloses(prompt.get_global_rect()))
|
||||
assert_true(help_panel.get_global_rect().encloses(help.get_global_rect()))
|
||||
assert_false(help.clip_text, "HelpLabel must not be truncated at %s" % viewport_size)
|
||||
assert_lte(help.get_minimum_size().x, help.size.x, "The right help zone must fit its complete label at %s" % viewport_size)
|
||||
assert_eq(prompt.text, "F : Distance • X : Magie • K : Familier", "The center zone must contain exactly the three requested command notions")
|
||||
|
||||
func _texture_uses_path(texture: Texture2D, expected_path: String) -> bool:
|
||||
if texture == null:
|
||||
return false
|
||||
if texture.resource_path == expected_path:
|
||||
return true
|
||||
if texture is AtlasTexture:
|
||||
var atlas_texture := texture as AtlasTexture
|
||||
return atlas_texture.atlas != null and atlas_texture.atlas.resource_path == expected_path
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user