2021-07-18 14:15:08 +02:00
|
|
|
extends "res://addons/gut/test.gd"
|
2021-07-03 16:57:19 +02:00
|
|
|
|
|
|
|
var term: GDXterm.Terminal
|
|
|
|
|
|
|
|
|
2021-07-18 14:15:08 +02:00
|
|
|
func before_each():
|
2021-07-03 16:57:19 +02:00
|
|
|
term = GDXterm.Terminal.new()
|
|
|
|
term.rect_size = Vector2(400, 200)
|
2021-07-18 14:15:08 +02:00
|
|
|
add_child_autofree(term)
|
2021-07-03 16:57:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
func test_bell() -> void:
|
2021-07-21 17:58:20 +02:00
|
|
|
term.bell_cooldown = 0
|
2021-07-03 16:57:19 +02:00
|
|
|
term.write(char(7))
|
|
|
|
term.write(char(0x07))
|
|
|
|
term.write("\a")
|
|
|
|
term.write("\u0007")
|
|
|
|
term.write("'Ask not for whom the \a tolls; it tolls for thee' - John Donne")
|
2021-07-18 14:15:08 +02:00
|
|
|
yield(yield_to(term, "bell", 1), YIELD)
|
|
|
|
assert_signal_emit_count(term, "bell", 5)
|
2021-07-21 17:58:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
func test_bell_cooldown() -> void:
|
|
|
|
watch_signals(term)
|
|
|
|
term.bell_cooldown = 0.5
|
|
|
|
term.write("\a")
|
|
|
|
term.write("\a")
|
|
|
|
yield(yield_for(0.5), YIELD)
|
|
|
|
term.write("\a")
|
|
|
|
yield(yield_to(term, "bell", 1), YIELD)
|
|
|
|
assert_signal_emit_count(term, "bell", 2)
|