rule_check_indicator_test
AUTO-GENERATED FILE – DO NOT EDIT MANUALLY
Test suite for RuleCheckIndicator class. Tests comprehensive rule-based placement validation including:
- Indicator validity state changes based on collision rules
- Visual settings updates (texture, modulate) on validity changes
- Signal emission when validity state changes
- Rule addition/removal after indicator initialization
- Force validation updates and per-frame evaluation
- Collision detection and contact point calculations
- Integration with GridTargetingState and collision systems
- Debug logging and environment variable configuration
- Tile position calculations and visual sprite management Tests ensure proper integration between rules, collision detection, and visual feedback.
Source File: /addons/grid_building/test/rules/indicators/rule_check_indicator_test.gd
Extends: GdUnitTestSuite
Properties
- Property:
indicator: [RuleCheckIndicator](./rule-check-indicator/) - Property:
test_layers: int = 1 # Bitmask - Property:
offset_logo: PackedScene = GBTestConstants.SCENE_RECT_15_TILES- Logo offset away from the center for testing - using Godot icon as test texture - Property:
runner: GdUnitSceneRunner
Private Properties
- Property:
_env: [AllSystemsTestEnvironment](./all-systems-test-environment/)(private) - Environment and container for tests - Property:
_container: [GBCompositionContainer](./gb-composition-container/)(private)
Public Methods
diag
| |
indicator_state_diag
| |
Flags: static
Build a full indicator state diagnostic via RuleCheckIndicatorLogic helper
create_rule_targeting_state
| |
Helper method to get properly initialized GridTargetingState from environment
before
| |
before_test
| |
after_test
| |
after
| |
test_setup_indicator_defaults
| |
test_indicator_validity_switches_on_dynamic_collision
| |
Integration test: indicator switches valid → fail → valid as collision body is added/removed
test_validity_sprite_texture_switches_on_validity_change
| |
Test: validity_sprite texture changes when indicator validity changes
test_indicator_starts_valid_with_no_rules
| |
Test that indicators start in valid state when no rules are present
test_valid_changed_signal_emitted_on_state_change
| |
Test that the valid_changed signal is emitted when validity state changes
test_visual_settings_update_on_validity_change
| |
Test that visual settings are properly updated when validity changes
test_force_validation_update
| |
Test that force_validation_update properly updates the indicator state
test_rules_added_after_ready
| |
Test that indicators properly handle rules being added after _ready
test_rules_removed
| |
Test that indicators properly handle rules being removed
test_ready_debug_log_format_no_rules
| |
Test improved debug log format when no rules present at _ready
test_per_frame_validation_env_flag
| |
Test per-frame evaluation toggled by environment variable
test_instance_collisions
| |
Count the number of collisions when instancing a p_test_scene at the origin 0,0 and seeing if it matches the expected number
test__update_visuals
| |
test_get_tile_position_default
| |
Test the default return of get_tile_positon
create_test_body
| |
Creates a test collision body for testing rule validation
IMPORTANT POSITIONING NOTES:
- The collision body is created at position (0, 0) by default
- Tests MUST position the collision body to overlap with the indicator
- Tests call: collision_body.global_position = indicator.global_position
- This ensures the collision body and indicator are in the same location
- Without proper positioning, collision detection will fail and tests will pass incorrectly
Example usage in tests: Example (GDScript): var collision_body = create_test_body() add_child(collision_body) collision_body.global_position = indicator.global_position # CRITICAL: Position for collision
find_first_physics_body
| |
Helper: find the first PhysicsBody2D inside a scene root (or root itself)
Private Methods
_create_minimal_indicator
| |
Flags: private
Creates a minimal RuleCheckIndicator with shape and dependencies resolved.
Grid Building v5.0.8 | Generated 24/05/2026