Files
Bullosseum/tests/screenshot_test.gd
T
richard 09d4a60f43 Reorganize into role-based folders and consolidate art
Move every script and scene into role-based directories (actors/, systems/, ui/,
levels/, props/) and all raw art under art/ (grouped by role, snake_case,
Extract-Textures GLBs), dropping Blender version-suffix noise. Filenames are
snake_case (PascalCase reserved for class_name) to avoid case-insensitive
filesystem aliasing on the web/macOS targets. Routes the bull's hits through the
typed DamageEvent pipeline and wires the bull's abilities to the Fx library.
Updates CLAUDE.md's folder-layout overview to match.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CCyaJPTHCH9EDthpf4A5Sj
2026-09-08 14:56:22 +03:00

49 lines
1.3 KiB
GDScript

extends SceneTree
## Headless screenshot test — captures a viewport frame after the scene loads.
## Run: godot --headless --script tests/screenshot_test.gd
##
## Outputs: tests/output/screenshot.png
## Exit code 0 = success, 1 = failure.
const OUTPUT_DIR := "res://tests/output"
const SETTLE_TIME := 2.0 # seconds to let physics/animations settle
func _init() -> void:
_run.call_deferred()
func _run() -> void:
# Ensure output directory exists
DirAccess.make_dir_recursive_absolute(OUTPUT_DIR)
# Load and switch to the main scene
var scene_res := load("res://levels/game_shell.tscn")
if scene_res == null:
push_error("screenshot_test: Failed to load scene.tscn")
quit(1)
return
var scene_instance: Node = scene_res.instantiate()
root.add_child(scene_instance)
# Wait for the scene to settle (physics, spawning, animations)
await create_timer(SETTLE_TIME).timeout
# Capture viewport
var img: Image = root.get_viewport().get_texture().get_image()
if img == null:
push_error("screenshot_test: Failed to capture viewport image")
quit(1)
return
var path := OUTPUT_DIR + "/screenshot.png"
var err := img.save_png(path)
if err != OK:
push_error("screenshot_test: Failed to save PNG (error %d)" % err)
quit(1)
return
print("screenshot_test: Saved %s (%dx%d)" % [path, img.get_width(), img.get_height()])
quit(0)