Randoloot/tests/previews/compact_interface_review.gd
2026-10-19 22:33:24 +02:00

70 lines
2.7 KiB
GDScript

extends Node
func settle() -> void:
for frame in 10: await get_tree().process_frame
func shot(name: String) -> void:
await settle()
await RenderingServer.frame_post_draw
get_viewport().get_texture().get_image().save_png("res://artifacts/compact_interface_%s.png" % name)
func check_panel(panel: PanelContainer) -> void:
var style = panel.get_theme_stylebox("panel")
if style is StyleBoxFlat: assert(style.bg_color.a <= 0.65)
var rect := panel.get_global_rect()
assert(rect.position.x >= 0 and rect.position.y >= 0)
assert(rect.end.x <= 1281 and rect.end.y <= 721)
func _ready() -> void:
GameState.start_new_run()
var captain: Resource = GameState.captain
captain.parts = 100
for mineral in preload("res://scripts/items/crafting_recipes.gd").MINERALS: captain.minerals[mineral] = 1000
var game := preload("res://scenes/game/game.tscn").instantiate()
add_child(game)
game.set_physics_process(false)
game.player.set_physics_process(false)
game.player.get_node("WeaponController").set_physics_process(false)
for enemy in get_tree().get_nodes_in_group("enemies"): enemy.set_physics_process(false)
var hud := game.get_node("HUD")
await settle()
assert(hud._system_title.get_theme_font_size("font_size") <= 11)
assert(hud._system_badge.size.x <= 90 and hud._system_badge.size.y <= 40)
check_panel(hud._system_badge)
check_panel(hud._captain_panel)
hud._toggle_sidebar()
hud._toggle_inventory()
await settle()
check_panel(hud._sidebar)
check_panel(hud.inventory_panel)
check_panel(hud.inventory_panel.get_node("Contents/ResourceSection"))
await shot("hud")
hud.close_inventory()
hud._toggle_sidebar()
captain.learning_points = 1
captain.prepare_skill_offers()
hud._captain_skills_ui.open_management()
await settle()
var skills: CanvasLayer = hud._captain_skills_ui
check_panel(skills._panel)
for label in skills._panel.find_children("*","Label",true,false):
assert(label.get_theme_font_size("font_size") <= 13)
await shot("skills")
skills._close()
game.get_node("PlanetExpeditions").open_freighter()
var screen: Control = game.get_node("PlanetExpeditions").screen
for section in ["hangar","workshop","storage","command","expansion_1","expansion_2","cabin_1"]:
screen._select_section(section)
await settle()
check_panel(screen._drawer)
assert(screen._drawer_title.get_theme_font_size("font_size") <= 13)
screen._select_section("workshop")
await shot("freighter")
screen._construct_room("expansion_2")
screen._select_section("expansion_2")
await shot("research")
screen.closed.emit()
game.free()
await get_tree().process_frame
print("COMPACT_INTERFACE_REVIEW_OK: small system badge, translucent HUD/inventory, captain skill cards, seven freighter sections and research")
get_tree().quit()