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 ¶
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 (*Loop) Flush ¶
Flush runs what was posted, and what that posts, until nothing is left, and returns how many functions ran.
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) RunUntil ¶
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.