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

36 lines
1.1 KiB
GDScript

# disconnect_world_reset_test —— 40250 SetOffLinePhase/Destroy 清理边界。
# 显式断开不能只销毁 socket;保留 GameScene 时必须通知 presentation owner 清空旧世界。
extends SceneTree
var _failures := 0
func _check(ok: bool, message: String) -> void:
if not ok:
_failures += 1
printerr("FAIL: " + message)
func _init() -> void:
var client := M2Client.new()
get_root().add_child(client)
var resets := [0]
client.world_reset.connect(func() -> void:
resets[0] += 1)
# The client is offline here, so this checks the public lifecycle contract:
# explicit disconnect always gives the retained scene one synchronous reset
# notification, while remaining idempotent at the transport layer.
client.disconnect_from_server()
_check(resets[0] == 1,
"explicit disconnect emits one world_reset for retained scene cleanup")
client.disconnect_from_server()
_check(resets[0] == 2,
"repeated explicit disconnect emits one reset per lifecycle boundary")
client.free()
if _failures == 0:
print("PASS: disconnect_world_reset_test")
quit(0)
else:
printerr("%d check(s) failed" % _failures)
quit(1)