uitest

package
v0.41.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT, Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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