feat(迭代38卡① levelmap批): level_map_screen 三段审计指认落地——l1 视图直读拼文案迁装配层(main_adventure_flow 新增 level_map_status_payload 九键成品,视图 _refresh_status 改 apply_status 纯赋值,喂入点=组合根两处 open_choices 后,刷新时点不变)+l2 _layout BFS 布局缓存(键=nodes 内容等价+canvas.size,_content_size 经 _fit_canvas 派生链间接覆盖,四调用点零改动)+l3 绘制字体函数首单取三处共享;l4 改前 golden 基线新建(level_map.png+README 登记,跨跑次一致性实测 0.00%);验收=wr1 改后对拍 changed=0.00%+wr2 缓存命中/换代失效双绿(is_same 同实例判别,零生产计数器);撤销证明=回退缓存 hunk→V1/V2 红→还原复绿;呈现逐像素不变(契约 1);视图侧拼装 grep 清零(:278 tint 层号读非拼装)

This commit is contained in:
DKChan committed 2026-10-26 05:40:31 +08:00
1 parent b23fa50d81
commit b85b3b45e3
5 files changed
+97 -34

No files matched your search

@@ -26,6 +26,7 @@ func _run() -> void:
_test_details_never_shown()
_test_label_three_states()
await _test_big_graph_fit(db)
await _test_layout_cache(db)
quit(Kit.finish("level_map_info_fog_test"))
@@ -189,3 +190,38 @@ func _test_big_graph_fit(db) -> void:
and bool(disp[boss_ids[0]]["boss_border"]) and bool(disp[boss_ids[1]]["boss_border"]))
Kit.check("大图呈现:入口停点远处战斗节点(句柄 32,层 6)类型入雾〔fv8〕", not bool(disp[32]["draw_icon"]))
screen.queue_free()
# ---- 布局缓存命中与换代失效〔levelmap批 W2〕----
# 真实入口 = open_choices 后的真实绘制路径(_draw_graph→_layout,与 hover→_candidate_at 链同一缓存层);
# 命中读数 = is_same 同实例判别(重算必产新字典、命中返回缓存原实例)——零生产计数器。
func _test_layout_cache(db) -> void:
var nodes := _big_graph_nodes()
var runner = _runner(db, nodes, [nodes[1]])
var screen = ScreenScript.new()
root.add_child(screen)
screen.open_choices([nodes[1]], runner)
await process_frame
await process_frame
var p1: Dictionary = screen.layout_probe(nodes)
var p2: Dictionary = screen.layout_probe(nodes)
Kit.check("布局缓存:同 nodes 两次查询返回同一实例(第二次命中缓存)〔levelmap批 V1〕",
is_same(p1, p2))
# 换代失效:节点集内容变 → 缓存键(内容等价)击穿 → 重算换写。
# 判别式 = 同一性:若缓存未随换代失效,新图查询将命中旧缓存返回同实例;重算必产新字典。
# (不回查旧图——换代后 _content_size 已随 open_choices 重拟合到新图,旧图混查属生产外用法。)
var chain: Array = [
{"id": 0, "type": "battle", "depth": 0, "next": [1]},
{"id": 1, "type": "boss", "depth": 1, "next": []},
]
runner.level_row["nodes"] = chain
screen.open_choices([chain[0]], runner)
await process_frame
await process_frame # 换代图真实绘制路径重算(缓存随内容变失效重写)
var pc1: Dictionary = screen.layout_probe(chain)
var pc2: Dictionary = screen.layout_probe(chain)
Kit.check("布局缓存换代:新图查询返回新实例非旧缓存(失效重算生效)〔levelmap批 V2〕",
not is_same(p1, pc1) and is_same(pc1, pc2)
and (pc1[chain[0]] as Vector2) != (p1[nodes[0]] as Vector2))
screen.queue_free()