From 821d7165097b9e38d38dff502c8ec90f95e1eb7f Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Tue, 24 Feb 2026 11:30:24 +0100 Subject: [PATCH] =?UTF-8?q?fix(client):=20address=20PR=20#62=20review=20su?= =?UTF-8?q?ggestions=20=E2=80=94=20polish=20pass?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - interaction_list.gd: skip queue_redraw() when position unchanged (Tyre #4) - time_display.tscn: widen bounding rect 154x44→184x54, add clip note for #314 wireframe (Tyre #3) - test_time_display_sprint17.gd: document private state access pattern in header (Tyre #5), add upper bound assertion for D-031 1439 max (Hoshe #6) Co-Authored-By: Claude Opus 4.6 --- client/tests/test_time_display_sprint17.gd | 11 +++++++++++ client/ui/interaction_list.gd | 6 +++++- client/ui/time_display.tscn | 8 +++++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/client/tests/test_time_display_sprint17.gd b/client/tests/test_time_display_sprint17.gd index ea38421dd..c19ca6a0e 100644 --- a/client/tests/test_time_display_sprint17.gd +++ b/client/tests/test_time_display_sprint17.gd @@ -8,6 +8,12 @@ ## Implementation: client/ui/time_display.gd — draw-based Control at InsertOverlay/TimeDisplay. ## Format function: Constants.format_game_time(time_of_day: int) -> String (extracted for ## testability from time_display.gd:46 inline Constants.format_game_time(tod)). +## +## Private state access: Tests read _time_str, _phase_str, _day_str, _has_data directly +## because time_display.gd is draw-based (no Label nodes to inspect). This is an accepted +## test pattern for draw-based UI — the private vars ARE the rendered output contract. +## If the rendering approach changes (e.g. to Label nodes), these tests should switch to +## reading Label.text via public node paths instead. class_name TestTimeDisplaySprint17 extends GdUnitTestSuite @@ -253,6 +259,11 @@ func test_sim_bridge_time_of_day_is_non_negative() -> void: var snap = SimBridge._test_snapshot() assert_that(snap.game_time.get("time_of_day", -1) as int).is_greater_equal(0) +func test_sim_bridge_time_of_day_within_day_bounds() -> void: + # D-031: 1440 game-minutes per day, valid range 0..1439 + var snap = SimBridge._test_snapshot() + assert_that(snap.game_time.get("time_of_day", 0) as int).is_less_equal(1439) + func test_sim_bridge_day_phase_is_valid() -> void: var snap = SimBridge._test_snapshot() var phase: String = snap.game_time.get("day_phase", "") diff --git a/client/ui/interaction_list.gd b/client/ui/interaction_list.gd index d44fd7c68..94c099bc9 100644 --- a/client/ui/interaction_list.gd +++ b/client/ui/interaction_list.gd @@ -41,10 +41,14 @@ func _ready() -> void: mouse_filter = Control.MOUSE_FILTER_IGNORE +var _last_screen_pos: Vector2 = Vector2.ZERO + func _process(_delta: float) -> void: if _showing: _update_screen_position() - queue_redraw() + if position != _last_screen_pos: + _last_screen_pos = position + queue_redraw() func _draw() -> void: diff --git a/client/ui/time_display.tscn b/client/ui/time_display.tscn index 6134f8fc3..7145a5abb 100644 --- a/client/ui/time_display.tscn +++ b/client/ui/time_display.tscn @@ -3,7 +3,9 @@ [ext_resource type="Script" path="res://ui/time_display.gd" id="1_tdisplay"] ; #263: Time display — top-left placeholder per D-013/D-051. -; Position will be updated when #314 wireframe lands. +; Position and size will be refined when #314 wireframe lands. +; NOTE: draw-based content manages its own layout; Control rect is a +; minimum bounding box, not a clip rect. Increase if content grows. [node name="TimeDisplay" type="Control"] anchors_preset = 0 anchor_left = 0.0 @@ -12,8 +14,8 @@ anchor_right = 0.0 anchor_bottom = 0.0 offset_left = 16.0 offset_top = 16.0 -offset_right = 170.0 -offset_bottom = 60.0 +offset_right = 200.0 +offset_bottom = 70.0 grow_horizontal = 2 grow_vertical = 2 mouse_filter = 2