Fix: world cards render at ~1px wide once real data exists
Reported directly by the user after seeding a test world through the browse-worlds screen: "screen is blank now". Two compounding layout bugs, both real: 1. world_list.tscn's root VBoxContainer had no anchors at all, only size_flags -- but its parent (the scene's root node) is a plain Control, not a Container, so size_flags on a Control's direct child are meaningless there. Without anchors it never actually filled the screen, so it (and everything under it) collapsed toward zero size. 2. size_flags_horizontal/vertical used the raw integer 4 everywhere expand-fill was clearly intended (ScrollContainer, its WorldList child, HeaderHBox, TitleLabel) -- but 4 is Control.SIZE_SHRINK_CENTER in Godot 4, not SIZE_EXPAND_FILL (which is 3). ScrollContainer with SHRINK_CENTER takes only its own minimum size instead of expanding, cascading a ~1px width down through every card and every label. Confirmed the actual enum values by asking Godot directly rather than assuming. Both are exactly the kind of bug a headless smoke test checking only "did cards get added to the tree" can't catch -- child_count was correctly non-zero, nothing crashed, the content was just rendered invisibly thin. Verified the fix is real by deliberately reintroducing bug #2 and confirming the test now correctly fails (card width 25px, below the 200px sanity threshold) before restoring it. Also replaced the card background: it was a ColorRect manually moved to child index 0 of a VBoxContainer, which doesn't work as an overlay -- a VBoxContainer lays out ALL its children in sequence, so the "moved to front" ColorRect rendered as an empty dark bar ABOVE the text, not behind it. Now a proper PanelContainer with a StyleBoxFlat background, the idiomatic way to get a colored panel behind auto-laid-out content in Godot. smoke_test_world_list.gd strengthened to actually catch this class of bug going forward: seeds a real world via POST /api/worlds/ first (the checkpoint runner's fresh DB meant the populated-card path never ran in CI at all before this, only empty-list did), and asserts each card's real computed width, not just that cards exist. Full checkpoint suite re-verified clean on this branch: migrations, 68/68 pytest, all 6 Godot smoke tests, both platform exports. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,15 +16,27 @@ extends SceneTree
|
||||
##
|
||||
## Tests:
|
||||
## 1. Register + log in a fresh user (so get_worlds() has a valid token).
|
||||
## 2. Instantiate world_list.tscn, add to tree -- @onready resolution
|
||||
## 2. POST a real world via the API so the populated-card path actually
|
||||
## gets exercised -- run_checkpoint_tests.py always starts from a
|
||||
## genuinely empty DB, so without this the card-rendering code below
|
||||
## would never run in CI at all, only the empty-list path would.
|
||||
## 3. Instantiate world_list.tscn, add to tree -- @onready resolution
|
||||
## must not error.
|
||||
## 3. Wait for _refresh_worlds()'s awaited request to complete.
|
||||
## 4. Confirm the screen reached a real end state (world cards, or the
|
||||
## empty-list message -- either is fine, a crash/stuck-loading isn't).
|
||||
## 4. Wait for _refresh_worlds()'s awaited request to complete.
|
||||
## 5. Confirm it actually reached the populated (not empty) state, and
|
||||
## that the rendered card has a real width -- not just non-zero
|
||||
## child_count. 2026-08-20: a real bug shipped where every card
|
||||
## technically existed in the tree (child_count > 0, no error, no
|
||||
## crash) but rendered at 1.0px wide because size_flags_horizontal/
|
||||
## vertical used the raw integer 4 (Control.SIZE_SHRINK_CENTER)
|
||||
## instead of 3 (Control.SIZE_EXPAND_FILL) on ScrollContainer -- a
|
||||
## child-count check alone would never catch that, only a real size
|
||||
## assertion does.
|
||||
##
|
||||
## Exits 0 on full pass, 1 on any failure.
|
||||
|
||||
const WORLD_LIST_SCENE := "res://scenes/world_list.tscn"
|
||||
const MIN_SANE_CARD_WIDTH := 200.0 # a real screen is at minimum a few hundred px wide
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
@@ -52,6 +64,19 @@ func _run() -> void:
|
||||
quit(1)
|
||||
return
|
||||
|
||||
# --- Seed a real world so the populated-card path is actually exercised ---
|
||||
print("\n=== Setup: seed a real world ===")
|
||||
var world_body := JSON.stringify({
|
||||
"name": "Smoke Test World %d" % unique_id,
|
||||
"description": "Seeded by smoke_test_world_list.gd to exercise the populated-card render path.",
|
||||
"visibility": "public",
|
||||
})
|
||||
var create_result: Dictionary = await api.request(HTTPClient.METHOD_POST, "/api/worlds/", world_body, "application/json", true)
|
||||
if not _check("setup: world created", create_result.ok):
|
||||
print(" detail: ", create_result.detail)
|
||||
quit(1)
|
||||
return
|
||||
|
||||
# --- Test 1: Instantiate the real scene ---
|
||||
print("\n=== Test 1: Instantiate world_list.tscn ===")
|
||||
var packed_scene: PackedScene = load(WORLD_LIST_SCENE)
|
||||
@@ -99,10 +124,31 @@ func _run() -> void:
|
||||
|
||||
if error_label.visible:
|
||||
printerr(" Note: ended in error state: ", error_label.text)
|
||||
elif world_list_node.visible:
|
||||
print(" Note: rendered %d world card(s)" % world_list_node.get_child_count())
|
||||
elif empty_label.visible:
|
||||
print(" Note: ended in empty-list state")
|
||||
# We just seeded a world -- ending up empty means GET /api/worlds
|
||||
# isn't actually seeing what POST /api/worlds/ just created.
|
||||
_check("ended in populated state, not empty (a world was just seeded)", false)
|
||||
failed += 1
|
||||
elif world_list_node.visible:
|
||||
var card_count := world_list_node.get_child_count()
|
||||
print(" Note: rendered %d world card(s)" % card_count)
|
||||
|
||||
if _check("at least one card rendered", card_count > 0):
|
||||
passed += 1
|
||||
else:
|
||||
failed += 1
|
||||
|
||||
# The actual bug this test exists to catch: a card can be present
|
||||
# in the tree, not crash, and still be visually nothing because
|
||||
# it rendered at ~1px wide. Check every card's real computed size,
|
||||
# not just that it exists.
|
||||
for i in range(card_count):
|
||||
var card: Control = world_list_node.get_child(i)
|
||||
var wide_enough := card.size.x >= MIN_SANE_CARD_WIDTH
|
||||
if _check("card %d has a real width (%.0fpx >= %.0fpx)" % [i, card.size.x, MIN_SANE_CARD_WIDTH], wide_enough):
|
||||
passed += 1
|
||||
else:
|
||||
failed += 1
|
||||
|
||||
# --- Summary ---
|
||||
print("\n=== SMOKE RESULT: %d/%d passed ===" % [passed, passed + failed])
|
||||
|
||||
Reference in New Issue
Block a user