Add headless regression tests for Phase 4b features
- Implement test for popup anchor behavior in rule-builder menus to ensure consistent anchor positioning during menu transitions. - Create tests for stage logic, including mode transitions, toolbar visibility, and status bar updates. - Add terrain drag-painting tests to verify correct block placement behavior and conflict handling. - Introduce walk waypoint tests to check for arrival conditions and position stability after navigation.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
class_name PropLibrary
|
||||
extends RefCounted
|
||||
|
||||
const PROP_UTILS := preload("res://scripts/prop_utils.gd")
|
||||
const PROP_BLOCK := preload("res://scripts/prop_block.gd")
|
||||
|
||||
static var _templates: Array[Dictionary] = []
|
||||
|
||||
|
||||
static func get_entries() -> Array[Dictionary]:
|
||||
if _templates.is_empty():
|
||||
_build_templates()
|
||||
return _templates
|
||||
|
||||
|
||||
static func get_ids() -> Array[String]:
|
||||
var ids: Array[String] = []
|
||||
for t: Dictionary in get_entries():
|
||||
ids.append(String(t["id"]))
|
||||
return ids
|
||||
|
||||
|
||||
static func get_entry(id: String) -> Dictionary:
|
||||
for t: Dictionary in get_entries():
|
||||
if String(t["id"]) == id:
|
||||
return t
|
||||
return {}
|
||||
|
||||
|
||||
static func get_default_id() -> String:
|
||||
return "crate"
|
||||
|
||||
|
||||
static func _build_templates() -> void:
|
||||
_templates = [
|
||||
_make("crate", "Crate", PROP_BLOCK.MaterialPreset.WOOD, "Wood", PROP_UTILS.create_box()),
|
||||
_make("ball", "Ball", PROP_BLOCK.MaterialPreset.RUBBER, "Rubber", PROP_UTILS.create_ball()),
|
||||
_make("plank", "Plank", PROP_BLOCK.MaterialPreset.METAL, "Metal", PROP_UTILS.create_plank()),
|
||||
_make("triangle", "Triangle", PROP_BLOCK.MaterialPreset.CARDBOARD, "Cardboard", PROP_UTILS.create_triangle()),
|
||||
]
|
||||
|
||||
|
||||
static func _make(id: String, name: String, preset: int, label: String, payload: Dictionary) -> Dictionary:
|
||||
return {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"material_preset": preset,
|
||||
"material_label": label,
|
||||
"payload": payload,
|
||||
}
|
||||
Reference in New Issue
Block a user