From dbc6908bf67d5237d11c2e2ef2d096dbad2049ed Mon Sep 17 00:00:00 2001 From: DKChan <524912269@qq.com> Date: Tue, 29 Sep 2026 15:12:36 +0800 Subject: [PATCH] =?UTF-8?q?test(t5-hotfix):=20=E5=A5=96=E5=8A=B1=E8=8A=82?= =?UTF-8?q?=E7=82=B9=20UI=20=E7=9B=B4=E9=AA=8C=E5=A5=97=E4=BB=B6=E8=BD=AC?= =?UTF-8?q?=E6=AD=A3=E2=80=94=E2=80=94=E6=B1=A0=E7=A9=BA=E7=9B=B4=E9=80=9A?= =?UTF-8?q?/=E5=85=A8=E5=88=97=E5=91=88=E7=8E=B0/=E5=BC=BA=E5=88=B6?= =?UTF-8?q?=E9=80=89=E6=8B=A9/item=5Fchosen=20=E5=A4=96=E5=8F=91=E5=9B=9B?= =?UTF-8?q?=E6=96=AD=E8=A8=80=EF=BC=88=E6=8E=A2=E9=92=88=E7=9B=B2=E5=8C=BA?= =?UTF-8?q?=E8=A1=A5=E6=BC=8F=EF=BC=8Crun=5Fall=20manifest+1=EF=BC=89?= =?UTF-8?q?=EF=BC=9Bhotfix=20=E5=90=8E=E5=86=92=E7=83=9F=20577/0+=E7=9B=B4?= =?UTF-8?q?=E9=AA=8C=20PASS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/tests/run_all.gd | 1 + .../unit/presentation/reward_overlay_test.gd | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 game/tests/unit/presentation/reward_overlay_test.gd diff --git a/game/tests/run_all.gd b/game/tests/run_all.gd index 45b1d68c..19747020 100644 --- a/game/tests/run_all.gd +++ b/game/tests/run_all.gd @@ -33,6 +33,7 @@ func _suites() -> Array: {"path": "res://tests/unit/data_config/reward_dangling_aux_test.gd", "expect": 1}, # 迭代 7 T1——aux 双表校验 {"path": "res://tests/unit/data_config/rng_service_test.gd", "expect": 0}, {"path": "res://tests/unit/core/aux_items_test.gd", "expect": 0}, # 迭代 7 T7——魔法道具结构冻结断言面 + {"path": "res://tests/unit/presentation/reward_overlay_test.gd", "expect": 0}, # 迭代 7 hotfix——奖励节点 UI 直验(盲区补漏) {"path": "res://tests/unit/battle_settlement/damage_math_test.gd", "expect": 0}, {"path": "res://tests/unit/battle_settlement/damage_controller_test.gd", "expect": 0}, {"path": "res://tests/unit/contracts/system_contracts_test.gd", "expect": 0}, diff --git a/game/tests/unit/presentation/reward_overlay_test.gd b/game/tests/unit/presentation/reward_overlay_test.gd new file mode 100644 index 00000000..7453f1c4 --- /dev/null +++ b/game/tests/unit/presentation/reward_overlay_test.gd @@ -0,0 +1,41 @@ +extends SceneTree +# 奖励节点三选一 UI 直验套件(迭代 7 T5-hotfix 转正——奖励节点 UI 无探针路径触达的盲区补漏: +# show_reward_items 函数体曾在合并中丢失而全闸绿灯实机炸——「功能存在 ≠ 功能可达」的测试面教训)。 +# 运行:godot --headless --path game --script res://tests/unit/presentation/reward_overlay_test.gd(expect 0) +# 覆盖:池空直通态 / 全列呈现按钮数 / 强制选择(继续隐藏)/ item_chosen 信号外发。 +func _initialize() -> void: + call_deferred("_run") + +func _run() -> void: + var ov = load("res://presentation/views/node_overlay.gd").new() + root.add_child(ov) + var called := [] + ov.item_chosen.connect(func(id: String): called.append(id)) + ov.show_reward_items([]) + if ov.visible != true or ov._btn.visible != true: + print("[reward_verify] FAIL — 池空态应为直通确认(visible/继续可见)") + quit(1) + return + ov.close_reward() + ov.show_reward_items([ + {"item_id": "sapper_order", "display_name": "工兵令", "glyph": "工"}, + {"item_id": "nest_pendulum", "display_name": "探巢摆钟", "glyph": "摆"}, + ]) + var btns := 0 + for c in ov._choice_box.get_children(): + if c is Button: + btns += 1 + if btns != 2 or ov._btn.visible: + print("[reward_verify] FAIL — 两件应呈现两按钮且继续隐藏(btns=%d 继续可见=%s)" % [btns, str(ov._btn.visible)]) + quit(1) + return + for c in ov._choice_box.get_children(): + if c is Button: + c.pressed.emit() + break + if called.size() != 1 or String(called[0]) != "sapper_order": + print("[reward_verify] FAIL — 选择未外发 item_chosen(%s)" % str(called)) + quit(1) + return + print("[reward_verify] PASS — 池空直通/全列呈现/强制选择/选择外发 全过") + quit(0)