Files
mtgodot-poc/project/test_full_skill_flow.gd
T
shenandshen c93894313a fix: 装备属性面板避让逻辑 + 多项功能更新
- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧
- inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域
- 包含其他累积的功能开发和测试文件
2026-09-21 16:38:59 -07:00

67 lines
2.1 KiB
GDScript

extends SceneTree
const FakeClient = preload("res://net_client_fake.gd")
const GameScene = preload("res://game_scene.gd")
const SkillTable = preload("res://ui/skill_table.gd")
const Quickbar = preload("res://ui/quickbar.gd")
var _fail := 0
func _ck(condition: bool, message: String) -> void:
if not condition:
_fail += 1
printerr("FAIL: " + message)
func _init() -> void:
await _run()
if _fail == 0:
print("PASS: test_full_skill_flow (fixture + scene + action packet order)")
quit(0)
else:
printerr("%d check(s) failed" % _fail)
quit(1)
func _run() -> void:
var assets := AssetRoot.path()
var client := FakeClient.new()
get_root().add_child(client)
var table := SkillTable.new()
var loaded := false
for lang in ["en", "common"]:
if table.load_file(assets.path_join("locale/locale/%s/skilldesc.txt" % lang)):
loaded = true
break
_ck(loaded, "skill table fixture loads")
if not loaded:
return
client.entities[2000] = {"vid": 2000, "name": "Wolf", "race": 101, "kind": 2,
"ch_type": 2, "pos": Vector3(1, 0, 0), "pos_cm": Vector3(100, 0, 0),
"hp": 100, "max_hp": 100, "dead": false}
client.target_vid = 2000
var host := CanvasLayer.new()
get_root().add_child(host)
var qb := Quickbar.new()
get_root().add_child(qb)
qb.setup(client, table, host, func() -> Node: return null, assets)
qb.assign(0, "skill", 1, false)
qb.activate(0)
_ck(client.calls.size() >= 2, "skill activation reaches fake client")
if client.calls.size() >= 2:
_ck(client.calls[0][0] == "cast_skill" and client.calls[1][0] == "use_skill",
"40250 order: FUNC_SKILL precedes CG_USE_SKILL")
_ck(client.calls[1][1] == 1 and client.calls[1][2] == 2000,
"skill intent carries skill id and resolved target")
var gs := GameScene.new()
get_root().add_child(gs)
await gs.setup(client, "", "no_such_map")
await process_frame
_ck(gs.net_play != null and gs.player != null, "GameScene full flow is assembled")
_ck(gs.quickbar == null, "empty asset setup does not create a duplicate skill UI")
gs.queue_free()
qb.queue_free()
host.queue_free()
client.queue_free()
await process_frame