class
Opal::Terminal::MockDriver
- Opal::Terminal::MockDriver
- Opal::Terminal::Driver
- Reference
- Object
Overview
In-memory mock terminal driver for headless automated testing.
Defined in:
opal/terminal/mock.crConstructors
Instance Method Summary
- #alt_screen? : Bool
-
#clear_output : Nil
Clears the recorded output buffer
- #cursor_visible? : Bool
- #disable_mouse : Nil
- #enable_mouse : Nil
- #enter_alternate_screen : Nil
- #event_queue : Array(KeyEvent | MouseEvent | ResizeEvent)
- #event_queue=(event_queue : Array(KeyEvent | MouseEvent | ResizeEvent))
- #exit_alternate_screen : Nil
- #flush : Nil
- #height : Int32
- #height=(height : Int32)
- #hide_cursor : Nil
- #in_raw_mode? : Bool
-
#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
-
#inject_mouse(x : Int32, y : Int32, button : MouseButton, action : MouseAction) : self
Injects a mouse event
-
#inject_resize(width : Int32, height : Int32) : self
Injects a window resize event
- #mouse_enabled? : Bool
-
#output : String
Returns the full recorded output string
- #output_io : IO::Memory
-
#poll_event(timeout_ms : Int32 = 0) : KeyEvent | MouseEvent | ResizeEvent | Nil
Non-blocking or timed check for input/resize events.
- #raw_mode(&)
-
#read_event : KeyEvent | MouseEvent | ResizeEvent | Nil
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.
- #show_cursor : Nil
- #size : Tuple(Int32, Int32)
-
#stripped_output : String
Returns the output with all ANSI escape sequences removed
- #width : Int32
- #width=(width : Int32)
- #write(str : String) : Nil
Instance methods inherited from class Opal::Terminal::Driver
check_resize : ResizeEvent | Nil
check_resize,
clear : Nil
clear,
disable_mouse : Nil
disable_mouse,
enable_mouse : Nil
enable_mouse,
enter_alternate_screen : Nil
enter_alternate_screen,
exit_alternate_screen : Nil
exit_alternate_screen,
flush : Nil
flush,
flush_input : Nil
flush_input,
hide_cursor : Nil
hide_cursor,
input : IO
input,
input=(input : IO)
input=,
move_to(row : Int32, col : Int32) : Nil
move_to,
on_resize : Proc(Int32, Int32, Nil) | Nil
on_resize,
on_resize=(on_resize : Proc(Int32, Int32, Nil) | Nil)
on_resize=,
output : IO
output,
output=(output : IO)
output=,
poll_event(timeout_ms : Int32 = 0) : KeyEvent | MouseEvent | ResizeEvent | Nil
poll_event,
raw_mode(&)
raw_mode,
read_event : KeyEvent | MouseEvent | ResizeEvent | Nil
read_event,
show_cursor : Nil
show_cursor,
size : Tuple(Int32, Int32)
size,
write(str : String) : Nil
write
Constructor methods inherited from class Opal::Terminal::Driver
new(output : IO = STDOUT, input : IO = STDIN)
new
Constructor Detail
Instance Method Detail
Injects a key event into the mock input stream
Injects a mouse event
Non-blocking or timed check for input/resize events.
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.