extends SceneTree const Placement := preload("res://tests/fixtures/p08-03/placement.gd") class PalettePlacement extends Placement: func setup() -> void: super.setup() await frames() var palette := main.find_child("BuildPalette", true, false) as GridContainer expect(palette != null, "production facility palette exists") if palette == null: return expect(palette.get_child_count() == 25 and palette.columns == 25, "palette has exactly 25 facility slots (A07/A08 warps added)") expect(main.build_buttons.size() == 25, "all 25 registered facility buttons exist") for child: Node in palette.get_children(): expect(child is Button and main.build_buttons.values().has(child), "every palette child is a registered facility button") for id: StringName in main.MVP_FACILITY_IDS: expect(main.build_buttons.has(id) and main.build_buttons[id].get_parent() == palette, "each facility remains inside the facility palette") var row := palette.get_parent() expect(row is HBoxContainer and row.get_parent() == main.palette_scroll and main.palette_scroll.get_child_count() == 1, "one HBox is the normal palette scroll content") var demolition: Button = main.demolition_button expect(demolition != null and demolition.get_parent() == row and demolition.name == "DemolitionButton" and row.get_child_count() == 2, "normal demolition entry is a sibling of the facility palette") if demolition == null: return await button(main.palette_toggle_button) expect(main.palette_scroll.visible and demolition.is_visible_in_tree() and not demolition.disabled and demolition.toggle_mode, "opening the normal palette exposes the available demolition entry") await reveal(demolition) expect(demolition.get_global_rect().intersects(main.palette_scroll.get_global_rect()), "demolition entry is reachable through normal palette scrolling") await button(main.palette_toggle_button) func _initialize() -> void: call_deferred("run") func run() -> void: var directory := OS.get_environment("P08_PLACEMENT_ROOT") var role := OS.get_environment("P08_PLACEMENT_ROLE") if directory.is_empty(): directory = ProjectSettings.globalize_path("user://p08-placement-%d" % Time.get_ticks_usec()) role = "standalone" var result: Dictionary = await PalettePlacement.new().run(self, directory, role) print("P08 normal placement: %d checks, %d failures" % [result.checks, result.failures]) quit(0 if result.failures == 0 else 1)