forked from watplugin/wat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
yield.test.gd
28 lines (23 loc) · 1.09 KB
/
yield.test.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
extends WAT.Test
# Developers may also use the code below in any of the start/pre/post/end..
# ..methods if necessary.
func test_yield_until_timeout() -> void:
# Developers can yield for a time limit by calling yield with the..
# ..until_timeout function that takes the time limit and waits for the..
# ..returned yielder object to emit the built-in YIELD signal.
yield(until_timeout(0.2), YIELD)
asserts.auto_pass("Yielding On Timeout")
# warning-ignore:unused_signal
signal my_signal
func test_yield_until_signal() -> void:
watch(self, "my_signal")
call_deferred("emit_signal", "my_signal")
# Developers can yield on a custom signal by passing in the..
# ..emitter object, the string signal of the emitter object and..
# ..a float time limit and waits for the returned yielder object to..
# ..emit the built-in YIELD Signal (which will be emitted either when..
# ..the emitter emits the signal or the time limit has run out).
yield(until_signal(self, "my_signal", 0.2), YIELD)
asserts.auto_pass("Yielding on Signal")
asserts.signal_was_emitted(self, "my_signal")
unwatch(self, "my_signal")