mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-06 04:55:30 +02:00
Setup tests
- Install Gut using gd-plug. - Add some basic tests. - Update workflow to run tests. - Add test and gd-plug install/uninstall recipes to Justfile. - Re-enable debug builds as these are used by editor when testing.
This commit is contained in:
parent
e234b14867
commit
db3564f0cc
128 changed files with 1412 additions and 16452 deletions
38
test/test_terminal.gd
Normal file
38
test/test_terminal.gd
Normal file
|
@ -0,0 +1,38 @@
|
|||
class_name TerminalTest extends GutTest
|
||||
|
||||
var terminal: Terminal
|
||||
|
||||
|
||||
func before_each():
|
||||
terminal = Terminal.new()
|
||||
terminal.size = Vector2(400, 200)
|
||||
add_child_autofree(terminal)
|
||||
|
||||
|
||||
class TestBell:
|
||||
extends TerminalTest
|
||||
|
||||
func test_bell() -> void:
|
||||
watch_signals(terminal)
|
||||
terminal.bell_cooldown = 0
|
||||
terminal.write(char(7))
|
||||
terminal.write(char(0x07))
|
||||
terminal.write("\a")
|
||||
terminal.write("\u0007")
|
||||
terminal.write("'Ask not for whom the \a tolls; it tolls for thee' - John Donne")
|
||||
assert_signal_emit_count(terminal, "bell", 5)
|
||||
|
||||
|
||||
class TestCursorPos:
|
||||
extends TerminalTest
|
||||
|
||||
func test_get_cursor_pos_initial():
|
||||
assert_eq(terminal.get_cursor_pos(), Vector2.ZERO)
|
||||
|
||||
func test_get_cursor_pos_x():
|
||||
terminal.write("_")
|
||||
assert_eq(terminal.get_cursor_pos().x, 1)
|
||||
|
||||
func test_get_cursor_pos_y():
|
||||
terminal.write("_".repeat(terminal.cols + 1))
|
||||
assert_eq(terminal.get_cursor_pos().y, 1)
|
Loading…
Add table
Add a link
Reference in a new issue