-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_interact_box.gd
32 lines (22 loc) · 1.04 KB
/
test_interact_box.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
extends GutTest
const InteractBox := preload("res://player/interact_box.gd")
const DEACTIVATED_COLLISION_LAYER_BIT := 0
func test_deactivating_disables_collision():
var interact_box: InteractBox = add_child_autofree(InteractBox.new())
interact_box.is_active = false
assert_eq(interact_box.collision_layer, DEACTIVATED_COLLISION_LAYER_BIT)
func test_activating_enables_collision():
var interact_box: InteractBox = add_child_autofree(InteractBox.new())
interact_box.is_active = false
interact_box.is_active = true
assert_eq(interact_box.collision_layer, interact_box.get_active_collision_layer_bit())
func test_is_active_is_respected_on_ready():
var interact_box: InteractBox = InteractBox.new()
interact_box.is_active = false
add_child_autofree(interact_box)
assert_eq(interact_box.collision_layer, DEACTIVATED_COLLISION_LAYER_BIT)
func test_one_shot_deactivates_after_use():
var interact_box: InteractBox = add_child_autofree(InteractBox.new())
interact_box.one_shot = true
interact_box.on_interacted_with()
assert_false(interact_box.is_active)