uitest

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: MIT, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package uitest provides small helpers for testing ui widgets without a terminal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App wraps a ui.App with a fixed-size painter for tests.

func New

func New(root ui.Widget) *App

New creates a test app mounted with root. Scrollback appends (sysln, slash-command echoes, etc.) are captured rather than left to panic — this harness never runs a real Runner/Backend, so nothing else would service them.

func (*App) Cell

func (a *App) Cell(x, y int) ui.Cell

Cell returns the painted cell at x,y.

func (*App) Click

func (a *App) Click(x, y int)

Click sends a left mouse press at x,y.

func (*App) Contains

func (a *App) Contains(text string) bool

Contains reports whether the painted text contains text.

func (*App) Enter

func (a *App) Enter()

Enter sends an Enter key event.

func (*App) Key

func (a *App) Key(text string)

Key sends a printable key event.

func (*App) Pump

func (a *App) Pump(width, height int)

Pump rebuilds, lays out, and paints the app at width and height.

func (*App) Scrollback

func (a *App) Scrollback() string

Scrollback returns everything appended to scrollback so far (sysln output, slash-command echoes, etc.) — the counterpart to Text() for widgets that write outside the painted tree.

func (*App) Send

func (a *App) Send(ev ui.Event)

Send dispatches ev to the app.

func (*App) ShiftTab

func (a *App) ShiftTab()

ShiftTab sends a Shift+Tab key event.

func (*App) ShouldQuit

func (a *App) ShouldQuit() bool

ShouldQuit reports whether the wrapped app has requested quit.

func (*App) Tab

func (a *App) Tab()

Tab sends a Tab key event.

func (*App) Text

func (a *App) Text() string

Text returns the painter cell graphemes as a flat string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL