fix(ui): address PR #118 review — 5 items
- Preload stance icons at _ready() into cache Dictionary - Null-guard shader + theme loads with push_error() + early return - Guard _icon_mat.set_shader_parameter inside if _icon_mat: - Icon size 18→20px per D-086, container height 44→46px to fit - Add _apply_stance test coverage (known + unknown stance) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -313,3 +313,33 @@ func test_tile_renderer_skips_nonzero_z() -> void:
|
||||
# z=1 and z=2 tiles should NOT be present (-1 = no cell)
|
||||
assert_that(tile_renderer.get_cell_source_id(Vector2i(1, 0))).is_equal(-1)
|
||||
assert_that(tile_renderer.get_cell_source_id(Vector2i(3, 0))).is_equal(-1)
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Stance indicator icon tests (#787)
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
func test_stance_indicator_applies_known_stance() -> void:
|
||||
# #787: _apply_stance updates icon + label for each known stance.
|
||||
var scene := MAIN_SCENE
|
||||
_instance = scene.instantiate()
|
||||
auto_free(_instance)
|
||||
add_child(_instance)
|
||||
|
||||
var si = _instance.get_node_or_null("UILayer/StanceIndicator")
|
||||
assert_that(si).is_not_null()
|
||||
si._apply_stance("Careful")
|
||||
assert_that(si.get_current_stance()).is_equal("Careful")
|
||||
|
||||
|
||||
func test_stance_indicator_unknown_stance_no_crash() -> void:
|
||||
# #787: Unknown stance falls back gracefully — no crash, no texture change.
|
||||
var scene := MAIN_SCENE
|
||||
_instance = scene.instantiate()
|
||||
auto_free(_instance)
|
||||
add_child(_instance)
|
||||
|
||||
var si = _instance.get_node_or_null("UILayer/StanceIndicator")
|
||||
assert_that(si).is_not_null()
|
||||
si._apply_stance("InvalidStance")
|
||||
assert_that(si.get_current_stance()).is_equal("InvalidStance")
|
||||
|
||||
Reference in New Issue
Block a user