Files
gplan-2/game/tests/unit/presentation/seal_mark_params_test.gd
T
DKChan 9f21236f80 工程(注释标记词换代·oracle→判据出处): 用户 2026-11-07 令——判据出处注记的标记词改用项目已有中文名,避免 Oracle 被读成数据库。注释格式句、机检正则、标识符、卡片与登记同步换代;零行为改动。
改动面 112 文件 572+/572-:game/tests/** 与 game/probe/** 共 106 件 545 行 `# oracle:`→`# 判据出处:`;tools/capability_audit.py 正则字面量换中文+ORACLE_*→CRITERION_*/check_oracle_markers→check_criterion_markers/oracle_marked(flagged)→criterion_* 共 11 行;test-conventions.md:119 格式句+:155 措辞;待办清单与需求卡片-QA覆盖余量收口批各 1 处字面量;coverage_enum.py:21 与 camp_scene_layout_test.gd:101 旁支措辞;ui_click_probe.gd 对拍局部变量 oracle→expected 7 处;auto_player.gd 三处 safe_set 真值措辞。不动:历史审计报告两份、test-oracle-anchor 分支名、git 史、生成日志;指针格式/扫描面/判红条件/验收义务全不变。

读数(区内实跑):改前 capability_audit --strict「417 注记函数·红项 0」→改后「417 判据出处注记函数·红项 0」exit=0;新标记 545 行/106 文件,现行义务面 oracle 残留 0(在册沿革除外);diff 自检 game/ 非注释新增行仅 6 行且全在 ui_click_probe.gd 的 expected 变量段;112 改动文件 CRLF=0;py_compile tools/capability_audit.py OK;--docs exit=0【验收通过】无新增红;--gates exit=0(静态扫描绿、闸壳 bash -n ×13 失败 0)。
2026-11-07 07:11:15 +08:00

57 lines
3.0 KiB
GDScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# tests/unit/presentation/seal_mark_params_test.gd — 封印印记参数化绘制守门(卡④ R1–R4)
# 断言面:五常量取值逐项相等(ui_kit ↔ art-bible §8.2 对照);着色器文件存在且七个 uniform 名在文;
# 迷雾门控(seal_on × fog_state → 封印子件可见性)〔seal批 V1–V4〕。
# 运行:godot --headless --path game --script res://tests/unit/presentation/seal_mark_params_test.gd
extends SceneTree
const Kit := preload("res://tests/unit/test_kit.gd")
const SEAL_SHADER := "res://presentation/views/seal_mark.gdshader"
const CELL_UNIT := preload("res://presentation/views/board_cell_unit.gd")
func _init() -> void:
# 判据出处: design/ux/battle.md:128 (封印印记参数宿主——装载组)
_test_param_values()
_test_shader_uniforms()
_test_fog_gate()
quit(Kit.finish("seal_mark_params_test"))
# R1–R3/R7 前置:五常量取值逐项相等(art-bible §8.2 定值)
func _test_param_values() -> void:
# 判据出处: design/ux/battle.md:128 (环径与法阵定值组)
Kit.check("SEAL_RING_FRAC = 0.82〔seal批 V1〕", UiKit.SEAL_RING_FRAC == 0.82)
Kit.check("SEAL_WALL_FRAC = 0.11〔seal批 V2〕", UiKit.SEAL_WALL_FRAC == 0.11)
Kit.check("SEAL_ARM_FRAC = 0.156〔seal批 V2〕", UiKit.SEAL_ARM_FRAC == 0.156)
Kit.check("SEAL_HALO_ALPHA = 0.50〔seal批 V3〕", UiKit.SEAL_HALO_ALPHA == 0.50)
Kit.check("SEAL_HALO_GAMMA = 1.6〔seal批 V3〕", UiKit.SEAL_HALO_GAMMA == 1.6)
# R1–R3/R7:着色器存在+七个 uniform 名在文(参数注入面契约)
func _test_shader_uniforms() -> void:
# 判据出处: design/ux/battle.md:128 (着色器参数化绘制组)
var src := FileAccess.get_file_as_string(SEAL_SHADER)
Kit.check("着色器文件存在且非空:%s〔seal批 V1〕" % SEAL_SHADER, src.length() > 0)
if src.length() == 0:
return
for uniform in ["cell_px", "ring_frac", "wall_frac", "arm_frac", "halo_frac", "halo_alpha", "halo_gamma", "mark_col"]:
Kit.check("着色器 uniform 在文:%s〔seal批 V1〕" % uniform, src.contains(uniform))
Kit.check("着色器含光圈半径夹取行(r ≤ cell_px/2——光圈不出格)〔seal批 V3〕",
src.contains("min(r, cell_px * 0.5)"))
# R4 迷雾门控:seal_on × fog_state → 封印子件可见性(内部字段直查=受控例外——子件可见性无公开可观测面,
# 卡面 R4 断言即 prescribe 子件 visible 直查;对照表该行注记理由)
func _test_fog_gate() -> void:
# 判据出处: design/ux/battle.md:128 (迷雾联动门控组)
var u: Node2D = CELL_UNIT.new()
u.seal_on = true
Kit.check("seal_on 即挂封印子件〔seal批 V4〕", u._seal_layer != null)
u.fog_state = 1
Kit.check("雾态(fog_state=1)封印子件不可见〔seal批 V4〕", u._seal_layer.visible == false)
u.fog_state = 0
Kit.check("非雾态(fog_state=0)封印子件可见〔seal批 V4〕", u._seal_layer.visible == true)
u.seal_on = false
Kit.check("撤 seal_on 即撤子件〔seal批 V4〕", u._seal_layer == null)
u.free()