indicator_setup_utils_unit_test
AUTO-GENERATED FILE – DO NOT EDIT MANUALLY
IndicatorSetupUtils Unit Tests
Source File: /addons/grid_building/test/rules/indicators/indicator_setup_utils_unit_test.gd
Extends: GdUnitTestSuite
Properties
- Property:
runner: GdUnitSceneRunner - Property:
env: [CollisionTestEnvironment](./collision-test-environment/)
Private Properties
- Property:
_targeting_state: [GridTargetingState](./grid-targeting-state/)(private) - Property:
_indicator_template: PackedScene(private) - Property:
_test_rule: [TileCheckRule](./tile-check-rule/)(private)
Constants
- Constant:
DEFAULT_TILE_SIZE := Vector2i(16, 16)- Test constants for magic number elimination - Constant:
TEST_POSITION_CENTER := Vector2(64, 64) - Constant:
TEST_RECT_SIZE_SMALL := Vector2(32, 32) - Constant:
TEST_RECT_SIZE_LARGE := Vector2(64, 64) - Constant:
COLLISION_LAYER_DEFAULT := 1 - Constant:
COLLISION_MASK_SINGLE := 1 - Constant:
COLLISION_MASK_MIXED := 2560 | 513 - Constant:
TILE_POS_ORIGIN := Vector2i(0, 0)- Test position constants for indicator validation - Constant:
TILE_POS_RIGHT := Vector2i(1, 0) - Constant:
TILE_POS_DOWN := Vector2i(0, 1) - Constant:
TILE_POS_WRONG := Vector2i(5, 5) - Constant:
TEST_SCENE_DATA = [- Test data for parameterized tests
Public Methods
before
| |
after
| |
test_gather_collision_shapes_null_input
| |
Test gather_collision_shapes with null input
test_gather_collision_shapes_empty_node
| |
Test gather_collision_shapes with empty node
test_gather_collision_shapes_parameterized
| |
Parameterized test for collision shape gathering across multiple test scenes
test_execute_indicator_setup_produces_zero_indicators_despite_collision_shapes
| |
test_collision_mapping_works_but_indicator_creation_fails
| |
test_gather_collision_shapes_with_collision_object
| |
Test gather_collision_shapes with valid collision object
test_execute_indicator_setup_null_inputs
| |
Test execute_indicator_setup with null inputs
test_node2d_preview_produces_zero_indicators
| |
CONTRACT TEST: Node2D preview with no collision shapes produces zero indicators. This locks in the “nothing to test = pass by design” behavior.
test_execute_indicator_setup_basic_success
| |
Parameterized test for complete indicator setup workflow
test_calculate_indicator_count_parameterized
| |
Test calculate_indicator_count with various test objects
test_validate_indicator_positions_correct_positioning
| |
Test validate_indicator_positions with properly positioned indicators
test_validate_indicator_positions_size_mismatch
| |
Test validate_indicator_positions with size mismatch
test_validate_indicator_positions_position_mismatch
| |
Test validate_indicator_positions with position mismatch
test_build_collision_test_setups_empty_input
| |
Test build_collision_test_setups with empty input
test_build_collision_test_setups_collision_object_owner
| |
Test build_collision_test_setups with CollisionObject2D owner
test_build_collision_test_setups_collision_polygon_owner
| |
Test build_collision_test_setups with CollisionPolygon2D owner
test_map_positions_to_rules_null_mapper
| |
Test map_positions_to_rules with null collision mapper
test_validate_setup_preconditions_valid_inputs
| |
Test validate_setup_preconditions with valid inputs
test_validate_setup_preconditions_null_test_object
| |
Test validate_setup_preconditions with null test object
test_validate_setup_preconditions_empty_rules
| |
Test validate_setup_preconditions with empty rules
test_validate_setup_preconditions_null_collision_mapper
| |
Test validate_setup_preconditions with null collision mapper
test_execute_indicator_setup_attaches_rules_to_indicators
| |
CONTRACT TEST: execute_indicator_setup must attach rules to generated indicators. This catches the bug where indicators are visible but green because rules were lost during mapping or generation (e.g., layer mask mismatch, stale mapper state).
test_execute_indicator_setup_mismatched_mask_produces_ruleless_indicators
| |
CONTRACT TEST: execute_indicator_setup with mismatched layer mask produces indicators with ZERO rules. This documents the “green indicator” behavior when a rule’s apply_to_objects_mask doesn’t match the preview’s collision_layer.
test_collision_rule_validation_setup
| |
Test collision rule creation and configuration - isolates integration test failures
test_multiple_rule_validation_setup
| |
Test rule validation with multiple rules - isolates multi-rule scenarios
Private Methods
_create_test_object_with_shapes
| |
Flags: private
Helper method to create a test object with collision shapes
_create_tile_check_rules
| |
Flags: private
Helper method to create tile check rules for testing
_create_indicator_parent
| |
Flags: private
Helper method to create a Node2D parent for indicators with proper setup
_create_simple_collision_object
| |
Flags: private
Helper method to create a simple test object with rectangular collision shape
_create_collision_rule
| |
Flags: private
Helper method to create a basic tile check rule with specified mask
_create_mixed_collision_rules
| |
Flags: private
Helper method to create collision rules matching integration test patterns
_load_test_scene
| |
Flags: private
Helper method to load and instantiate a test scene
_validate_collision_mapping
| |
Flags: private
Helper method to validate collision mapping works for test objects
_run_indicator_setup
| |
Flags: private
Helper method to run indicator setup and validate basic success
Grid Building v5.0.8 | Generated 24/05/2026