iter52-卡3:迭代52卡③(presentation层封装修复): A1三类42字段公开化(280处改址)+A2拆件子件公开面(vitals14/motion14/board_hover七口)+B族组合根交接面(18服务+12句柄口,束参两处,on_*保私有)+C族杂项(UiKit三工厂/构造交付)——presentation私取sweep恒零(V1-V4,105checks),main.gd例外键32与ui_kit例外键23落基线(§3.2误测0/0反哺点),探针测试22处引用迁移,渲染golden与探针套件零转红; 验收档中

This commit is contained in:
DKChan committed 2026-11-05 03:04:21 +08:00
1 parent f2c3a3887d
commit 67024cb9ec
42 files changed
+1391 -679

No files matched your search

@@ -0,0 +1,52 @@
# 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:
_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:
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:
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:
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()