From 80ecc836c286c40fed1749207fece63927d56b73 Mon Sep 17 00:00:00 2001 From: goose Date: Thu, 8 Oct 2026 20:30:36 -0400 Subject: [PATCH] test: align HUD location contract with authored rooms --- task-PR-3-report | 4 ++++ tests/unit/test_hud_layout.gd | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/task-PR-3-report b/task-PR-3-report index 547a9d6..7b69b71 100644 --- a/task-PR-3-report +++ b/task-PR-3-report @@ -34,6 +34,10 @@ Visual capture passed: No test, parse, script, or visual-check failures were found. Standard pre-existing GUT invalid-UID and Godot cleanup/resource warnings were emitted, but the verifier accepted them and exited 0. +## Fix round 1 — Task 3 review + +The dynamic HUD layout contract now derives the expected location id from the authored `floor_state.rooms` bounds before checking the live header text. This avoids calling `room_at()` on surface corridor cells whose map room id is intentionally absent, without changing SurfaceGenerator, HUD, or domain behavior. + ## Git This report and only the PR-3 tourist implementation/tests are committed locally in one commit. No push or pull request was created. diff --git a/tests/unit/test_hud_layout.gd b/tests/unit/test_hud_layout.gd index 63e98d9..6b49c6c 100644 --- a/tests/unit/test_hud_layout.gd +++ b/tests/unit/test_hud_layout.gd @@ -191,9 +191,15 @@ func test_dynamic_hud_groups_refresh_from_live_game_values() -> void: var header_text := _combined_label_text(header_values) var character_text := _combined_label_text(character_values) + var expected_room_id := "" + for room: RoomState in state.floor_state.rooms: + if room.bounds.has_point(state.player.cell): + expected_room_id = String(room.id) + break + assert_ne(expected_room_id, "", "The player's authored room must be discoverable from its bounds") assert_string_contains(header_text, run.player_name) assert_string_contains(header_text, str(state.floor_state.floor_number)) - assert_string_contains(header_text, String(state.floor_state.room_at(state.player.cell).id)) + assert_string_contains(header_text, expected_room_id) assert_string_contains(header_text, str(state.explored_cells.size())) assert_string_contains(character_text, str(state.player.hit_points)) _assert_controls_enclosed(top_bar, header_values, "TopBar")