Documentation
¶
Overview ¶
Package sim provides a simulation backend for testing.
Index ¶
- type Backend
- func (s *Backend) Capture() string
- func (s *Backend) CaptureCell(x, y int) (mainc rune, comb []rune, style backend.Style)
- func (s *Backend) CaptureRegion(x, y, w, h int) string
- func (s *Backend) Clear()
- func (s *Backend) ContainsText(text string) bool
- func (s *Backend) FindText(text string) (x, y int)
- func (s *Backend) InjectAltKey(r rune)
- func (s *Backend) InjectCtrlKey(r rune)
- func (s *Backend) InjectKey(key terminal.Key, r rune)
- func (s *Backend) InjectKeyRune(r rune)
- func (s *Backend) InjectKeyString(str string)
- func (s *Backend) InjectKeyWithMod(key terminal.Key, r rune, ctrl, alt, shift bool)
- func (s *Backend) InjectMouse(x, y int, button terminal.MouseButton)
- func (s *Backend) InjectMouseAction(x, y int, button terminal.MouseButton, action terminal.MouseAction)
- func (s *Backend) InjectResize(width, height int)
- func (s *Backend) Resize(width, height int)
- func (s *Backend) ShowText() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
*backendtcell.Backend
// contains filtered or unexported fields
}
Backend is a testable backend using a simulation screen.
func (*Backend) CaptureCell ¶
CaptureCell returns the content and style of a single cell.
func (*Backend) CaptureRegion ¶
CaptureRegion captures a rectangular region of the screen.
func (*Backend) Clear ¶
func (s *Backend) Clear()
Clear clears the screen to spaces with default style.
func (*Backend) ContainsText ¶
ContainsText returns true if the text appears anywhere on screen.
func (*Backend) InjectAltKey ¶
InjectAltKey injects an alt+key combination.
func (*Backend) InjectCtrlKey ¶
InjectCtrlKey injects a ctrl+key combination.
func (*Backend) InjectKeyRune ¶
InjectKeyRune injects a regular character keypress.
func (*Backend) InjectKeyString ¶
InjectKeyString injects a string as a sequence of key events.
func (*Backend) InjectKeyWithMod ¶
InjectKeyWithMod injects a key event with modifiers.
func (*Backend) InjectMouse ¶
func (s *Backend) InjectMouse(x, y int, button terminal.MouseButton)
InjectMouse injects a mouse press event into the simulation.
func (*Backend) InjectMouseAction ¶
func (s *Backend) InjectMouseAction(x, y int, button terminal.MouseButton, action terminal.MouseAction)
InjectMouseAction injects a mouse event with a specific action.
func (*Backend) InjectResize ¶
InjectResize injects a resize event.