fix(ui): address PR #99 review — character creation editor fixes
13 fixes from PR #99 review on #705 (character editor): - #10/#11: Add _get_swatch_color() helper; fix stale closure in _make_color_swatch (reads current color at click time, not construction time); fix _on_modal_ok to use helper instead of wrong get_child(0) traversal - #12: Replace HSV palette with D-165 hardcoded hex values (6×9 rows, muted HSL per spec — reds/greens/blues/purples/browns/grays) - #13: Fix fallback asset IDs to match actual files — hair: bald/ bob/buzzed/long; heads: head_001–004; facial hair: beard/moustache/ mutton_chops (stubble removed — no asset) - #14: Remove invented "slot field" TODO comment; replace with name-prefix convention note - #15: Fix overhead camera pitch 0.0°→-80.0° (0° was horizontal, not top-down as intended per D-158) - #16: Make hair highlight swatch non-interactive (_make_display_swatch); remove _on_hair_highlight_changed and _hair_highlight_auto flag - #17: Remove no-op self-assignment in _on_hair_selected; remove redundant assignment inside _hair_highlight_auto block - #18: Store _clothing_dock_container/_accessory_dock_container as instance vars — eliminates fragile get_child(3).get_child(0) chain - #19: Fix test_r_key_triggers_randomise — replaces assert_bool(true) with a real assertion checking body_type or skin_tone changed - #20: Cache scan results in _cached_hair_ids/_cached_head_ids during tab build; _on_randomise() reads cache (no re-scan per keypress) - #21: Fix character_visual.gd docstring "21 segments" → "18 segments" - #22: Fix _get_accessory_ids_for_slot — apply slot name-prefix filtering instead of returning all accessories for every slot Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -474,13 +474,24 @@ func test_q_key_rotates_left() -> void:
|
||||
func test_r_key_triggers_randomise() -> void:
|
||||
if _scene == null:
|
||||
return
|
||||
# R key should change SOMETHING in the descriptor (not all defaults)
|
||||
var event := InputEventKey.new()
|
||||
event.keycode = KEY_R
|
||||
event.pressed = true
|
||||
# Just verify it doesn't crash
|
||||
_scene._input(event)
|
||||
assert_bool(true).is_true() # reached here without error
|
||||
# Seed to a known state so change is detectable
|
||||
_scene._descriptor.body_type = CharacterVisualDescriptor.BodyType.AVERAGE_M
|
||||
_scene._descriptor.skin_tone = 0
|
||||
var body_before := _scene._descriptor.body_type
|
||||
var skin_before := _scene._descriptor.skin_tone
|
||||
# Press R up to 10 times — must change at least one observable descriptor field
|
||||
var changed := false
|
||||
for _i in 10:
|
||||
var event := InputEventKey.new()
|
||||
event.keycode = KEY_R
|
||||
event.pressed = true
|
||||
_scene._input(event)
|
||||
if _scene._descriptor.body_type != body_before or _scene._descriptor.skin_tone != skin_before:
|
||||
changed = true
|
||||
break
|
||||
assert_bool(changed).override_failure_message(
|
||||
"R key must trigger randomise and change body_type or skin_tone"
|
||||
).is_true()
|
||||
|
||||
|
||||
# =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user