Add tests for scenery surface caching and preview behavior
- Introduced `test_scenery_brick_preview.gd` to validate focused placement and CPU draw-cost for large brick walls. - Added `test_scenery_surface_cache.gd` to assess texture budget, visual equivalence, and cache invalidation. - Created `test_scenery_surface_preview.gd` to evaluate adaptive preview selection and placement behavior. - Implemented various helper functions to measure drawing performance and validate expected behaviors during tests. - Added unique identifiers for new test files to ensure proper tracking and management.
This commit is contained in:
+623
-125
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,15 @@ var _group: ButtonGroup = ButtonGroup.new()
|
||||
var _buttons: Array[Button] = []
|
||||
var _stage_theme: SandboxTheme
|
||||
var _colors: Array[Color] = []
|
||||
var _swatch_size_override: float = -1.0
|
||||
var _swatch_gap_override: int = -1
|
||||
|
||||
|
||||
func set_swatch_layout_override(size: float, gap: int) -> void:
|
||||
_swatch_size_override = size
|
||||
_swatch_gap_override = gap
|
||||
if is_inside_tree() and not _colors.is_empty():
|
||||
configure(_colors, _selected, _stage_theme)
|
||||
|
||||
|
||||
func configure(colors: Array[Color], selected: Color, theme: Variant = null) -> void:
|
||||
@@ -25,8 +34,9 @@ func configure(colors: Array[Color], selected: Color, theme: Variant = null) ->
|
||||
for child: Node in get_children():
|
||||
remove_child(child)
|
||||
child.queue_free()
|
||||
add_theme_constant_override("h_separation", _integer("stage_surface_colors.swatch_gap", 8))
|
||||
add_theme_constant_override("v_separation", _integer("stage_surface_colors.swatch_gap", 8))
|
||||
var gap: int = _swatch_gap_override if _swatch_gap_override >= 0 else _integer("stage_surface_colors.swatch_gap", 8)
|
||||
add_theme_constant_override("h_separation", gap)
|
||||
add_theme_constant_override("v_separation", gap)
|
||||
var seen: Dictionary = {}
|
||||
for color: Color in _colors:
|
||||
var color_key: String = color.to_html(true).to_upper()
|
||||
@@ -34,7 +44,7 @@ func configure(colors: Array[Color], selected: Color, theme: Variant = null) ->
|
||||
continue
|
||||
seen[color_key] = true
|
||||
var button := Button.new()
|
||||
var swatch_size: float = float(_integer("stage_surface_colors.swatch_size", 48))
|
||||
var swatch_size: float = _swatch_size_override if _swatch_size_override > 0.0 else float(_integer("stage_surface_colors.swatch_size", 48))
|
||||
button.custom_minimum_size = Vector2(swatch_size, swatch_size)
|
||||
button.toggle_mode = true
|
||||
button.button_group = _group
|
||||
|
||||
Reference in New Issue
Block a user