From fc24de61281758fab28d4716c7e8f216f3bc0900 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Thu, 5 Mar 2026 08:41:18 +0100 Subject: [PATCH] fix(client): test harness tile types, bug report screenshot, time_display maxf TestHarness: remove deprecated tiles/visible_positions keys, add tile type (floor/wall/door) to visible_tiles, expand radius to 5. Bug report dialog: capture viewport screenshot before showing overlay, save as screenshot.png in report bundle. time_display: use maxf() instead of max() to match float argument types. Co-Authored-By: Claude Opus 4.6 --- client/scripts/protocol/test_harness.gd | 27 +++++++------------ .../tests/test_entanglement_sprint22.gd.uid | 1 + client/tests/test_fog_sprint22.gd.uid | 1 + client/ui/bug_report_dialog.gd | 17 +++++++++++- client/ui/time_display.gd | 2 +- 5 files changed, 29 insertions(+), 19 deletions(-) create mode 100644 client/tests/test_entanglement_sprint22.gd.uid create mode 100644 client/tests/test_fog_sprint22.gd.uid diff --git a/client/scripts/protocol/test_harness.gd b/client/scripts/protocol/test_harness.gd index d75b6f8cf..f40055dc0 100644 --- a/client/scripts/protocol/test_harness.gd +++ b/client/scripts/protocol/test_harness.gd @@ -179,9 +179,7 @@ func snapshot() -> Dictionary: "player_stance": "Walk", "player_inventory": [], "entities": entities, - "tiles": _tiles(), "visible_tiles": _visible_tiles(), - "visible_positions": _visible_positions(), "nearby_interactions": nearby, "current_monologue": monologue, "current_dialogue": dialogue, @@ -229,7 +227,7 @@ func _visible_tiles() -> Array: var vtiles: Array = [] var px := player_pos.x var py := player_pos.y - var radius := 4 + var radius := 5 var room_x := 7 var room_y := 7 var room_w := 8 @@ -241,27 +239,22 @@ func _visible_tiles() -> Array: if dist <= radius: if x >= room_x and x < room_x + room_w and y >= room_y and y < room_y + room_h: var sector: String = "Forward" if y <= py else "Peripheral" - vtiles.append({"x": x, "y": y, "z": 0, "visibility": sector}) + vtiles.append({"x": x, "y": y, "z": 0, "visibility": sector, "type": _get_tile_type(x, y)}) return vtiles -func _visible_positions() -> Array: - var positions: Array = [] - var px := player_pos.x - var py := player_pos.y - var radius := 4 +func _get_tile_type(x: int, y: int) -> String: var room_x := 7 var room_y := 7 var room_w := 8 var room_h := 8 - - for x in range(px - radius, px + radius + 1): - for y in range(py - radius, py + radius + 1): - var dist := absf(x - px) + absf(y - py) - if dist <= radius: - if x >= room_x and x < room_x + room_w and y >= room_y and y < room_y + room_h: - positions.append({"x": x, "y": y}) - return positions + var is_edge := (x == room_x or x == room_x + room_w - 1 + or y == room_y or y == room_y + room_h - 1) + if is_edge: + if y == room_y + room_h - 1 and x == room_x + room_w / 2: + return "door" + return "wall" + return "floor" # -- Spatial helpers ----------------------------------------------------------- diff --git a/client/tests/test_entanglement_sprint22.gd.uid b/client/tests/test_entanglement_sprint22.gd.uid new file mode 100644 index 000000000..bad8ed8cd --- /dev/null +++ b/client/tests/test_entanglement_sprint22.gd.uid @@ -0,0 +1 @@ +uid://c1dnlbnxtgqqo diff --git a/client/tests/test_fog_sprint22.gd.uid b/client/tests/test_fog_sprint22.gd.uid new file mode 100644 index 000000000..90787ff09 --- /dev/null +++ b/client/tests/test_fog_sprint22.gd.uid @@ -0,0 +1 @@ +uid://bxhgo1e4rvfmi diff --git a/client/ui/bug_report_dialog.gd b/client/ui/bug_report_dialog.gd index 1936ee3ed..bffaf1913 100644 --- a/client/ui/bug_report_dialog.gd +++ b/client/ui/bug_report_dialog.gd @@ -11,6 +11,7 @@ extends Control ## - inputs.jsonl — last 60 ticks of PlayerInput (replay-compatible JSONL) ## - snapshots.jsonl — last 60 ticks of ObserverSnapshot (one JSON per line) ## - seed.txt — RNG seed for deterministic replay +## - screenshot.png — viewport capture taken before dialog opened ## ## Ring buffer: pre-allocated RING_SIZE arrays at startup. record_tick() is the ## public API for main.gd. _push_tick_inputs() / _push_tick_snapshot() are the @@ -36,6 +37,7 @@ const RING_SIZE := 60 var _line_edit: LineEdit = null var _active: bool = false +var _captured_screenshot: Image = null # #507: Pre-allocated ring buffers (no per-tick allocation after _ready). # Input ring: replay-format PlayerInput arrays, one per tick. @@ -201,6 +203,8 @@ func _get_filled_snapshot_count() -> int: func start_capture() -> void: if _active: return + # Capture screenshot BEFORE showing the dialog overlay + _captured_screenshot = get_viewport().get_texture().get_image() _active = true visible = true @@ -247,6 +251,8 @@ func _close() -> void: _line_edit.queue_free() _line_edit = null + _captured_screenshot = null + # Unpause the simulation SimBridge.send_input({ "action": InputMapper.Action.UNPAUSE, @@ -345,7 +351,16 @@ func _save_report(description: String) -> void: else: push_error("BugReport: failed to write %s" % seed_path) - print("BugReport: saved %d/6 files to %s (ring: %d ticks)" % [ + # 7. screenshot.png — viewport capture taken before dialog opened + if _captured_screenshot: + var screenshot_path := base_path + "/screenshot.png" + var img_err := _captured_screenshot.save_png(screenshot_path) + if img_err == OK: + files_saved += 1 + else: + push_error("BugReport: failed to write %s (error %d)" % [screenshot_path, img_err]) + + print("BugReport: saved %d/7 files to %s (ring: %d ticks)" % [ files_saved, base_path, _input_count]) diff --git a/client/ui/time_display.gd b/client/ui/time_display.gd index bf1fe44ee..71898f6ee 100644 --- a/client/ui/time_display.gd +++ b/client/ui/time_display.gd @@ -70,7 +70,7 @@ func _cache_geometry() -> void: _day_size = font.get_string_size(_day_text, HORIZONTAL_ALIGNMENT_LEFT, -1, FONT_SIZE_META) _meta_h = font.get_string_size("A", HORIZONTAL_ALIGNMENT_LEFT, -1, FONT_SIZE_META).y var meta_w := _phase_size.x + _day_size.x - var content_w := max(_time_size.x, meta_w) + var content_w := maxf(_time_size.x, meta_w) _box_w = content_w + PADDING.x * 2 _box_h = PADDING.y * 2 + _time_size.y + 3 + _meta_h