Files
TheTree_mock/tests/ui/test_layer_skin.gd
T
Takeshi 5dde0c5ec2 Record original-alignment implementation and traceability checkpoint
Capture current source, content data, tests, asset licenses, and original-specification traceability. Original implementation remains incomplete. The accepted matching UI generation passed 154 suites and 12,253 checks, with eight rendered staff-contract screens reviewed. Latest native Windows and full-original acceptance remain outstanding.
2026-09-30 23:52:24 +09:00

71 lines
4.4 KiB
GDScript

extends SceneTree
var checks := 0
var failures := 0
func _initialize() -> void: call_deferred("run")
func expect(ok: bool, message: String) -> void:
checks += 1
if not ok: failures += 1;push_error(message)
func run() -> void:
var runtime: Variant=root.get_node("SimulationRuntime")
var clock: Variant=root.get_node("GameClock")
var state: Variant=root.get_node("GameState")
clock.reset(1,6,0);state.reset();runtime.initialize(clock,state,42511);clock.set_paused(true)
root.size=Vector2i(1440,810)
var main: Control=load("res://scenes/main/main.tscn").instantiate()
root.add_child(main)
main.call("_set_management_panel_open",true)
await process_frame;await process_frame
var side: PanelContainer=main.find_child("SidePanel",true,false)
var guide: PanelContainer = main.opening_guide
var guide_front: Color = guide.get_theme_stylebox("panel").bg_color
var guide_progress: Dictionary = guide.get_progress()
var front: Color=side.get_theme_stylebox("panel").bg_color
var detail: Label=main.get("selected_detail_label")
var front_text:=detail.get_theme_color("font_color")
var position: Vector2=main.world_preview.cell_to_canvas(Vector3i.ZERO)
await capture("front")
main.back_button.pressed.emit()
await process_frame;await process_frame
expect(state.active_layer==1 and main.world_preview.layer_mode==1,"normal back button switches layer")
expect(side.get_theme_stylebox("panel").bg_color==Color("202e34") and detail.get_theme_color("font_color")==Color("d8eeea"),"back panel and text adopt monitor palette")
var bottom: Control=main.find_child("BottomBar",true,false)
expect(bottom.position.y+bottom.size.y<=main.size.y+1,"back skin preserves toolbar bounds")
expect(main.world_preview.cell_to_canvas(Vector3i(0,0,1))==position,"skin does not change map coordinate mapping")
main.world_preview._process(1.0)
expect(guide.get_theme_stylebox("panel").bg_color == Color("172229"), "opening guide follows BACK skin")
expect(guide.get_progress() == guide_progress, "skin does not change opening instructions or action")
var expanded_height := guide.size.y
guide.get("_heading").pressed.emit()
await process_frame;await process_frame
expect(not guide.get("_body").visible and guide.size.y < expanded_height, "paused guide collapses immediately")
guide.get("_heading").pressed.emit()
await process_frame;await process_frame
expect(guide.get("_body").visible and guide.get("_action").visible, "guide reopens with normal action")
await capture("back")
for i in 4:
main.front_button.pressed.emit();main.back_button.pressed.emit()
main.front_button.pressed.emit()
await process_frame;await process_frame
expect(side.get_theme_stylebox("panel").bg_color==front and detail.get_theme_color("font_color")==front_text,"repeated toggles restore exact front palette")
expect(guide.get_theme_stylebox("panel").bg_color == guide_front, "guide restores FRONT skin")
expect(clock.paused and clock.absolute_minute==360,"skin changes never advance simulation")
main.queue_free();await process_frame
state.active_layer=1
main=load("res://scenes/main/main.tscn").instantiate()
root.add_child(main)
await process_frame;await process_frame
side=main.find_child("SidePanel",true,false)
bottom=main.find_child("BottomBar",true,false)
expect(side.get_theme_stylebox("panel").bg_color==Color("202e34") and main.opening_guide.get_theme_stylebox("panel").bg_color == Color("172229"),"new screen honors existing BACK selection including guide")
expect(bottom.position.y+bottom.size.y<=main.size.y+1,"BACK startup preserves toolbar bounds")
expect(main.rank_dialog.get_label().get_theme_color("font_color") == Color("d8eeea") and main.rank_dialog.theme.get_stylebox("panel", "AcceptDialog").bg_color == Color("202e34"), "rank dialog initializes in saved BACK skin")
expect(main.operating_ledger_panel.get("_cash_label").get_theme_color("font_color") == Color("d8eeea"), "ledger initialized before scene attachment honors saved BACK layer")
main.front_button.pressed.emit()
expect(side.get_theme_stylebox("panel").bg_color==front,"BACK startup still restores FRONT palette")
main.queue_free();await process_frame
print("Layer skin: %d checks, %d failures" % [checks,failures]);quit(failures)
func capture(label: String) -> void:
if DisplayServer.get_name()=="headless":return
await process_frame;await RenderingServer.frame_post_draw
expect(root.get_texture().get_image().save_png(ProjectSettings.globalize_path("res://artifacts/facility-dimensions-2026-09-29/guide-skin-%s.png" % label))==OK,"capture "+label)