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

1
before() -> void

after

1
after() -> void

test_gather_collision_shapes_null_input

1
test_gather_collision_shapes_null_input() -> void

Test gather_collision_shapes with null input


test_gather_collision_shapes_empty_node

1
test_gather_collision_shapes_empty_node() -> void

Test gather_collision_shapes with empty node


test_gather_collision_shapes_parameterized

1
test_gather_collision_shapes_parameterized() -> void

Parameterized test for collision shape gathering across multiple test scenes


test_execute_indicator_setup_produces_zero_indicators_despite_collision_shapes

1
test_execute_indicator_setup_produces_zero_indicators_despite_collision_shapes() -> void

test_collision_mapping_works_but_indicator_creation_fails

1
test_collision_mapping_works_but_indicator_creation_fails() -> void

test_gather_collision_shapes_with_collision_object

1
test_gather_collision_shapes_with_collision_object() -> void

Test gather_collision_shapes with valid collision object


test_execute_indicator_setup_null_inputs

1
test_execute_indicator_setup_null_inputs() -> void

Test execute_indicator_setup with null inputs


test_node2d_preview_produces_zero_indicators

1
test_node2d_preview_produces_zero_indicators() -> void

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

1
test_execute_indicator_setup_basic_success() -> void

Parameterized test for complete indicator setup workflow


test_calculate_indicator_count_parameterized

1
test_calculate_indicator_count_parameterized() -> void

Test calculate_indicator_count with various test objects


test_validate_indicator_positions_correct_positioning

1
test_validate_indicator_positions_correct_positioning() -> void

Test validate_indicator_positions with properly positioned indicators


test_validate_indicator_positions_size_mismatch

1
test_validate_indicator_positions_size_mismatch() -> void

Test validate_indicator_positions with size mismatch


test_validate_indicator_positions_position_mismatch

1
test_validate_indicator_positions_position_mismatch() -> void

Test validate_indicator_positions with position mismatch


test_build_collision_test_setups_empty_input

1
test_build_collision_test_setups_empty_input() -> void

Test build_collision_test_setups with empty input


test_build_collision_test_setups_collision_object_owner

1
test_build_collision_test_setups_collision_object_owner() -> void

Test build_collision_test_setups with CollisionObject2D owner


test_build_collision_test_setups_collision_polygon_owner

1
test_build_collision_test_setups_collision_polygon_owner() -> void

Test build_collision_test_setups with CollisionPolygon2D owner


test_map_positions_to_rules_null_mapper

1
test_map_positions_to_rules_null_mapper() -> void

Test map_positions_to_rules with null collision mapper


test_validate_setup_preconditions_valid_inputs

1
test_validate_setup_preconditions_valid_inputs() -> void

Test validate_setup_preconditions with valid inputs


test_validate_setup_preconditions_null_test_object

1
test_validate_setup_preconditions_null_test_object() -> void

Test validate_setup_preconditions with null test object


test_validate_setup_preconditions_empty_rules

1
test_validate_setup_preconditions_empty_rules() -> void

Test validate_setup_preconditions with empty rules


test_validate_setup_preconditions_null_collision_mapper

1
test_validate_setup_preconditions_null_collision_mapper() -> void

Test validate_setup_preconditions with null collision mapper


test_execute_indicator_setup_attaches_rules_to_indicators

1
test_execute_indicator_setup_attaches_rules_to_indicators() -> void

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

1
test_execute_indicator_setup_mismatched_mask_produces_ruleless_indicators() -> void

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

1
test_collision_rule_validation_setup() -> void

Test collision rule creation and configuration - isolates integration test failures


test_multiple_rule_validation_setup

1
test_multiple_rule_validation_setup() -> void

Test rule validation with multiple rules - isolates multi-rule scenarios


Private Methods

_create_test_object_with_shapes

1
_create_test_object_with_shapes() -> Node2D

Flags: private

Helper method to create a test object with collision shapes


_create_tile_check_rules

1
_create_tile_check_rules() -> Array[TileCheckRule]

Flags: private

Helper method to create tile check rules for testing


_create_indicator_parent

1
_create_indicator_parent(p_name: String = "IndicatorParent") -> Node2D

Flags: private

Helper method to create a Node2D parent for indicators with proper setup


_create_simple_collision_object

1
2
3
4
_create_simple_collision_object(
    position: Vector2 = TEST_POSITION_CENTER,
    size: Vector2 = TEST_RECT_SIZE_SMALL
) -> StaticBody2D

Flags: private

Helper method to create a simple test object with rectangular collision shape


_create_collision_rule

1
_create_collision_rule(mask: int = COLLISION_MASK_SINGLE) -> TileCheckRule

Flags: private

Helper method to create a basic tile check rule with specified mask


_create_mixed_collision_rules

1
_create_mixed_collision_rules() -> Array[TileCheckRule]

Flags: private

Helper method to create collision rules matching integration test patterns


_load_test_scene

1
2
3
4
_load_test_scene(
    scene_path: String,
    position: Vector2 = TEST_POSITION_CENTER
) -> Node2D

Flags: private

Helper method to load and instantiate a test scene


_validate_collision_mapping

1
2
3
4
_validate_collision_mapping(
    test_objects: Array[Node2D],
    mask: int = COLLISION_MASK_SINGLE
) -> int

Flags: private

Helper method to validate collision mapping works for test objects


_run_indicator_setup

1
2
3
4
5
_run_indicator_setup(
    test_object: Node2D,
    rules: Array[TileCheckRule],
    expected_success: bool = true
) -> IndicatorSetupUtils.SetupResult

Flags: private

Helper method to run indicator setup and validate basic success



Grid Building v5.0.8 | Generated 24/05/2026