extends SceneTree const STAGE_SCENE := preload("res://scenes/sandbox_stage.tscn") var _failures: int = 0 func _initialize() -> void: call_deferred("_run") func _run() -> void: DirAccess.remove_absolute("user://sandbox_autosave.scene") var stage: Node2D = STAGE_SCENE.instantiate() root.add_child(stage) stage.get_window().size = Vector2i(1280, 720) await process_frame _check(stage._mode_badge.position.x >= stage._palette_dock.size.x, "badge is outside palette dock") _check(stage._mode_frame.offset_left >= stage._palette_dock.size.x, "mode frame is inset beyond palette") _check(stage._mode_buttons.size() == 3 and (stage._mode_buttons[0] as Button).custom_minimum_size.y >= 44.0, "mode buttons are kid-sized") _check(stage._file_menu.get_theme_font_size("font_size") == 22, "File menu uses themed font size") _check((stage._mode_buttons[0] as Button).get_theme_font_size("font_size") == 24, "mode switcher uses themed font size") var mode_switcher: Control = (stage._mode_buttons[0] as Button).get_parent() as Control _check(absf(mode_switcher.get_global_rect().get_center().x - 640.0) <= 1.0, "mode switcher remains horizontally centered at a known viewport width") _check(mode_switcher.get_parent().mouse_filter == Control.MOUSE_FILTER_IGNORE, "full-width mode centering wrapper is mouse-transparent") _check(stage._file_menu.get_popup().get_theme_font_size("font_size") == 26, "File popup uses independently themed font size") _check(stage._unsaved_changes_dialog.get_theme_font_size("font_size") == 22, "dialog font-size theme metric is applied") _check(stage._unsaved_changes_dialog.get_ok_button().get_theme_font_size("font_size") == 22, "dialog button inherits themed font size") _check(stage._unsaved_changes_dialog.get_label().horizontal_alignment == HORIZONTAL_ALIGNMENT_CENTER and stage._unsaved_changes_dialog.get_label().get_theme_font_size("font_size") == 26, "dialog message is centered and larger") var card: Button = stage._palette_buttons["area"] _check(card.clip_contents and card.custom_minimum_size.y >= 100.0, "palette cards clip and reserve vertical space") stage.set_mode(stage.StageMode.DIRECT) _check(is_zero_approx(stage._mode_frame.offset_left), "Direct frame reclaims hidden palette width") stage.set_mode(stage.StageMode.EDIT) _check(stage._mode_frame.offset_left >= stage._palette_dock.size.x, "Edit frame restores palette inset") _check(not stage.is_point_in_stage_frame(Vector2(1, 80), Rect2(100, 50, 600, 400)), "frame helper rejects a palette-side position") _check(stage.is_point_in_stage_frame(Vector2(200, 200), Rect2(100, 50, 600, 400)), "stage frame helper accepts an inner viewport position") stage._grid_size = 15.0 stage._snap_enabled = true stage.set_placement_mode("step") stage._place_at(Vector2(22.0, 23.0)) var placed: Node2D = stage._world.get_child(stage._world.get_child_count() - 1) as Node2D _check(placed.position == Vector2(15.0, 30.0), "single terrain uses configured grid snap") stage._open_selector("prop") await process_frame var selector_card: Variant = stage._selector._grid.get_child(0) _check(selector_card.custom_minimum_size.x >= 190.0 and selector_card.custom_minimum_size.y >= 220.0, "selector uses enlarged themed card metrics") _check(String(selector_card._label.text).length() > 0 and selector_card.thumbnail_rect().custom_minimum_size.x >= 156.0, "selector card shows a name beneath an enlarged thumbnail") stage._on_selector_cancelled() stage.set_mode(stage.StageMode.DIRECT) stage._pending_walk_target = true var right := InputEventMouseButton.new(); right.button_index = MOUSE_BUTTON_RIGHT; right.pressed = true stage._handle_world_click(right) _check(not stage._pending_walk_target, "RMB cancels an active direct target") stage.queue_free() await process_frame print("PASS" if _failures == 0 else "FAIL: %d" % _failures) quit(0 if _failures == 0 else 1) func _check(condition: bool, message: String) -> void: if not condition: _failures += 1 push_error("Phase 7 UI follow-up: " + message)