class Opal::Terminal::MockDriver

Overview

In-memory mock terminal driver for headless automated testing.

Defined in:

opal/terminal/mock.cr

Constructors

Instance Method Summary

Instance methods inherited from class Opal::Terminal::Driver

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, hide_cursor : Nil hide_cursor, move_to(row : Int32, col : Int32) : Nil move_to, raw_mode(&) raw_mode, read_event : KeyEvent | MouseEvent | Nil read_event, show_cursor : Nil show_cursor, size : Tuple(Int32, Int32) size, write(str : String) : Nil write

Constructor Detail

def self.new(width : Int32 = 80, height : Int32 = 24) #

[View source]

Instance Method Detail

def alt_screen? : Bool #

[View source]
def clear_output : Nil #

Clears the recorded output buffer


[View source]
def cursor_visible? : Bool #

[View source]
def disable_mouse : Nil #

[View source]
def enable_mouse : Nil #

[View source]
def enter_alternate_screen : Nil #

[View source]
def event_queue : Array(KeyEvent | MouseEvent) #

[View source]
def event_queue=(event_queue : Array(KeyEvent | MouseEvent)) #

[View source]
def exit_alternate_screen : Nil #

[View source]
def flush : Nil #

[View source]
def height : Int32 #

[View source]
def height=(height : Int32) #

[View source]
def hide_cursor : Nil #

[View source]
def in_raw_mode? : Bool #

[View source]
def 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


[View source]
def inject_mouse(x : Int32, y : Int32, button : MouseButton, action : MouseAction) : self #

Injects a mouse event


[View source]
def mouse_enabled? : Bool #

[View source]
def output : String #

Returns the full recorded output string


[View source]
def output_io : IO::Memory #

[View source]
def raw_mode(&) #

[View source]
def read_event : KeyEvent | MouseEvent | Nil #

[View source]
def show_cursor : Nil #

[View source]
def size : Tuple(Int32, Int32) #

[View source]
def stripped_output : String #

Returns the output with all ANSI escape sequences removed


[View source]
def width : Int32 #

[View source]
def width=(width : Int32) #

[View source]
def write(str : String) : Nil #

[View source]