Files
gplan-2/game/tests/unit/presentation/animation_frame_spec_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

45 lines
2.3 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/animation_frame_spec_test.gd — 动画帧数规格守门(定值面=本测试)
# 断言面:①帧数规格表冻结(待机循环 4 帧/攻击准备 6 帧单次/受击 2 帧——样张冻结定值,
# 规格表与圣经 §8.4 帧数规格条对照,守门防漂移);②现役四态单帧形制锚定(idle/walk 32×32、attack 92×92、
# hit 88×92——现役为单帧状态件,序列帧资产入包时按规格表逐件判帧数并同批换代本套件);
# ③死亡=灰化+碎裂退场(非帧件,无帧数断言面)。
# 运行:godot --headless --path game --script res://tests/unit/presentation/animation_frame_spec_test.gd
extends SceneTree
const Kit := preload("res://tests/unit/test_kit.gd")
# 帧数规格表(样张冻结值——多帧序列帧资产的生产规格;现役单帧占位件不适用本表)
const SPEC := {"idle": 4, "attack": 6, "hit": 2}
# 现役单帧形制(宽,高)——序列帧资产替换形制时同批修订本表并激活规格逐件断言
const CURRENT_FORM := {
"character_hero_idle.png": Vector2i(32, 32),
"character_hero_walk.png": Vector2i(32, 32),
"character_hero_attack.png": Vector2i(92, 92),
"character_hero_hit.png": Vector2i(88, 92),
}
func _init() -> void:
# 判据出处: design/art/art-bible.md:539 (帧数规格条——样张冻结定值组)
_test_spec_table()
_test_current_form()
quit(Kit.finish("animation_frame_spec_test"))
# ① 规格表冻结面(帧数档定值单点=本表)
func _test_spec_table() -> void:
# 判据出处: design/art/art-bible.md:539 (帧数规格表冻结组)
Kit.check("待机循环 4 帧在表〔帧规格 V1〕", SPEC.get("idle", 0) == 4)
Kit.check("攻击准备 6 帧单次在表〔帧规格 V2〕", SPEC.get("attack", 0) == 6)
Kit.check("受击 2 帧在表〔帧规格 V3〕", SPEC.get("hit", 0) == 2)
# ② 现役单帧形制锚定(真实加载链——资产被换形制而未走规格表时此处红)
func _test_current_form() -> void:
# 判据出处: design/art/art-bible.md:539 (现役单帧形制组)
for fn: String in CURRENT_FORM:
var tex: Texture2D = load("res://assets/art/character/" + fn)
var want := Vector2(CURRENT_FORM[fn])
Kit.check("现役件在库且形制冻结:%s %s〔帧规格 V4〕" % [fn, want],
tex != null and tex.get_size() == want)