P08-03: 配置の通常操作受入
This commit is contained in:
@@ -1,5 +1,41 @@
|
||||
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() == 23 and palette.columns == 23,
|
||||
"palette has exactly 23 facility slots")
|
||||
expect(main.build_buttons.size() == 23, "all 23 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:
|
||||
@@ -8,6 +44,6 @@ func run() -> void:
|
||||
if directory.is_empty():
|
||||
directory = ProjectSettings.globalize_path("user://p08-placement-%d" % Time.get_ticks_usec())
|
||||
role = "standalone"
|
||||
var result: Dictionary = await Placement.new().run(self, directory, role)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user