85 lines
4.9 KiB
GDScript
85 lines
4.9 KiB
GDScript
# VERTICAL SLICE - NOT FOR PRODUCTION
|
||
# 战斗一屏样张批 V5–V9 断言面(2026-10-29 迭代 43)——五项实装定值的真实入口断言:
|
||
# V5 血条填充 = 危险红(UiKit.HP_BAR_FILL 值单点 + 绘制点源码锚:全仓零 #689CE8 与零裸
|
||
# Color(0.41,0.61,0.91);条底收 HP_BAR_TRACK 常量);
|
||
# V6 站桩名字行垫 HP_BAR_BACK 素底且不压地台(名字行基线 y < 地台顶 y——name_line_probe 几何出口);
|
||
# V7 顺位徽标提档 UiKit.FS_HINT(值断言 + 绘制点源码锚,§7.4 清单外 11–13px 提档);
|
||
# V8 护甲图标三键(light/ward/heavy)绑对应 24×24 PNG(ResourceLoader 装载结果 + name_line_probe
|
||
# 绑定面);
|
||
# V9 地台件 scene_stage_plaza.png + 护甲三枚入包可加载且尺寸 48×12 / 24×24(§5.2/§5.3 工单)。
|
||
# headless 无渲染面:像素采样以常量单点 + 源码锚 + 探针几何承载(观测面注记,验收对照表 V5 行)。
|
||
# 运行:godot --headless --path game --script res://tests/unit/presentation/standee_present_values_test.gd(expect 0)
|
||
extends SceneTree
|
||
|
||
const Kit := preload("res://tests/unit/test_kit.gd")
|
||
const StandeeBodyScript := preload("res://presentation/views/standee_body.gd")
|
||
|
||
|
||
# 源码锚读面(静态判据——源文件即提交面)
|
||
func _read_source(rel_path: String) -> String:
|
||
var f := FileAccess.open(rel_path, FileAccess.READ)
|
||
if f == null:
|
||
return ""
|
||
return f.get_as_text()
|
||
|
||
|
||
func _init() -> void:
|
||
# ---- V5 血条填充 = 危险红 #A8321F(§4.2 语义物件显式落法) ----
|
||
Kit.check("血条填充常量 = 危险红 #A8321F〔样张批 V5〕",
|
||
UiKit.HP_BAR_FILL.to_html(false) == "a8321f")
|
||
Kit.check("血条条底收常量 HP_BAR_TRACK(视图原裸值原样入册)〔样张批 V5〕",
|
||
UiKit.HP_BAR_TRACK.is_equal_approx(Color(0.10, 0.10, 0.11)))
|
||
var body_src := _read_source("res://presentation/views/standee_body.gd")
|
||
Kit.check("血条绘制点引用 UiKit.HP_BAR_FILL(源码锚)〔样张批 V5〕",
|
||
body_src.contains("UiKit.HP_BAR_FILL"))
|
||
Kit.check("全源零违例值 #689CE8 与零裸 Color(0.41,0.61,0.91)(源码锚)〔样张批 V5〕",
|
||
not body_src.contains("689CE8") and not body_src.contains("689ce8")
|
||
and not body_src.contains("0.41, 0.61, 0.91"))
|
||
|
||
# ---- V6/V8 站桩实例面(名字行几何 + 护甲绑定) ----
|
||
var standee: Node2D = StandeeBodyScript.new("enemy")
|
||
root.add_child(standee)
|
||
standee.set_data({"display_name": "地精", "enemy_id": "goblin", "hp": 3, "max_hp": 3,
|
||
"order": 1, "armor_type": "light"})
|
||
var nl: Dictionary = standee.name_line_probe()
|
||
Kit.check("名字行基线 y < 地台顶 y(文字禁压地台——V6 判据坐标面)〔样张批 V6〕",
|
||
float(nl.baseline_y) < float(nl.plinth_top_y))
|
||
Kit.check("素底牌底沿 ≤ 地台顶(整行不越地台)〔样张批 V6〕",
|
||
Rect2(nl.plate).end.y <= float(nl.plinth_top_y) + 0.01)
|
||
Kit.check("名字行素底 = HP_BAR_BACK 深档 #282220(挂载底色口径)〔样张批 V6〕",
|
||
Color(nl.plate_color).to_html(false) == "282220")
|
||
Kit.check("基线读数与实装几何同源(基线 = 地台顶上方 9px 档:149 < 158)〔样张批 V6〕",
|
||
absf(float(nl.baseline_y) - 149.0) < 0.51 and absf(float(nl.plinth_top_y) - 158.0) < 0.51)
|
||
|
||
# ---- V7 顺位徽标提档 FS_HINT ----
|
||
Kit.check("FS_HINT = 14(§7.4 六档)〔样张批 V7〕", UiKit.FS_HINT == 14)
|
||
Kit.check("顺位徽标绘制点取 UiKit.FS_HINT(源码锚)〔样张批 V7〕",
|
||
body_src.contains("HORIZONTAL_ALIGNMENT_LEFT, -1, UiKit.FS_HINT"))
|
||
|
||
# ---- V8 护甲图标三键绑 24×24 PNG ----
|
||
var armor_paths := {"light": UiKit.TEX_ARMOR_LIGHT, "ward": UiKit.TEX_ARMOR_WARD,
|
||
"heavy": UiKit.TEX_ARMOR_HEAVY}
|
||
for key: String in armor_paths:
|
||
var tex := UiKit.load_tex(armor_paths[key])
|
||
Kit.check("护甲 %s 键绑对应 PNG 且 24×24(§5.3 工单)〔样张批 V8〕" % key,
|
||
tex != null and tex.get_width() == 24 and tex.get_height() == 24)
|
||
var ward_standee: Node2D = StandeeBodyScript.new("enemy")
|
||
root.add_child(ward_standee)
|
||
ward_standee.set_data({"display_name": "蛛化卓尔精灵", "enemy_id": "drider", "hp": 5, "max_hp": 5,
|
||
"order": 1, "armor_type": "ward"})
|
||
var nl_ward: Dictionary = ward_standee.name_line_probe()
|
||
Kit.check("甲档键 → 纹理路径绑定(name_line_probe 出 armor_icon 路径)〔样张批 V8〕",
|
||
bool(nl_ward.armor_tex_bound) and String(nl_ward.armor_icon) == UiKit.TEX_ARMOR_WARD)
|
||
|
||
# ---- V9 地台件与护甲三枚入包可载且尺寸对 ----
|
||
var plaza := UiKit.load_tex(UiKit.TEX_STAGE_PLAZA)
|
||
Kit.check("地台件 scene_stage_plaza.png 可加载且 48×12(§5.2 工单)〔样张批 V9〕",
|
||
plaza != null and plaza.get_width() == 48 and plaza.get_height() == 12)
|
||
for key: String in armor_paths:
|
||
var tex9 := UiKit.load_tex(armor_paths[key])
|
||
Kit.check("护甲三枚入包(24×24)且路径常量在 UiKit 单点〔样张批 V9〕" if key == "light"
|
||
else "护甲三枚入包(24×24)〔样张批 V9〕",
|
||
tex9 != null and tex9.get_width() == 24 and tex9.get_height() == 24)
|
||
|
||
quit(Kit.finish("standee_present_values"))
|