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
| |
get_container
| |
isolate_tile_map_resources
| |
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
| |
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:
- Gets the existing composition container (with all its node connections intact)
- Extracts the GBSettings resource which contains collision rules and placement rules
- Creates a deep duplicate of ONLY the settings resource
- Replaces the settings in the existing container with the isolated copy
- 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
| |
get_tile_count
| |
Private Methods
_disable_human_mouse_input
| |
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