Documentation
¶
Overview ¶
Package e2e drives the built icebath program in a real terminal window on a fresh computer.
Index ¶
- func Seated()
- func TestMain(m *testing.M)
- func TestTour(t *testing.T)
- func Tools() []string
- type Box
- type Button
- type Command
- type Controller
- func (c *Controller) Act(action string)
- func (c *Controller) After(before *Screen) *View
- func (c *Controller) Back()
- func (c *Controller) Choice(row Row) (choice, chosen bool)
- func (c *Controller) Choose(name string) bool
- func (c *Controller) Click(x, y int)
- func (c *Controller) Close() bool
- func (c *Controller) Command(title, detail string) bool
- func (c *Controller) Commands() []Command
- func (c *Controller) Describe() string
- func (c *Controller) Do(label string) bool
- func (c *Controller) Front() *View
- func (c *Controller) Leaves(key string) bool
- func (c *Controller) Look() *Screen
- func (c *Controller) OpenCommands() bool
- func (c *Controller) Press(chords ...string)
- func (c *Controller) Push(button Button)
- func (c *Controller) Rows(page func(), stop func(Row) bool) []Row
- func (c *Controller) Screen() *Screen
- func (c *Controller) Select(rows []Row, i int) bool
- func (c *Controller) Settle(limit time.Duration)
- func (c *Controller) Shot(path string) error
- func (c *Controller) Type(text string)
- func (c *Controller) Until(limit time.Duration, test func(*Screen) bool) bool
- type Machine
- type Row
- type Screen
- func (s *Screen) Boxes() []Box
- func (s *Screen) Find(text string) (int, int, bool)
- func (s *Screen) Front() *View
- func (s *Screen) Has(text string) bool
- func (s *Screen) Selected(b Box) (Row, bool)
- func (s *Screen) Steady() string
- func (s *Screen) String() string
- func (s *Screen) Text(y, x0, x1 int) string
- type Seat
- func (s *Seat) Close()
- func (s *Seat) Emulator() *term.Emulator
- func (s *Seat) Grab() *image.RGBA
- func (s *Seat) Ignored(since time.Duration) bool
- func (s *Seat) Quiet(quiet, answer time.Duration) bool
- func (s *Seat) Run(m *Machine, program ...string) (net.Listener, error)
- func (s *Seat) Running() bool
- func (s *Seat) Send(data []byte)
- func (s *Seat) Stop()
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Seated ¶
func Seated()
Seated runs as the first process on a fresh computer when the seat variable is set: it opens the program's terminal and the listening socket for the computer's model server, passes both out to the seat, and becomes the program. It returns when the variable is unset.
Types ¶
type Button ¶
Button is an action the bottom edge of a box offers, with the key the screen shows for it.
type Controller ¶
type Controller struct {
Seat *Seat
// contains filtered or unexported fields
}
Controller uses the program in a seat the way a user does: it reads the screen to find things by their names, presses the keys the screen shows for its buttons, and takes every other key from the program's own key map.
func NewController ¶
func NewController(seat *Seat) *Controller
NewController makes a controller for the seat, reading the screen in the glyphs and keys the program starts with.
func (*Controller) Act ¶
func (c *Controller) Act(action string)
Act presses the key the program binds to the action.
func (*Controller) After ¶
func (c *Controller) After(before *Screen) *View
After returns the view that has the keys once an action has shown on the screen. The program may answer an action a moment after it stops drawing, so After waits for the screen to differ from the screen before the action, and then for a longer quiet time.
func (*Controller) Back ¶
func (c *Controller) Back()
Back leaves the front view: by its last button when that button backs out, by its close mark when it has no such button and is a window, and by the key that backs out of every dialog otherwise.
func (*Controller) Choice ¶
func (c *Controller) Choice(row Row) (choice, chosen bool)
Choice reports whether the row is one value in a set of choices, which the screen marks with a filled or hollow circle, and whether it is the value chosen now.
func (*Controller) Choose ¶
func (c *Controller) Choose(name string) bool
Choose highlights the row with the name in the front view and uses the view's first button on it.
func (*Controller) Click ¶
func (c *Controller) Click(x, y int)
Click presses and releases the left mouse button on a cell.
func (*Controller) Close ¶
func (c *Controller) Close() bool
Close clicks the close mark in the front view's title, and reports whether the title has a close mark.
func (*Controller) Command ¶
func (c *Controller) Command(title, detail string) bool
Command runs the command list entry with the title and detail, and reports whether the list had it.
func (*Controller) Commands ¶
func (c *Controller) Commands() []Command
Commands lists every entry in the program's command list, in list order.
func (*Controller) Describe ¶
func (c *Controller) Describe() string
Describe returns the front view's title, buttons and highlighted row in one line, for a failure message.
func (*Controller) Do ¶
func (c *Controller) Do(label string) bool
Do uses the front view's button with the label, and reports whether the view has it.
func (*Controller) Front ¶
func (c *Controller) Front() *View
Front returns the view that has the keys after the program has stopped drawing. While the program runs some view always has them, so a screen without one is between two views, and Front waits for the next view.
func (*Controller) Leaves ¶
func (c *Controller) Leaves(key string) bool
Leaves reports whether the key is bound to an action that backs out of a view without doing anything.
func (*Controller) Look ¶
func (c *Controller) Look() *Screen
Look returns the screen after the program has stopped drawing.
func (*Controller) OpenCommands ¶
func (c *Controller) OpenCommands() bool
OpenCommands opens the program's command list and reports whether it showed.
func (*Controller) Press ¶
func (c *Controller) Press(chords ...string)
Press sends the keys, each in key map spelling, such as ctrl+g.
func (*Controller) Push ¶
func (c *Controller) Push(button Button)
Push uses a button: by its key when the screen shows a key for it, and by a click otherwise.
func (*Controller) Rows ¶
func (c *Controller) Rows(page func(), stop func(Row) bool) []Row
Rows walks the highlight from the first row to the last and returns every row it passed. It calls page each time the list has scrolled a full page past the rows last shown, and stops early when stop accepts a row.
func (*Controller) Screen ¶
func (c *Controller) Screen() *Screen
Screen copies the program's current screen.
func (*Controller) Select ¶
func (c *Controller) Select(rows []Row, i int) bool
Select moves the highlight to row i from a walk's rows, and reports whether it got there.
func (*Controller) Settle ¶
func (c *Controller) Settle(limit time.Duration)
Settle waits until the program has stopped drawing, or the limit passes.
func (*Controller) Shot ¶
func (c *Controller) Shot(path string) error
Shot writes the terminal window's picture to path.png and the screen's text to path.txt. It waits for the window to finish drawing.
func (*Controller) Type ¶
func (c *Controller) Type(text string)
Type sends the text as typed characters.
type Machine ¶
Machine is a fresh computer: an empty home folder, the program installed, one user, and no network but its own.
func NewMachine ¶
NewMachine describes a computer kept in dir, which saves its states under kept and runs the program built at binary.
func (*Machine) Fresh ¶
Fresh makes the computer new: the home folder a new account starts with, and the program installed.
type Row ¶
type Row struct {
X, Y int
Text string
Name string
Mark string
// Offers lists the labels of the buttons the view showed for the row, without the button that backs out.
Offers []string
}
Row is the selected line of a list, form or menu.
type Screen ¶
type Screen struct {
W, H int
Cells [][]uv.Cell
Alt bool
// contains filtered or unexported fields
}
Screen is the program's screen at one moment, as rows of cells.
func (*Screen) Boxes ¶
Boxes finds every bordered rectangle on the screen by its left and bottom edges, because a notice may cover its top right corner.
func (*Screen) Front ¶
Front returns the window or dialog that has the keys: the marked box with the brightest title, because a dialog dims what is behind it.
func (*Screen) Selected ¶
Selected returns the highlighted line inside the box: the row mark on a background that differs from the box's background. A row that spans several lines is returned as a single row.
func (*Screen) Steady ¶
Steady returns the screen's text with digits and working marks replaced, so a running clock does not count as a change.
type Seat ¶
Seat is one terminal window on its own display, with the program running in it.
func OpenSeat ¶
OpenSeat starts a display and a terminal window that fills it, and measures the window's grid.
func (*Seat) Close ¶
func (s *Seat) Close()
Close ends the program, the terminal window and the display.
func (*Seat) Ignored ¶
Ignored reports whether the program has written nothing since its last input, for at least the given time.
func (*Seat) Quiet ¶
Quiet reports whether the program has been silent for the quiet time, and has had the answer time since its last input.
func (*Seat) Run ¶
Run starts the program on the computer in this seat's terminal, and returns the listener for the computer's model server.
type View ¶
View is the box the program gives the keys to: a window or a dialog.
func (*View) Out ¶
Out returns the button that backs out of the view, which a dialog shows last and a window does not have.