# Tests walkable collider ancestry for res://scripts/ground_pick.gd. # Full ray / viewport pick flow stays manual (see README). extends GdUnitTestSuite const GroundPickScript := preload("res://scripts/ground_pick.gd") func test_collider_is_walkable_true_when_ancestor_in_walkable_group() -> void: var gp := Node3D.new() gp.set_script(GroundPickScript) auto_free(gp) add_child(gp) var floor_root := StaticBody3D.new() floor_root.add_to_group("walkable") var mesh_child := MeshInstance3D.new() floor_root.add_child(mesh_child) gp.add_child(floor_root) var walkable := bool(gp.call("_collider_is_walkable", mesh_child)) assert_that(walkable).is_true() func test_collider_is_walkable_false_without_walkable_group() -> void: var gp := Node3D.new() gp.set_script(GroundPickScript) auto_free(gp) add_child(gp) var body := StaticBody3D.new() gp.add_child(body) var ok := bool(gp.call("_collider_is_walkable", body)) assert_that(ok).is_false() func test_collider_is_occluder_true_when_ancestor_in_occluder_group() -> void: var gp := Node3D.new() gp.set_script(GroundPickScript) auto_free(gp) add_child(gp) var obstacle := StaticBody3D.new() obstacle.add_to_group("occluder") var mesh_child := MeshInstance3D.new() obstacle.add_child(mesh_child) gp.add_child(obstacle) var is_occluder := bool(gp.call("_collider_is_occluder", mesh_child)) assert_that(is_occluder).is_true() func test_collider_is_occluder_false_without_occluder_group() -> void: var gp := Node3D.new() gp.set_script(GroundPickScript) auto_free(gp) add_child(gp) var body := StaticBody3D.new() gp.add_child(body) var is_occluder := bool(gp.call("_collider_is_occluder", body)) assert_that(is_occluder).is_false() func test_collider_is_occluder_false_for_walkable_only_ancestor() -> void: var gp := Node3D.new() gp.set_script(GroundPickScript) auto_free(gp) add_child(gp) var floor_root := StaticBody3D.new() floor_root.add_to_group("walkable") var mesh_child := MeshInstance3D.new() floor_root.add_child(mesh_child) gp.add_child(floor_root) var is_occluder := bool(gp.call("_collider_is_occluder", mesh_child)) assert_that(is_occluder).is_false()