Add new test file for phase 19 scenery with unique identifier
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
extends SceneTree
|
||||
|
||||
const SANDBOX_STAGE: PackedScene = preload("res://scenes/stage/sandbox_stage.tscn")
|
||||
const STAGE_SCENERY_ARTWORK: Script = preload("res://scripts/stage/scenery/stage_scenery_artwork.gd")
|
||||
const CAPTURE_PATH: String = "res://tests/phase19_selected_artwork_depth_inspector.png"
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
call_deferred("_capture")
|
||||
|
||||
|
||||
func _capture() -> void:
|
||||
root.size = Vector2i(1280, 720)
|
||||
var stage: SandboxStage = SANDBOX_STAGE.instantiate() as SandboxStage
|
||||
root.add_child(stage)
|
||||
await _wait_for_render_frames(3)
|
||||
var artwork: StageSceneryArtwork = STAGE_SCENERY_ARTWORK.new() as StageSceneryArtwork
|
||||
artwork.display_name = "Round Tree"
|
||||
artwork.set_depth(&"near")
|
||||
if not artwork.load_visual("res://content/props/art_tree-v2.prop"):
|
||||
push_error("Depth inspector visual capture could not load the tree artwork.")
|
||||
artwork.free()
|
||||
stage.queue_free()
|
||||
quit(1)
|
||||
return
|
||||
artwork.position = Vector2(-300.0, -120.0)
|
||||
(stage.get_node("World") as Node2D).add_child(artwork)
|
||||
var camera: Camera2D = stage.get_node("Camera2D") as Camera2D
|
||||
camera.position = Vector2.ZERO
|
||||
camera.zoom = Vector2(0.85, 0.85)
|
||||
stage.call("_on_grid_toggled", false)
|
||||
stage.call("_enter_scenery_edit_mode")
|
||||
(stage.get("_selection") as StageSelection).select_only(artwork)
|
||||
stage.call("_refresh_scenery_inspector")
|
||||
await _wait_for_render_frames(6)
|
||||
var inspector: StageInspectorPanel = stage.get("_scenery_inspector") as StageInspectorPanel
|
||||
var section: Control = stage.get("_scenery_depth_section") as Control
|
||||
if inspector == null or not inspector.visible or section == null or not section.visible:
|
||||
push_error("Depth inspector visual capture did not show its selected-artwork section.")
|
||||
stage.queue_free()
|
||||
quit(1)
|
||||
return
|
||||
var capture: Image = root.get_texture().get_image()
|
||||
var error: Error = capture.save_png(ProjectSettings.globalize_path(CAPTURE_PATH))
|
||||
print("VISUAL selected artwork depth inspector path=%s size=%s save_error=%s" % [CAPTURE_PATH, str(capture.get_size()), str(error)])
|
||||
stage.queue_free()
|
||||
await process_frame
|
||||
quit(0 if error == OK else 1)
|
||||
|
||||
|
||||
func _wait_for_render_frames(count: int) -> void:
|
||||
for _frame: int in count:
|
||||
await process_frame
|
||||
await RenderingServer.frame_post_draw
|
||||
Reference in New Issue
Block a user