69 lines
1.8 KiB
GDScript
69 lines
1.8 KiB
GDScript
extends SceneTree
|
|
## Headless smoke test for GroupsUI scene and script.
|
|
|
|
func _initialize() -> void:
|
|
_run()
|
|
|
|
func _run() -> void:
|
|
await process_frame
|
|
|
|
print("SMOKE: Starting Groups UI verification...")
|
|
var scene_res := load("res://scenes/groups_ui.tscn")
|
|
if scene_res == null:
|
|
printerr("FAIL: Could not load res://scenes/groups_ui.tscn")
|
|
quit(1)
|
|
return
|
|
|
|
var ui: Control = scene_res.instantiate()
|
|
if ui == null:
|
|
printerr("FAIL: Could not instantiate GroupsUI")
|
|
quit(1)
|
|
return
|
|
|
|
root.add_child(ui)
|
|
await process_frame
|
|
|
|
# Verify essential nodes
|
|
if ui.groups_list_container == null or ui.members_list_container == null:
|
|
printerr("FAIL: container nodes are null")
|
|
quit(1)
|
|
return
|
|
|
|
if ui.group_name_label == null or ui.member_count_label == null:
|
|
printerr("FAIL: label nodes are null")
|
|
quit(1)
|
|
return
|
|
|
|
# Verify signal declaration
|
|
if not ui.has_signal("back_requested"):
|
|
printerr("FAIL: back_requested signal missing")
|
|
quit(1)
|
|
return
|
|
|
|
# Test group card building
|
|
ui._build_group_card(1, "Alpha Guild", "Top tier world creators", 5)
|
|
if ui.groups_list_container.get_child_count() != 1:
|
|
printerr("FAIL: Group card not added to groups_list_container")
|
|
quit(1)
|
|
return
|
|
|
|
print("PASS: Group card building verified.")
|
|
|
|
# Test members list population with owner management
|
|
var mock_members := [
|
|
{"user_id": 10, "role": "owner", "user": {"username": "OwnerUser"}},
|
|
{"user_id": 20, "role": "admin", "user": {"username": "AdminUser"}},
|
|
{"user_id": 30, "role": "member", "user": {"username": "NormalUser"}}
|
|
]
|
|
ui._populate_members_list(mock_members, true)
|
|
if ui.members_list_container.get_child_count() != 3:
|
|
printerr("FAIL: Member list count mismatch")
|
|
quit(1)
|
|
return
|
|
|
|
print("PASS: Group members list population with role management verified.")
|
|
|
|
ui.queue_free()
|
|
print("SMOKE RESULT: PASS")
|
|
quit(0)
|