class

Opal::Terminal::MockDriver

Inherits Opal::Terminal::Driver < Reference < Object

In-memory mock terminal driver for headless automated testing.

Constructors

new(width : Int32 = 80, height : Int32 = 24)
Source

Instance methods

alt_screen?
Source
clear_output

Clears the recorded output buffer

Source
cursor_visible?
Source
disable_mouse
Source
enable_mouse
Source
enter_alternate_screen
Source
event_queue
Source
event_queue=(event_queue : Array(KeyEvent | MouseEvent | ResizeEvent))
Source
exit_alternate_screen
Source
flush
Source
height
Source
height=(height : Int32)
Source
hide_cursor
Source
in_raw_mode?
Source
inject_key(name : String, char : Char | Nil = nil, ctrl : Bool = false, alt : Bool = false, shift : Bool = false) : self

Injects a key event into the mock input stream

Source
inject_mouse(x : Int32, y : Int32, button : MouseButton, action : MouseAction) : self

Injects a mouse event

Source
inject_resize(width : Int32, height : Int32) : self

Injects a window resize event

Source
mouse_enabled?
Source
output

Returns the full recorded output string

Source
output_io
Source
poll_event(timeout_ms : Int32 = 0) : KeyEvent | MouseEvent | ResizeEvent | Nil

Non-blocking or timed check for input/resize events.

Source
raw_mode
Source
read_event

Reads the next key, mouse, or resize event from the terminal, consuming from the internal event queue if multiple events arrived in the same read chunk.

Source
show_cursor
Source
size
Source
stripped_output

Returns the output with all ANSI escape sequences removed

Source
width
Source
width=(width : Int32)
Source
write(str : String) : Nil
Source