Documentation
¶
Index ¶
- func LstFixture(t *testing.T, listener func(api.Eventer), timeout time.Duration) (*UI, *Fixture)
- func NewFixture(t *testing.T, timeout time.Duration) (*UI, *Fixture)
- type Fixture
- func (tt *Fixture) Cells() api.CellsScreen
- func (tt *Fixture) CellsArea(x, y, width, height int) api.CellsScreen
- func (tt *Fixture) Display(s string, sty api.Style)
- func (tt *Fixture) Listen(l func(api.Eventer))
- func (tt *Fixture) PostBracketPaste(paste string)
- func (tt *Fixture) PostClick(x, y int, b api.ButtonMask, m api.ModifierMask)
- func (tt *Fixture) PostDrag(x, y int, b api.ButtonMask, m api.ModifierMask) (drop func(x, y int))
- func (tt *Fixture) PostKey(k api.Key, m api.ModifierMask)
- func (tt *Fixture) PostMouse(x, y int, b api.ButtonMask, m api.ModifierMask)
- func (tt *Fixture) PostMove(x, y int, xy ...int)
- func (tt *Fixture) PostResize(width, height int)
- func (tt *Fixture) PostRune(r rune, m api.ModifierMask)
- func (tt *Fixture) Screen() api.StringScreen
- func (tt *Fixture) ScreenArea(x, y, width, height int) api.StringScreen
- func (tt *Fixture) Size() (width, height int)
- func (fx *Fixture) TimeOut() time.Duration
- type UI
- func (u *UI) Colors() int
- func (u *UI) Display(x, y int, r rune, s api.Style)
- func (u *UI) EnableTransactionalEventPosts(timeout time.Duration)
- func (u *UI) Lib() interface{}
- func (u *UI) NewStyle() api.Style
- func (u *UI) OnQuit(listener func())
- func (u *UI) Post(evt api.Eventer) error
- func (u *UI) Quit()
- func (u *UI) Redraw()
- func (u *UI) SetCursor(x, y int, cs ...api.CursorStyle) (sx int, sy int, scs api.CursorStyle)
- func (u *UI) Size() (int, int)
- func (u *UI) Update()
- func (u *UI) WaitForQuit()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LstFixture ¶
LstFixture instantiates a new UI with an simulation screen and an testing instance reporting all events to provided listener. The ui is setup for transactional events, i.e. an event-post p returns not before all event-posts have been processed which were posted during p's processing. Processing of p times out after given timeout. LstFixture does not returns before initial resize event wasn't processed. Listener may be nil and a zero-timeout defaults to 100ms.
func NewFixture ¶
NewFixture instantiates a new UI with an simulation screen and an testing instance. In order to receive events [Testing.Listen] must be called additionally. The ui is setup for transactional events, i.e. an event-post p returns not before all event-posts have been processed which were posted during p's processing. Processing of p times out after given timeout. A zero-timeout defaults to 100ms.
Types ¶
type Fixture ¶
func (*Fixture) Cells ¶
func (tt *Fixture) Cells() api.CellsScreen
func (*Fixture) Listen ¶
Listen sets the listener and posts initial resize event. Listen is an no-op if already a listener is set.
func (*Fixture) PostBracketPaste ¶
func (*Fixture) PostClick ¶ added in v0.9.0
func (tt *Fixture) PostClick( x, y int, b api.ButtonMask, m api.ModifierMask, )
func (*Fixture) PostDrag ¶ added in v0.9.0
func (tt *Fixture) PostDrag( x, y int, b api.ButtonMask, m api.ModifierMask, ) (drop func(x, y int))
func (*Fixture) PostMouse ¶
func (tt *Fixture) PostMouse( x, y int, b api.ButtonMask, m api.ModifierMask, )
func (*Fixture) PostResize ¶
func (*Fixture) Screen ¶
func (tt *Fixture) Screen() api.StringScreen
func (*Fixture) ScreenArea ¶
func (tt *Fixture) ScreenArea(x, y, width, height int) api.StringScreen
type UI ¶
func (*UI) Colors ¶ added in v0.10.0
Colors provide the number of available (ANSI) colors. In case of a monochrome screen 0 is returned.
func (*UI) Display ¶
Display sets at given screen coordinates (x,y) given rune r with given style s.
func (*UI) EnableTransactionalEventPosts ¶
EnableEventTransactions guarantees that an event-post p not returns before all other posted events during the processing of p have been processed.
func (*UI) OnQuit ¶
func (u *UI) OnQuit(listener func())
OnQuit registers given function to be called on quitting.
func (*UI) Post ¶
Post given event evt into the event queue. Post is a no-op if Quit has been already called.
func (*UI) Quit ¶
func (u *UI) Quit()
Quit polling and reporting events, inform all listeners about about it and reset the terminal screen.
func (*UI) SetCursor ¶ added in v0.9.1
func (u *UI) SetCursor(x, y int, cs ...api.CursorStyle) ( sx int, sy int, scs api.CursorStyle, )
SetCursor sets the cursor to given coordinates (x,y) having optionally given style cs[0] provided (x,y) is on the screen and if so that cs[0] is not the ZeroCursor. Are later conditions not met the cursor is removed from the screen.
func (*UI) WaitForQuit ¶
func (u *UI) WaitForQuit()
WaitForQuit returns a channel which is closed if the event-loop is quit.