GodotTestFactory

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Factory for creating Godot base class objects in tests. Provides convenient methods for common Godot objects used in testing. Keep this separate from UnifiedTestFactory to maintain clean separation.

Source File: /addons/grid_building/test/factories/godot_test_factory.gd

Extends: RefCounted

Public Methods

create_capsule_shape

1
2
3
4
create_capsule_shape(
    radius: float = 48.0,
    height: float = 128.0
) -> CapsuleShape2D

Flags: static

Creates a CapsuleShape2D with specified radius and height


create_circle_shape

1
create_circle_shape(radius: float = 16.0) -> CircleShape2D

Flags: static

Creates a CircleShape2D with specified radius


create_transform2d

1
create_transform2d(origin: Vector2 = Vector2.ZERO) -> Transform2D

Flags: static

Creates a Transform2D at the given origin (default Vector2.ZERO)


create_tile_size

1
create_tile_size(size: int = 16) -> Vector2

Flags: static

Creates standard tile size Vector2 (16, 16) commonly used in tests


create_node2d

1
2
3
4
create_node2d(
    test: GdUnitTestSuite,
    p_name : String = "TestNode2D"
) -> Node2D

Flags: static

Creates a basic Node2D for testing with proper auto_free setup


create_node

1
create_node(test: GdUnitTestSuite) -> Node

Flags: static

Creates a Node with auto_free setup


create_canvas_item

1
create_canvas_item(test: GdUnitTestSuite) -> CanvasItem

Flags: static

Creates a CanvasItem with auto_free setup


create_tile_map_layer

1
2
3
4
create_tile_map_layer(
    test: GdUnitTestSuite,
    grid_size: int = 40
) -> TileMapLayer

Flags: static

Creates a TileMapLayer with basic tile set and populated grid for testing. grid_size: overall width/height in tiles (square). Reduced default for faster unit tests. Tiles are created starting from the top-left corner (0,0) and fill down and to the right, so all used tiles are in the bottom right grid quadrant, covering (0,0) to (grid_size-1, grid_size-1).


create_isometric_tile_map_layer

1
2
3
4
create_isometric_tile_map_layer(
    test: GdUnitTestSuite,
    grid_size: int = 40
) -> TileMapLayer

Flags: static

Creates an isometric TileMapLayer for isometric tile-based games


create_top_down_tile_map_layer

1
2
3
4
create_top_down_tile_map_layer(
    test: GdUnitTestSuite,
    grid_size: int = 40
) -> TileMapLayer

Flags: static

Creates a top-down TileMapLayer for top-down perspective games


create_platformer_tile_map_layer

1
2
3
4
create_platformer_tile_map_layer(
    test: GdUnitTestSuite,
    grid_size: int = 40
) -> TileMapLayer

Flags: static

Creates a platformer TileMapLayer for side-scrolling platformer games


create_empty_tile_map_layer

1
create_empty_tile_map_layer(test: GdUnitTestSuite) -> TileMapLayer

Flags: static

Creates an empty TileMapLayer with tile set but no cells


create_area2d_with_circle_shape

1
2
3
4
create_area2d_with_circle_shape(
    test: GdUnitTestSuite,
    radius: float = 16.0
) -> Area2D

Flags: static

Creates an Area2D with circular collision shape


create_object_with_circle_shape

1
create_object_with_circle_shape(test: GdUnitTestSuite) -> Node2D

Flags: static

Creates a Node2D with a child StaticBody2D that has a circle collision shape


create_parent_with_body_and_polygon

1
create_parent_with_body_and_polygon(test: GdUnitTestSuite) -> Node2D

Flags: static

Creates a parent Node2D with both StaticBody2D and CollisionPolygon2D children


Private Methods

_validate_collision_parent

1
2
3
4
_validate_collision_parent(
    collision_node: Node,
    method_name: String
) -> void

Flags: static, private

Validates that a collision shape has a proper CollisionObject2D parent @param collision_node: The CollisionShape2D or CollisionPolygon2D to validate @param method_name: Name of the calling method for error messages


_ensure_collision_parent

1
2
3
4
5
6
_ensure_collision_parent(
    collision_node: Node,
    parent: CollisionObject2D,
    test: GdUnitTestSuite,
    method_name: String
) -> void

Flags: static, private

Ensures a collision shape is properly parented to a CollisionObject2D @param collision_node: The CollisionShape2D or CollisionPolygon2D to parent @param parent: The CollisionObject2D to parent to @param test: Test suite for auto_free management @param method_name: Name of the calling method for error messages



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