Documentation
¶
Overview ¶
Package treetest walks lys-ui widget trees for the shell's surface tests: find the button a user would click, read what the labels say.
Index ¶
- Constants
- Variables
- func All[T widget.Widget](root widget.Widget) []T
- func Button(t *testing.T, root widget.Widget, name string) *widget.Button
- func ButtonTextPx(a, b *widget.Button, face render.Font) float64
- func Code(sym xkb.Keysym) uint32
- func Contains(root, w widget.Widget) bool
- func First[T widget.Widget](t *testing.T, root widget.Widget) T
- func Font(t *testing.T) render.Font
- func HeapBytes(f func()) uint64
- func IconTheme(t *testing.T, names ...string)
- func Ink(w widget.Widget) int
- func KeySym(code uint32) xkb.Keysym
- func LabelReading(t *testing.T, root widget.Widget, text string) *widget.Label
- func Labels(root widget.Widget) []string
- func OffScale(root widget.Widget, face render.Font, sizes []float64) []string
- func Pointer(root widget.Widget, target widget.Boundser, w, h int) (*widget.Router, widget.Point)
- func RenderedTextPx(l *widget.Label, face render.Font) float64
- func Walk(w widget.Widget, visit func(widget.Widget))
- func WithClass(root widget.Widget, class string) []widget.Widget
Constants ¶
const Liveness = 10 * time.Second
Liveness is how long a surface harness waits for a surface to open or a request to be answered before failing: a guard against a hang, not a speed bound. The first surface of a test binary compiles the whole stylesheet bundle, which the race detector under a parallel test run stretches past a couple of seconds.
Variables ¶
var Loop sync.Mutex
Loop stands in for the process's one UI goroutine in the surface harnesses: lys-ui keeps its style and layout scratch per process, so every harness in a test binary runs its widget work under this one lock, never a lock of its own (a finished test's harness can still be draining while the next one builds).
Functions ¶
func ButtonTextPx ¶ added in v0.2.0
ButtonTextPx is the font size two buttons of one build render their labels at in face, read off how much wider the one with the longer accessible name measures: their padding, borders and icons cancel out, so it needs no reach into a button's content.
func HeapBytes ¶ added in v0.2.0
func HeapBytes(f func()) uint64
HeapBytes is how many bytes f allocates on the Go heap, read from the runtime's stopped-world statistics so allocations still cached per thread are counted where they happened.
func IconTheme ¶
IconTheme points theme icon lookups at a temp hicolor theme holding one solid square SVG app icon per name, for the duration of the test.
func KeySym ¶ added in v0.2.0
KeySym reads each code as the keysym of the same number, so a surface harness presses a key by its symbol: OnKey(r, Code(xkb.KeyEscape), 0).
func LabelReading ¶ added in v0.2.0
LabelReading is the first label Walk reaches under root whose text is text.
func OffScale ¶ added in v0.2.0
OffScale names every laid-out, shown label Walk reaches under root whose rendered size is none of sizes, within the rounding of its measured width. A button's content is out of its reach: lys-ui's Button lists no Children.
func Pointer ¶ added in v0.2.0
Pointer lays root out in a w x h rect and returns a Router over it with the pointer resting on target's centre, and that point: the real input path, hit testing and the pointer and scroll hooks included.
func RenderedTextPx ¶ added in v0.2.0
RenderedTextPx is the font size l's text renders at in face: the cascade's font-size, else the constructor's, read off how much its measured width grows by eight more probe glyphs, unclipped, so padding and borders cancel out.
Types ¶
This section is empty.