78 lines
1.8 KiB
GDScript
78 lines
1.8 KiB
GDScript
extends SceneTree
|
|
## Headless smoke test for FriendsPresenceUI scene and script.
|
|
|
|
func _initialize() -> void:
|
|
_run()
|
|
|
|
func _run() -> void:
|
|
await process_frame
|
|
|
|
print("SMOKE: Starting Friends & Presence UI verification...")
|
|
var scene_res := load("res://scenes/friends_presence_ui.tscn")
|
|
if scene_res == null:
|
|
printerr("FAIL: Could not load res://scenes/friends_presence_ui.tscn")
|
|
quit(1)
|
|
return
|
|
|
|
var ui: Control = scene_res.instantiate()
|
|
if ui == null:
|
|
printerr("FAIL: Could not instantiate FriendsPresenceUI")
|
|
quit(1)
|
|
return
|
|
|
|
root.add_child(ui)
|
|
await process_frame
|
|
|
|
# Verify essential nodes
|
|
if ui.friends_container == null:
|
|
printerr("FAIL: friends_container is null")
|
|
quit(1)
|
|
return
|
|
|
|
if ui.requests_container == null:
|
|
printerr("FAIL: requests_container is null")
|
|
quit(1)
|
|
return
|
|
|
|
if ui.following_container == null:
|
|
printerr("FAIL: following_container is null")
|
|
quit(1)
|
|
return
|
|
|
|
if ui.blocked_container == null:
|
|
printerr("FAIL: blocked_container is null")
|
|
quit(1)
|
|
return
|
|
|
|
# Verify signal declaration
|
|
if not ui.has_signal("back_requested"):
|
|
printerr("FAIL: back_requested signal missing")
|
|
quit(1)
|
|
return
|
|
|
|
# Test mock row building
|
|
ui._friend_presence_map[42] = {
|
|
"status": "online",
|
|
"custom_status": "Building cool stuff",
|
|
"last_seen": "2026-09-15T12:00:00Z"
|
|
}
|
|
ui._build_friend_row(42, "TesterFriend")
|
|
|
|
if not ui.friends_container.has_node("FriendRow_42"):
|
|
printerr("FAIL: FriendRow_42 was not added to friends_container")
|
|
quit(1)
|
|
return
|
|
|
|
print("PASS: Friend row built successfully with presence indicator.")
|
|
|
|
# Test message display
|
|
ui.show_message("Test message", false)
|
|
if ui.status_label.text != "Test message":
|
|
printerr("FAIL: status_label text not updated")
|
|
quit(1)
|
|
return
|
|
|
|
ui.queue_free()
|
|
print("SMOKE RESULT: PASS")
|
|
quit(0)
|