- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧 - inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域 - 包含其他累积的功能开发和测试文件
67 lines
2.2 KiB
GDScript
67 lines
2.2 KiB
GDScript
# auth_connect_bridge_test —— 40250 AccountConnector OnConnectFailure 的
|
|
# M2Client bridge 回归。运行时需要 MT_PROTOCOL=classic。
|
|
extends SceneTree
|
|
|
|
var _fail := 0
|
|
var _login_failures := 0
|
|
var _connect_failures := 0
|
|
|
|
func _ck(ok: bool, message: String) -> void:
|
|
if not ok:
|
|
_fail += 1
|
|
printerr("FAIL: " + message)
|
|
|
|
func _init() -> void:
|
|
call_deferred("_run")
|
|
|
|
func _run() -> void:
|
|
if not ClassDB.class_exists("M2Client"):
|
|
_ck(false, "M2Client extension is registered")
|
|
_finish()
|
|
return
|
|
var client: Node = ClassDB.instantiate("M2Client")
|
|
get_root().add_child(client)
|
|
client.connect("login_failed", Callable(self, "_on_login_failure"))
|
|
if client.has_signal("connect_failed"):
|
|
client.connect("connect_failed", Callable(self, "_on_connect_failure"))
|
|
else:
|
|
_ck(false, "M2Client exposes connect_failed")
|
|
|
|
client.connect_to_server("this-auth-host-must-not-resolve.invalid", 1,
|
|
"127.0.0.1", 1, "admin", "secret")
|
|
_ck(_connect_failures == 1,
|
|
"initial auth connect failure reaches the distinct OnConnectFailure bridge")
|
|
_ck(_login_failures == 0,
|
|
"initial auth connect failure is not reported as credential login failure")
|
|
_ck(String(client.get_stage()) != "failed",
|
|
"initial auth connect failure does not enter terminal Failed stage")
|
|
|
|
# LoginWindow.Connect must be able to reuse the retained ClassicSession owner
|
|
# after the first failure, instead of falling back to a newly destroyed
|
|
# connection owner.
|
|
client.retry_login("another-auth-host-must-not-resolve.invalid", 1,
|
|
"127.0.0.1", 1, "admin", "secret")
|
|
_ck(_connect_failures == 2,
|
|
"retry_login replaces only the auth transport after auth connect failure")
|
|
_ck(_login_failures == 0,
|
|
"auth connect retry remains separate from credential login failure")
|
|
_ck(String(client.get_stage()) != "failed",
|
|
"auth connect retry does not enter terminal Failed stage")
|
|
|
|
client.disconnect_from_server()
|
|
client.queue_free()
|
|
_finish()
|
|
|
|
func _finish() -> void:
|
|
if _fail == 0:
|
|
print("PASS: auth_connect_bridge_test")
|
|
else:
|
|
printerr("%d check(s) failed" % _fail)
|
|
quit(0 if _fail == 0 else 1)
|
|
|
|
func _on_login_failure(_reason: String) -> void:
|
|
_login_failures += 1
|
|
|
|
func _on_connect_failure(_reason: String) -> void:
|
|
_connect_failures += 1
|