feat: Enhance surface setup chooser with compact mode and cancel functionality

This commit is contained in:
2026-10-19 09:46:51 -04:00
parent 26dd9c64e1
commit 80ba83b703
5 changed files with 158 additions and 24 deletions
+37
View File
@@ -344,8 +344,45 @@ func _test_selector_setup_routes(controller: StageSceneryController) -> void:
_capture_gui_screen("phase19_wall_setup.png")
var setup: Control = selector.find_child("SurfaceSetupView", true, false) as Control
var draw: Button = selector.find_child("DrawSurfaceButton", true, false) as Button
var cancel_setup: Button = selector.find_child("CancelSurfaceSetupButton", true, false) as Button
var chooser_colors: StageSurfaceColorControls = selector.find_child("SurfaceColorControls", true, false) as StageSurfaceColorControls
_expect(setup != null and setup.visible and draw != null, "Wall panel setup shows a reachable preview and Draw action")
_expect(draw != null and draw.get_parent() == selector.find_child("Footer", true, false), "Wall panel Draw action stays fixed in the chooser footer")
_expect(cancel_setup != null and cancel_setup.visible and cancel_setup.get_parent() == selector.find_child("Footer", true, false), "Wall panel setup keeps an explicit Cancel action in the chooser footer")
_expect(browser.selector_dim != null and browser.selector_dim.mouse_filter == Control.MOUSE_FILTER_STOP, "Clicks outside the scenery chooser are blocked from the Stage canvas")
if gui_render:
selector.hide()
await process_frame
await process_frame
_expect(browser.selector_open and selector.visible, "Unexpected popup dismissal restores the chooser without cancelling setup")
if not gui_render:
browser.selector_open = true
if cancel_setup != null:
cancel_setup.pressed.emit()
_expect(not browser.selector_open and String(controller.get_active_tool()).is_empty(), "Cancel exits the scenery chooser without starting placement")
if gui_render:
_stage.call("_open_selector", "scenery")
await process_frame
await process_frame
await create_timer(0.2).timeout
else:
browser.selector_open = true
browser.set_selector_kind("scenery")
selector.kind = "scenery"
var reopened_entries: Array[Dictionary] = browser.scan_entries("scenery")
reopened_entries.append_array(browser.call("_scenery_background_entries") as Array[Dictionary])
selector.set_entries(reopened_entries)
wall_card = _find_card(selector.find_child("GridContainer", true, false) as GridContainer, "wall_panel_setup")
_expect(wall_card != null, "Cancel returns to a fresh scenery gallery")
if wall_card != null:
selector.call("_on_cell_pressed", wall_card.payload())
if gui_render:
await process_frame
await process_frame
setup = selector.find_child("SurfaceSetupView", true, false) as Control
draw = selector.find_child("DrawSurfaceButton", true, false) as Button
chooser_colors = selector.find_child("SurfaceColorControls", true, false) as StageSurfaceColorControls
_expect(setup != null and setup.visible and draw != null and draw.visible, "Wall setup reopens after Cancel with Draw available")
var wall_looks: StagePanelChoiceGroup = selector.get_meta("wall_look_group") as StagePanelChoiceGroup
if wall_looks != null:
wall_looks.choice_selected.emit(&"finish_wall_wood")