Add StageBackgroundView and related tests for plain background functionality
- Implemented StageBackgroundView class for managing sky and plain backgrounds in the stage. - Added functionality to set background type and color, bind camera, and apply themes. - Created test_phase19_plain_background.gd to validate plain background behavior and migration. - Developed test_phase19_starter_chooser_layout.gd to ensure proper layout and functionality of the starter chooser. - Included visual capture tests for UI elements and interactions.
This commit is contained in:
@@ -12,6 +12,7 @@ const STARTER_CARD_PREVIEW: Script = preload("res://scripts/stage/scenery/stage_
|
||||
const STAGE_SKY_VIEW_SCRIPT: Script = preload("res://scripts/stage/scenery/stage_sky_view.gd")
|
||||
const STARTER_PATHS: Array[String] = [
|
||||
"res://content/stages/starters/blank.scene",
|
||||
"res://content/stages/starters/plain_background.scene",
|
||||
"res://content/stages/starters/town_street.scene",
|
||||
"res://content/stages/starters/living_room.scene",
|
||||
]
|
||||
@@ -90,7 +91,7 @@ func _run() -> void:
|
||||
)
|
||||
var browser: StageAssetBrowser = _stage.get("_asset_browser") as StageAssetBrowser
|
||||
var starter_entries: Array[Dictionary] = browser.scan_entries("starters")
|
||||
_expect(starter_entries.size() == 3, "New Scene gallery lists Blank, Town Street, and Living Room")
|
||||
_expect(starter_entries.size() == 4, "New Scene gallery lists Plain Background, Open Sky, Town Street, and Living Room")
|
||||
var original_name: String = String(_stage.get("_scene_name"))
|
||||
var original_world_count: int = (_stage.get_node("World") as Node2D).get_child_count()
|
||||
var original_sky: String = String(_stage.get("_sky_id"))
|
||||
@@ -107,7 +108,7 @@ func _run() -> void:
|
||||
selector = browser.get_selector()
|
||||
var starter_grid: GridContainer = selector.find_child("GridContainer", true, false) as GridContainer
|
||||
await _test_starter_card_previews(starter_grid)
|
||||
var town_card: AssetCard = starter_grid.get_child(1) as AssetCard if starter_grid != null and starter_grid.get_child_count() > 1 else null
|
||||
var town_card: AssetCard = _find_card_by_id(starter_grid, "starter_town_street")
|
||||
_expect(town_card != null, "Town Street is selectable as a real starter card")
|
||||
if town_card != null:
|
||||
await _activate_card(town_card)
|
||||
@@ -212,16 +213,16 @@ func _run() -> void:
|
||||
for preview_node: Node in card_content.get_children():
|
||||
if preview_node.get_script() == BACKGROUND_CARD_PREVIEW:
|
||||
background_preview_count += 1
|
||||
_expect(background_grid != null and background_grid.get_child_count() == 6 and background_preview_count == 6, "four Sky looks and both surface setup cards render production-style previews")
|
||||
_expect(background_grid != null and background_grid.get_child_count() == 7 and background_preview_count == 7, "Plain Background, four Sky looks, and both surface setup cards render production-style previews")
|
||||
var cloudy_status: Label = cloudy_card.find_child("StatusLabel", true, false) as Label if cloudy_card != null else null
|
||||
_expect(cloudy_card != null and cloudy_card.button_pressed and cloudy_status != null and cloudy_status.text == "Current Sky", "gallery marks the loaded Town Street Sky as Current Sky")
|
||||
_expect(cloudy_card != null and cloudy_card.button_pressed and cloudy_status != null and cloudy_status.text == "Current background", "gallery marks the loaded Town Street Sky as the current background")
|
||||
var clear_sky_card: AssetCard = _find_card_by_id(background_grid, "sky_clear_day")
|
||||
if clear_sky_card != null:
|
||||
await _activate_card(clear_sky_card)
|
||||
var selected_clear_card: AssetCard = _find_card_by_id(selector.find_child("GridContainer", true, false) as GridContainer, "sky_clear_day")
|
||||
var clear_status: Label = selected_clear_card.find_child("StatusLabel", true, false) as Label if selected_clear_card != null else null
|
||||
_expect(selector.visible and String(_stage.get("_sky_id")) == "sky_clear_day", "choosing a Sky updates the Stage and keeps the chooser open")
|
||||
_expect(selected_clear_card != null and selected_clear_card.button_pressed and clear_status != null and clear_status.text == "Current Sky", "Current Sky marker follows the newly chosen card")
|
||||
_expect(selected_clear_card != null and selected_clear_card.button_pressed and clear_status != null and clear_status.text == "Current background", "current background marker follows the newly chosen card")
|
||||
selector.call("_set_gallery_tab", "artwork")
|
||||
await process_frame
|
||||
var artwork_entries: Array[Dictionary] = browser.scan_entries("scenery")
|
||||
@@ -614,7 +615,7 @@ func _test_starter_card_previews(starter_grid: GridContainer) -> void:
|
||||
for card_node: Node in starter_grid.get_children():
|
||||
if not card_node.is_queued_for_deletion():
|
||||
live_card_count += 1
|
||||
_expect(live_card_count == 3, "starter chooser has three scene cards to preview")
|
||||
_expect(live_card_count == 4, "starter chooser has four scene cards to preview")
|
||||
var preview_count: int = 0
|
||||
var populated_scene_count: int = 0
|
||||
for card_node: Node in starter_grid.get_children():
|
||||
@@ -628,8 +629,8 @@ func _test_starter_card_previews(starter_grid: GridContainer) -> void:
|
||||
if int(preview.call("get_loaded_object_count")) > 0:
|
||||
populated_scene_count += 1
|
||||
var viewport: SubViewport = preview.get_child(0) as SubViewport if preview.get_child_count() > 0 else null
|
||||
_expect(viewport != null and preview.find_child("SkyView", true, false) != null, "starter preview has an isolated viewport and sky renderer")
|
||||
_expect(preview_count == 3, "all three starter cards use scene previews instead of placeholder tiles")
|
||||
_expect(viewport != null and preview.find_child("StageSkyView", true, false) != null, "starter preview has an isolated viewport and shared backdrop renderer")
|
||||
_expect(preview_count == 4, "all four starter cards use scene previews instead of placeholder tiles")
|
||||
_expect(populated_scene_count == 2, "Town Street and Living Room previews load their scene objects")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user