feat(godot): marketplace browse, search/filter and buy UI
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
extends SceneTree
|
||||
## Headless smoke test for MarketplaceUI scene and script.
|
||||
|
||||
func _initialize() -> void:
|
||||
_run()
|
||||
|
||||
func _run() -> void:
|
||||
await process_frame
|
||||
print("[SMOKE] Starting MarketplaceUI smoke test...")
|
||||
|
||||
var scene = load("res://scenes/marketplace_ui.tscn")
|
||||
if not scene:
|
||||
printerr("[FAIL] Could not load scenes/marketplace_ui.tscn")
|
||||
quit(1)
|
||||
return
|
||||
|
||||
var ui: Control = scene.instantiate()
|
||||
root.add_child(ui)
|
||||
await process_frame
|
||||
|
||||
# Verify onready nodes
|
||||
assert(ui.back_button != null, "Missing back_button")
|
||||
assert(ui.refresh_button != null, "Missing refresh_button")
|
||||
assert(ui.balance_label != null, "Missing balance_label")
|
||||
assert(ui.status_label != null, "Missing status_label")
|
||||
assert(ui.search_edit != null, "Missing search_edit")
|
||||
assert(ui.type_option != null, "Missing type_option")
|
||||
assert(ui.min_price_edit != null, "Missing min_price_edit")
|
||||
assert(ui.max_price_edit != null, "Missing max_price_edit")
|
||||
assert(ui.search_btn != null, "Missing search_btn")
|
||||
assert(ui.listings_container != null, "Missing listings_container")
|
||||
|
||||
# Verify type options populated
|
||||
assert(ui.type_option.item_count >= 4, "Type options not populated")
|
||||
|
||||
# Test rendering empty listings
|
||||
ui.render_listings([])
|
||||
assert(ui.listings_container.get_child_count() == 1, "Should show empty notice")
|
||||
|
||||
# Test rendering sample listings
|
||||
var sample_listings = [
|
||||
{
|
||||
"id": 10,
|
||||
"price": 200,
|
||||
"seller_username": "merchant_bob",
|
||||
"catalog_item": {
|
||||
"name": "Wizard Robe",
|
||||
"item_type": "avatar_item",
|
||||
"description": "Flowing velvet robe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"price": 500,
|
||||
"seller_username": "dungeon_master",
|
||||
"catalog_item": {
|
||||
"name": "Castle Map",
|
||||
"item_type": "asset",
|
||||
"description": "Detailed 3D fortress map"
|
||||
}
|
||||
}
|
||||
]
|
||||
ui.render_listings(sample_listings)
|
||||
assert(ui.listings_container.get_child_count() == 2, "Should render 2 listing cards")
|
||||
|
||||
# Verify signals
|
||||
assert(ui.has_signal("back_requested"), "Missing back_requested signal")
|
||||
assert(ui.has_signal("item_purchased"), "Missing item_purchased signal")
|
||||
|
||||
ui.queue_free()
|
||||
print("[SMOKE] MarketplaceUI smoke test PASSED")
|
||||
quit(0)
|
||||
Reference in New Issue
Block a user