fix(client): address PR #141 review — parse-order, tween guard, test fixes
- Fix autoload parse-order violations: sim_bridge.gd, input_mapper.gd, audio_manager.gd now use load() for class_name types instead of direct references (LocalBridge, ServerProcess, Constants) - Collapse redundant tween validity guard in dialogue_box.gd to is_instance_valid(panel) only - Add clarifying comments to fog test resize assertions (8-tile padding trigger, 32x32 fixture assumption) - Fix test_examine_display_sprint18 case 2: GameState.has() → "field" in GameState (Node vs Dictionary API) - Fix test_game_state_sprint20: rename before_each → before_test (GdUnit4 lifecycle hook) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -52,7 +52,7 @@ func after_test() -> void:
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
func test_gamestate_examine_result_field_exists() -> void:
|
||||
assert_bool(GameState.has("current_examine_result")).override_failure_message(
|
||||
assert_bool("current_examine_result" in GameState).override_failure_message(
|
||||
"GameState must have 'current_examine_result' field (#174)"
|
||||
).is_true()
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ func _reset_fog_state(fog_state: Node) -> void:
|
||||
GameState.boundary_positions.clear()
|
||||
GameState.visible_tiles.clear()
|
||||
GameState.visibility_sectors.clear()
|
||||
# 32x32 is an arbitrary test fixture size — not a production assumption.
|
||||
fog_state._resize(Rect2i(0, 0, 32, 32))
|
||||
|
||||
|
||||
@@ -220,7 +221,8 @@ func test_exploration_data_preserved_across_resize() -> void:
|
||||
GameState.visible_positions = {Vector2i(3, 3): true}
|
||||
fog_state.update_from_state()
|
||||
|
||||
# Force a resize by moving far away
|
||||
# Move far enough to trigger a resize: _grow_bounds_from_positions adds 8-tile padding,
|
||||
# so (25,25) expands the bounds beyond the 32x32 fixture set in _reset_fog_state.
|
||||
GameState.visible_positions = {Vector2i(25, 25): true}
|
||||
fog_state.update_from_state()
|
||||
|
||||
@@ -250,7 +252,8 @@ func test_newly_added_area_starts_unexplored_after_resize() -> void:
|
||||
GameState.visible_positions = {Vector2i(2, 2): true}
|
||||
fog_state.update_from_state()
|
||||
|
||||
# Move far away to trigger bounds growth
|
||||
# Move far enough to trigger a resize: _grow_bounds_from_positions adds 8-tile padding,
|
||||
# so (30,30) expands the bounds beyond the 32x32 fixture set in _reset_fog_state.
|
||||
GameState.visible_positions = {Vector2i(30, 30): true}
|
||||
fog_state.update_from_state()
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class_name TestGameStateSprint20
|
||||
extends GdUnitTestSuite
|
||||
|
||||
|
||||
func before_each() -> void:
|
||||
func before_test() -> void:
|
||||
GameState.stationary_ticks = 0
|
||||
SnapshotHandler._prev_player_position = Vector2(-1e9, -1e9)
|
||||
GameState.current_zone_id = ""
|
||||
|
||||
Reference in New Issue
Block a user