frostuitest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 3 Imported by: ? 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 frostuitest helps test frostui views and the models behind them without a window. Loop stands in for the UI thread: workers post to it from any goroutine, as they would through MyGo's Window.Update, and the test runs what they posted on its own goroutine, as the UI thread would.

It imports only the standard library, so an app's tests can use it whatever UI they draw.

Index

Constants

View Source
const Timeout = 5 * time.Second

Timeout is how long RunUntil waits for its condition before it fails the test.

Variables

This section is empty.

Functions

This section is empty.

Types

type Loop

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

Loop queues functions posted from any goroutine and runs them on the test's goroutine. The zero value is ready to use.

func NewLoop

func NewLoop() *Loop

NewLoop returns an empty loop.

func (*Loop) Flush

func (l *Loop) Flush() int

Flush runs what was posted, and what that posts, until nothing is left, and returns how many functions ran.

func (*Loop) Pending

func (l *Loop) Pending() int

Pending is how many posted functions wait.

func (*Loop) Post

func (l *Loop) Post(fn func())

Post queues fn; any goroutine may call it. Pass it where the app passes its window's Update.

func (*Loop) Ran

func (l *Loop) Ran() int

Ran is how many posted functions ran so far.

func (*Loop) RunUntil

func (l *Loop) RunUntil(t testing.TB, cond func() bool)

RunUntil runs what is posted until cond holds, checking it after each flush, and fails the test after Timeout. cond runs on the test's goroutine, so it may read what the posted functions write. It also checks cond every millisecond, for a condition a worker meets without posting.

func (*Loop) Settle

func (l *Loop) Settle(quiet time.Duration)

Settle runs what is posted until nothing comes for quiet: the workers ended and their results are applied.

Jump to

Keyboard shortcuts

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