feat(snap-points): add SnapPoints to all EG rooms (Reception, GiftShop, Restaurant, EmergencyRoom)
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
## Tests verifying SnapPoints exist in all EG (Erdgeschoss) room scenes.
|
||||
extends GutTest
|
||||
|
||||
|
||||
func _count_snaps(room: Node2D) -> int:
|
||||
var count: int = 0
|
||||
for child: Node in room.get_children():
|
||||
if child is SnapPoint:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
func _count_snaps_with_pose(room: Node2D, pose: String) -> int:
|
||||
var count: int = 0
|
||||
for child: Node in room.get_children():
|
||||
var snap: SnapPoint = child as SnapPoint
|
||||
if snap != null and snap.pose == pose:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
func test_reception_has_four_snap_points() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/Reception.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps(room), 4)
|
||||
|
||||
|
||||
func test_reception_all_snaps_are_sitting() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/Reception.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps_with_pose(room, "sitting"), 4)
|
||||
|
||||
|
||||
func test_giftshop_has_one_snap_point() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/GiftShop.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps(room), 1)
|
||||
|
||||
|
||||
func test_giftshop_snap_is_sitting() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/GiftShop.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps_with_pose(room, "sitting"), 1)
|
||||
|
||||
|
||||
func test_restaurant_has_six_snap_points() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/Restaurant.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps(room), 6)
|
||||
|
||||
|
||||
func test_restaurant_all_snaps_are_sitting() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/Restaurant.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps_with_pose(room, "sitting"), 6)
|
||||
|
||||
|
||||
func test_emergency_room_has_one_snap_point() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/EmergencyRoom.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps(room), 1)
|
||||
|
||||
|
||||
func test_emergency_room_snap_is_lying() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/EmergencyRoom.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps_with_pose(room, "lying"), 1)
|
||||
Reference in New Issue
Block a user