GBTestEnvironment

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Test environment for grid building tests

Source File: /addons/grid_building/test/scenes/env/gb_test_environment.gd

Extends: Node

Exported Properties

  • Property: injector : [GBInjectorSystem](./gb-injector-system/)
  • Property: grid_targeting_system : [GridTargetingSystem](./grid-targeting-system/)
  • Property: positioner : [GridPositioner2D](./grid-positioner2-d/)
  • Property: targeter : [TargetingShapeCast2D](./targeting-shape-cast2-d/)
  • Property: world : Node2D
  • Property: level : Node2D
  • Property: level_context : [GBLevelContext](./gb-level-context/)
  • Property: tile_map_layer : TileMapLayer
  • Property: objects_parent : Node2D
  • Property: placer : Node2D

Public Methods

get_issues

1
get_issues() -> Array[String]

get_container

1
get_container() -> GBCompositionContainer

isolate_tile_map_resources

1
isolate_tile_map_resources() -> void

Duplicates TileSet resources for TileMapLayers in this test scene. This prevents earlier suites that mutate tile_size/tile_shape from contaminating later collision-mapping tests through Godot’s shared resource cache.


get_isolated_container

1
get_isolated_container() -> GBCompositionContainer

Returns an isolated composition container for test use

WHY THIS IS NEEDED: When running large test suites (1500+ tests), collision rule settings were being shared across tests. One test would modify collision masks, rule parameters, or other settings, and subsequent tests would inherit those modifications, causing false collision reports and flaky test behavior.

HOW IT WORKS:

  1. Gets the existing composition container (with all its node connections intact)
  2. Extracts the GBSettings resource which contains collision rules and placement rules
  3. Creates a deep duplicate of ONLY the settings resource
  4. Replaces the settings in the existing container with the isolated copy
  5. Returns the same container, now with isolated settings

WHAT GETS ISOLATED:

  • Collision rules (collision masks, visual settings, etc.)
  • Placement rules (bounds checking, validation logic)
  • All GBSettings sub-resources

WHAT REMAINS SHARED (PRESERVED):

  • All scene node references (IndicatorManager, BuildingSystem, etc.)
  • Injection contexts and dependencies
  • System state and connections
  • Performance-critical shared resources

BENEFITS:

  • No test interference from shared collision rules
  • No expensive re-injection or system re-initialization
  • Maintains all existing node connections and contexts
  • Transparent to test code - works exactly like get_container()

WHEN TO USE:

  • Regression tests that validate collision detection
  • Tests that modify placement rules or collision settings
  • Any test experiencing flaky behavior in large test suites
  • Tests that need guaranteed isolation from other tests

get_logger

1
get_logger() -> GBLogger

get_tile_count

1
get_tile_count() -> int

Private Methods

_disable_human_mouse_input

1
_disable_human_mouse_input() -> void

Flags: private

Returns the number of tiles that actually exist on the tile map layer. Disable human mouse input on the positioner to prevent test flakiness. Call this after dependency injection is complete (e.g. via call_deferred).



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