Documentation
¶
Overview ¶
Package gluttertest is the widget-testing package: WidgetTester, finders and golden comparison, driven by a fake clock and a fake platform. A test makes a Tester with New, pumps a widget into it, finds widgets, sends them pointer and key events, and checks what it finds. No display, no GPU and no real time are involved (SPEC §17).
func TestCounter(t *testing.T) {
tester := gluttertest.New(t)
tester.PumpWidget(NewCounter())
tester.Tap(gluttertest.ByType[*Button]())
tester.Pump()
if err := gluttertest.FindsOneWidget(tester, gluttertest.ByText("1")); err != nil {
t.Error(err)
}
}
The text of a test is laid out with the fonts bundled with Glutter (Roboto and Material Icons) and no system fonts, so that it is the same on every machine. Opts.Fonts adds more, for example a monospace font for the golden of a code view. A text whose family the test has no font for (monospace, a name that is not installed, no family at all) is drawn with Roboto, as Flutter draws it with its default font.
An error that the framework reports (a panic in Build, layout or a callback, SPEC §14.2) does not stop the test where it happens; it is kept, and the test fails at its end unless it took the error with TakeError.
At the end of a test the tree is unmounted, as flutter_test does after the body of a test: New registers a cleanup that pumps an empty widget, so every State.Dispose runs and every State.Lifetime is cancelled. It does nothing when the test failed already or when the framework reported an error that the test did not take. Cleanups run last in, first out, so a cleanup that the test registers after New still sees the tree; an object that the tree uses and that the test disposes (a controller, a delegate) is registered with t.Cleanup before New, to be disposed after the unmounting.
Flutter: package:flutter_test/flutter_test.dart.
Index ¶
- Constants
- func FindPlatformMenuItem(items []ui.PlatformMenuItemData, label string) (ui.PlatformMenuItemData, bool)
- func FindsAtLeastNWidgets(t *Tester, f Finder, n int) error
- func FindsNWidgets(t *Tester, f Finder, n int) error
- func FindsNothing(t *Tester, f Finder) error
- func FindsOneWidget(t *Tester, f Finder) error
- func FindsWidgets(t *Tester, f Finder) error
- func StateOf[T widgets.State](t *Tester, f Finder) T
- func WidgetAs[T widgets.Widget](t *Tester, f Finder) T
- type BackGestureOpts
- type CursorActivation
- type DescendantOpts
- type FakeDesktop
- func (f *FakeDesktop) ActivateTray()
- func (f *FakeDesktop) AnswerFileChooser(paths ...string)
- func (f *FakeDesktop) CancelFileChooser()
- func (f *FakeDesktop) ClickTrayMenuItem(label string)
- func (f *FakeDesktop) CloseNotification(id, reason uint32)
- func (f *FakeDesktop) DisableFileChooser()
- func (f *FakeDesktop) DisableOpenURI()
- func (f *FakeDesktop) FileChoosers() []FakeFileChooser
- func (f *FakeDesktop) InvokeNotificationAction(id uint32, action string)
- func (f *FakeDesktop) Notifications() []FakeNotification
- func (f *FakeDesktop) OpenedURIs() []string
- func (f *FakeDesktop) PendingFileChoosers() int
- func (f *FakeDesktop) SetOpenURIAnswer(answer FakeOpenURIAnswer)
- func (f *FakeDesktop) TrayMenu() []string
- func (f *FakeDesktop) TrayProperty(name string) any
- func (f *FakeDesktop) TrayRegistered() bool
- func (f *FakeDesktop) WaitFor(what string, cond func() bool)
- type FakeFileChooser
- type FakeNotification
- type FakeNotificationAction
- type FakeOpenURIAnswer
- type FindOpts
- type Finder
- func Ancestor(of, matching Finder, opts ...DescendantOpts) Finder
- func At(f Finder, index int) Finder
- func ByElementPredicate(description string, fn func(e widgets.Element) bool, opts ...FindOpts) Finder
- func ByIcon(icon any, opts ...FindOpts) Finder
- func ByKey(key foundation.Key, opts ...FindOpts) Finder
- func ByPredicate(description string, fn func(w widgets.Widget) bool, opts ...FindOpts) Finder
- func BySemanticsLabel(label string, opts ...FindOpts) Finder
- func BySemanticsLabelMatching(pattern *regexp.Regexp, opts ...FindOpts) Finder
- func ByText(text string, opts ...FindOpts) Finder
- func ByTextContaining(substring string, opts ...FindOpts) Finder
- func ByTooltip(message string, opts ...FindOpts) Finder
- func ByType[T widgets.Widget](opts ...FindOpts) Finder
- func ByWidget(w widgets.Widget, opts ...FindOpts) Finder
- func Descendant(of, matching Finder, opts ...DescendantOpts) Finder
- func Everything(opts ...FindOpts) Finder
- func First(f Finder) Finder
- func Last(f Finder) Finder
- type Font
- type GPURecorder
- func (r *GPURecorder) Calls() []string
- func (r *GPURecorder) CompleteReads()
- func (r *GPURecorder) Device() *fakedevice.Device
- func (r *GPURecorder) EndApp()
- func (r *GPURecorder) Lose()
- func (r *GPURecorder) Ops() []string
- func (r *GPURecorder) Reset()
- func (r *GPURecorder) SupportTimestamps(periodNanoseconds float64)
- type GestureOpts
- type IconWidget
- type KeyOpts
- type OffstageWidget
- type Opts
- type PadRumble
- type PadSpec
- type PumpAndSettleOpts
- type PumpFramesOpts
- type PumpWidgetOpts
- type TB
- type TestAudio
- func (a *TestAudio) AddDevice(info audio.DeviceInfo)
- func (a *TestAudio) Capture() *TestAudioDevice
- func (a *TestAudio) Devices() []*TestAudioDevice
- func (a *TestAudio) FailOpen(err error)
- func (a *TestAudio) Open(ctx context.Context, kind audio.DeviceKind, opts platform.AudioOpenOptions, ...) (platform.AudioDevice, error)
- func (a *TestAudio) Playback() *TestAudioDevice
- func (a *TestAudio) RemoveDevice(id string)
- func (a *TestAudio) SetDefault(id string)
- func (a *TestAudio) SetUnavailable(v bool)
- type TestAudioDevice
- func (d *TestAudioDevice) BufferFrames() int
- func (d *TestAudioDevice) Format() audio.Format
- func (d *TestAudioDevice) ID() string
- func (d *TestAudioDevice) Lose()
- func (d *TestAudioDevice) PauseInBackground() bool
- func (d *TestAudioDevice) Pull(frames, chunk int) []float32
- func (d *TestAudioDevice) PullInto(out []float32)
- func (d *TestAudioDevice) Push(frames []float32)
- func (d *TestAudioDevice) Suspend()
- func (d *TestAudioDevice) Unsuspend()
- type TestGesture
- type TestPad
- func (p *TestPad) Disconnect()
- func (p *TestPad) ID() gamepad.PadID
- func (p *TestPad) Pad() *gamepad.Pad
- func (p *TestPad) Press(b gamepad.Button)
- func (p *TestPad) RawAxis(i, v int)
- func (p *TestPad) RawButton(i int, down bool)
- func (p *TestPad) RawHat(i int, mask uint8)
- func (p *TestPad) Release(b gamepad.Button)
- func (p *TestPad) Rumbles() []PadRumble
- func (p *TestPad) Sensor(kind sensors.Kind, x, y, z float64)
- func (p *TestPad) SensorsOn() bool
- func (p *TestPad) SetAxis(a gamepad.Axis, v float64)
- func (p *TestPad) SetBattery(level float64, charging bool)
- func (p *TestPad) Tap(b gamepad.Button)
- func (p *TestPad) Touch(touchpad, finger int, down bool, x, y float64)
- type TestSensor
- type TestSensors
- type TestTrackpadGesture
- type TestWindow
- type Tester
- func (t *Tester) ActivatedCursors() []CursorActivation
- func (t *Tester) Audio() *TestAudio
- func (t *Tester) BottomRight(f Finder) ui.Offset
- func (t *Tester) CancelBackGesture()
- func (t *Tester) Center(f Finder) ui.Offset
- func (t *Tester) ClearClipboard()
- func (t *Tester) ClearLogs()
- func (t *Tester) ClipboardHTML() string
- func (t *Tester) ClipboardPNG() []byte
- func (t *Tester) ClipboardText() (string, bool)
- func (t *Tester) ClipboardURIs() []string
- func (t *Tester) ClosePlatformMenu(id int)
- func (t *Tester) CommitBackGesture()
- func (t *Tester) ConnectPad(spec ...PadSpec) *TestPad
- func (t *Tester) Count(f Finder) int
- func (t *Tester) Dispatcher() *ui.PlatformDispatcher
- func (t *Tester) Drag(f Finder, by ui.Offset, opts ...GestureOpts)
- func (t *Tester) DragFrom(at, by ui.Offset, opts ...GestureOpts)
- func (t *Tester) Drags() []ui.DragRequest
- func (t *Tester) Drop(view ui.ViewID, phase ui.DropPhase, at ui.Offset, event ui.DropEvent) ui.DropActions
- func (t *Tester) Elapsed() time.Duration
- func (t *Tester) Element(f Finder) widgets.Element
- func (t *Tester) Elements(f Finder) []widgets.Element
- func (t *Tester) EndPointerLock(view ui.ViewID)
- func (t *Tester) EnsureSemantics() *semantics.SemanticsHandle
- func (t *Tester) EnterText(f Finder, text string)
- func (t *Tester) Errors() []error
- func (t *Tester) Exists(f Finder) bool
- func (t *Tester) ExitRequests() int
- func (t *Tester) FailDrags(err error)
- func (t *Tester) FailKeepScreenOn(err error)
- func (t *Tester) FailPointerLock(err error)
- func (t *Tester) FakeDesktop() *FakeDesktop
- func (t *Tester) Fling(f Finder, by ui.Offset, speed float64, opts ...GestureOpts)
- func (t *Tester) FlingFrom(at, by ui.Offset, speed float64, opts ...GestureOpts)
- func (t *Tester) FlushPosted()
- func (t *Tester) FocusEvents() []ui.ViewFocusEvent
- func (t *Tester) FocusRequests() []ui.ViewID
- func (t *Tester) GPUDevice() *GPURecorder
- func (t *Tester) Hover(at ui.Offset)
- func (t *Tester) LongPress(f Finder, opts ...GestureOpts)
- func (t *Tester) LongPressAt(at ui.Offset, opts ...GestureOpts)
- func (t *Tester) MatchesGolden(name string)
- func (t *Tester) MoveLockedMouse(delta ui.Offset)
- func (t *Tester) NoPlatformMenuBar()
- func (t *Tester) OpenPlatformMenu(id int)
- func (t *Tester) PadExtrasWoken() int
- func (t *Tester) PlatformMenuSets() int
- func (t *Tester) PlatformMenus() []ui.PlatformMenuItemData
- func (t *Tester) PointerLocked(view ui.ViewID) bool
- func (t *Tester) PopRoute()
- func (t *Tester) PrimaryText() (string, bool)
- func (t *Tester) Pump(duration ...time.Duration)
- func (t *Tester) PumpAndSettle(opts ...PumpAndSettleOpts) int
- func (t *Tester) PumpFrame(duration time.Duration)
- func (t *Tester) PumpFrames(w widgets.Widget, maxDuration time.Duration, opts ...PumpFramesOpts)
- func (t *Tester) PumpWidget(w widgets.Widget, opts ...PumpWidgetOpts)
- func (t *Tester) RenderObject(f Finder) rendering.RenderObject
- func (t *Tester) RequestWindowClose(view ui.ViewID) bool
- func (t *Tester) RequestWindowCloseFor(view ui.ViewID, reason ui.AppExitReason) bool
- func (t *Tester) ResetFocusEvents()
- func (t *Tester) RunReleaseHooks()
- func (t *Tester) Scenes() []*ui.Scene
- func (t *Tester) ScreenKeptOn(view ui.ViewID) bool
- func (t *Tester) Screenshot() *image.RGBA
- func (t *Tester) Scroll(f Finder, delta ui.Offset)
- func (t *Tester) ScrollAt(at, delta ui.Offset)
- func (t *Tester) ScrollKindAt(kind ui.PointerDeviceKind, at, delta ui.Offset)
- func (t *Tester) SelectPlatformMenuItem(id int)
- func (t *Tester) SemanticsUpdates() []*ui.SemanticsUpdate
- func (t *Tester) SendKeyDownEvent(logical services.LogicalKeyboardKey, opts ...KeyOpts) bool
- func (t *Tester) SendKeyEvent(logical services.LogicalKeyboardKey, opts ...KeyOpts) bool
- func (t *Tester) SendKeyRepeatEvent(logical services.LogicalKeyboardKey, opts ...KeyOpts) bool
- func (t *Tester) SendKeyUpEvent(logical services.LogicalKeyboardKey, opts ...KeyOpts) bool
- func (t *Tester) SendOpenRequest(request ui.OpenRequest)
- func (t *Tester) SendTextInputEvent(event ui.TextInputEvent)
- func (t *Tester) Sensors() *TestSensors
- func (t *Tester) SetClipboardHTML(html string)
- func (t *Tester) SetClipboardPNG(png []byte)
- func (t *Tester) SetClipboardText(text string)
- func (t *Tester) SetClipboardURIs(uris []string)
- func (t *Tester) SetDevicePixelRatio(ratio float64)
- func (t *Tester) SetLifecycleState(state ui.AppLifecycleState)
- func (t *Tester) SetPlatformConfiguration(change func(c *ui.PlatformConfiguration))
- func (t *Tester) SetPrimaryText(text string)
- func (t *Tester) SetViewConfiguration(change func(c *ui.ViewConfiguration))
- func (t *Tester) SetViewFocus(view ui.ViewID, focused bool, direction ...ui.ViewFocusDirection)
- func (t *Tester) SetViewSize(size ui.Size)
- func (t *Tester) SetWindowCreateError(err error)
- func (t *Tester) SetWindowInfo(view ui.ViewID, info ui.WindowInfo)
- func (t *Tester) SetWindowSize(view ui.ViewID, size ui.Size)
- func (t *Tester) ShowKeyboard(f Finder) *widgets.EditableTextState
- func (t *Tester) SimulateStatusBarTap()
- func (t *Tester) Size(f Finder) ui.Size
- func (t *Tester) StartBackGesture(progress float64, opts ...BackGestureOpts) bool
- func (t *Tester) StartGesture(at ui.Offset, opts ...GestureOpts) *TestGesture
- func (t *Tester) StartTrackpadGesture(at ui.Offset) *TestTrackpadGesture
- func (t *Tester) TakeError() error
- func (t *Tester) TakeErrors() []error
- func (t *Tester) Tap(f Finder, opts ...GestureOpts)
- func (t *Tester) TapAt(at ui.Offset, opts ...GestureOpts)
- func (t *Tester) TextInputStates() []ui.TextInputState
- func (t *Tester) TopLeft(f Finder) ui.Offset
- func (t *Tester) TrackpadFling(f Finder, by ui.Offset, speed float64)
- func (t *Tester) TrackpadFlingFrom(at, by ui.Offset, speed float64)
- func (t *Tester) UpdateBackGestureProgress(progress float64, opts ...BackGestureOpts)
- func (t *Tester) ViewActions(view ui.ViewID) []ui.WindowAction
- func (t *Tester) ViewScenes(view ui.ViewID) []*ui.Scene
- func (t *Tester) ViewTitle(view ui.ViewID) string
- func (t *Tester) Widget(f Finder) widgets.Widget
- func (t *Tester) Widgets(f Finder) []widgets.Widget
- func (t *Tester) WindowActions() []ui.WindowAction
- func (t *Tester) WindowContentType(view ui.ViewID) ui.ContentType
- func (t *Tester) WindowHidden(view ui.ViewID) bool
- func (t *Tester) WindowIcon(view ui.ViewID) ui.WindowIcon
- func (t *Tester) Windows() []TestWindow
- type TextWidget
- type TooltipWidget
Constants ¶
const DragSlopDefault = 20.0
DragSlopDefault is how far a drag moves first so that it passes the touch slop of the recognizers, in logical pixels.
Flutter: flutter_test/lib/src/controller.dart kDragSlopDefault
Variables ¶
This section is empty.
Functions ¶
func FindPlatformMenuItem ¶
func FindPlatformMenuItem(items []ui.PlatformMenuItemData, label string) (ui.PlatformMenuItemData, bool)
FindPlatformMenuItem returns the first item with the label among the items of the menu bar and below, depth first, and whether there is one.
Flutter: no counterpart
func FindsAtLeastNWidgets ¶
FindsAtLeastNWidgets checks that the finder finds n widgets or more.
Flutter: flutter_test/lib/src/matchers.dart findsAtLeastNWidgets
func FindsNWidgets ¶
FindsNWidgets checks that the finder finds exactly n widgets.
Flutter: flutter_test/lib/src/matchers.dart findsNWidgets
func FindsNothing ¶
FindsNothing checks that the finder finds nothing.
Flutter: flutter_test/lib/src/matchers.dart findsNothing
func FindsOneWidget ¶
FindsOneWidget checks that the finder finds exactly one widget.
Flutter: flutter_test/lib/src/matchers.dart findsOneWidget
func FindsWidgets ¶
FindsWidgets checks that the finder finds at least one widget.
Flutter: flutter_test/lib/src/matchers.dart findsWidgets
Types ¶
type BackGestureOpts ¶
type BackGestureOpts struct {
// Touch is the position of the finger in logical pixels; None is a back that
// a button or a key makes (the event has no touch offset).
Touch foundation.Opt[ui.Offset]
// SwipeEdge is the edge the gesture started from; the default is the left
// edge.
SwipeEdge ui.BackSwipeEdge
}
BackGestureOpts are the optional parameters of StartBackGesture and UpdateBackGestureProgress: where the finger is and which edge the gesture started from.
Flutter: flutter_test/lib/src/binding.dart (the arguments of the flutter/backgesture channel's startBackGesture and updateBackGestureProgress)
type CursorActivation ¶
type CursorActivation struct {
// Device is the pointer device the cursor is for.
Device int
// Kind is the kind of the system cursor, such as "click".
Kind string
}
CursorActivation is a system mouse cursor that the framework asked the platform to show.
Flutter: no counterpart (a call of the flutter/mousecursor channel)
type DescendantOpts ¶
type DescendantOpts struct {
// MatchRoot also counts the element of the first finder itself.
MatchRoot bool
}
DescendantOpts are the optional parameters of Descendant and Ancestor.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.descendant
type FakeDesktop ¶
type FakeDesktop struct {
// contains filtered or unexported fields
}
FakeDesktop is a desktop for the tests of an app that uses package desktop: a notification service, a StatusNotifierWatcher for the system tray, a file chooser portal and an OpenURI portal, on an in-process bus; it starts no program. The code of the app runs as it does for real; the test looks at what it sent and answers the way the user would.
The fake replaces the desktop of every platform, whatever the target platform of the test (foundation.DefaultTargetPlatform) and whatever the host: package desktop then talks to the fake's bus and never to the desktop of macOS, Windows, the web, Android or iOS. Its bus speaks Linux's protocols (D-Bus, StatusNotifierItem), but the calls of the app are the same on every platform, so a test of an app's tray need not run as Linux.
Flutter: no counterpart
func (*FakeDesktop) ActivateTray ¶
func (f *FakeDesktop) ActivateTray()
ActivateTray does what the user does when they click the tray icon.
Flutter: no counterpart
func (*FakeDesktop) AnswerFileChooser ¶
func (f *FakeDesktop) AnswerFileChooser(paths ...string)
AnswerFileChooser chooses the paths in the oldest file dialog that is open, the way the user does.
Flutter: no counterpart
func (*FakeDesktop) CancelFileChooser ¶
func (f *FakeDesktop) CancelFileChooser()
CancelFileChooser closes the oldest file dialog that is open without a choice.
Flutter: no counterpart
func (*FakeDesktop) ClickTrayMenuItem ¶
func (f *FakeDesktop) ClickTrayMenuItem(label string)
ClickTrayMenuItem does what the user does when they choose the item with the label in the menu of the tray, and runs the app's callback. It fails the test when there is no such item.
Flutter: no counterpart
func (*FakeDesktop) CloseNotification ¶
func (f *FakeDesktop) CloseNotification(id, reason uint32)
CloseNotification closes a notification the way the desktop does, with a reason of the specification (1 expired, 2 dismissed by the user, 3 closed by the app), and runs the app's callback.
Flutter: no counterpart
func (*FakeDesktop) DisableFileChooser ¶
func (f *FakeDesktop) DisableFileChooser()
DisableFileChooser takes the file chooser portal away, as on a desktop that has none: the calls of desktop.OpenFiles, SaveFile and SaveFiles (the dialogs for files, for folders and for saving) fail with FileChooserUnavailable, until the test ends. A dialog that is open already stays open.
Flutter: no counterpart
func (*FakeDesktop) DisableOpenURI ¶
func (f *FakeDesktop) DisableOpenURI()
DisableOpenURI takes the OpenURI portal away, as on a desktop that has none: the calls of desktop.OpenURI fail with OpenURIUnavailable (the fake desktop starts no xdg-open), until the test ends.
Flutter: no counterpart
func (*FakeDesktop) FileChoosers ¶
func (f *FakeDesktop) FileChoosers() []FakeFileChooser
FileChoosers are the file dialogs that the app has opened, oldest first, with what it asked of each (the folder, the filters, the title, ...); the dialogs that the test answered stay in the list, with Answered set.
Flutter: no counterpart
func (*FakeDesktop) InvokeNotificationAction ¶
func (f *FakeDesktop) InvokeNotificationAction(id uint32, action string)
InvokeNotificationAction does what the user does when they choose an action of a notification, and runs the app's callback.
Flutter: no counterpart
func (*FakeDesktop) Notifications ¶
func (f *FakeDesktop) Notifications() []FakeNotification
Notifications are the notifications that the app showed, oldest first; a notification that replaced another takes its place.
Flutter: no counterpart
func (*FakeDesktop) OpenedURIs ¶
func (f *FakeDesktop) OpenedURIs() []string
OpenedURIs are the URIs that the app asked the desktop to open with desktop.OpenURI, oldest first, whatever the portal answered (SetOpenURIAnswer); a call made after DisableOpenURI is not among them.
Flutter: no counterpart
func (*FakeDesktop) PendingFileChoosers ¶
func (f *FakeDesktop) PendingFileChoosers() int
PendingFileChoosers is how many file dialogs the app has opened that the test has not answered.
Flutter: no counterpart
func (*FakeDesktop) SetOpenURIAnswer ¶
func (f *FakeDesktop) SetOpenURIAnswer(answer FakeOpenURIAnswer)
SetOpenURIAnswer chooses how the OpenURI portal answers the calls of desktop.OpenURI from now on: the URI opens (the default), the user cancels the app chooser, or the portal fails.
Flutter: no counterpart
func (*FakeDesktop) TrayMenu ¶
func (f *FakeDesktop) TrayMenu() []string
TrayMenu are the labels of the first level of the menu of the tray, in order, with "-" for a separator.
Flutter: no counterpart
func (*FakeDesktop) TrayProperty ¶
func (f *FakeDesktop) TrayProperty(name string) any
TrayProperty is a property of the tray icon (StatusNotifierItem), such as "Title", "Status" or "IconName"; it is nil when there is none.
Flutter: no counterpart
func (*FakeDesktop) TrayRegistered ¶
func (f *FakeDesktop) TrayRegistered() bool
TrayRegistered says whether a tray icon registered with the watcher.
Flutter: no counterpart
func (*FakeDesktop) WaitFor ¶
func (f *FakeDesktop) WaitFor(what string, cond func() bool)
WaitFor pumps the posted functions until cond is true, for what the app does on other goroutines (the calls of package desktop). It fails the test after five seconds.
Flutter: no counterpart
type FakeFileChooser ¶
type FakeFileChooser struct {
// Method is the method of the portal that the app called: "OpenFile" (desktop.OpenFiles),
// "SaveFile" or "SaveFiles".
Method string
// Title is the title of the dialog; empty for the portal's default.
Title string
// AcceptLabel is the text of the button that accepts the dialog; empty for the default.
AcceptLabel string
// Modal is false when the app asked for a dialog that leaves its window usable
// (NotModal).
Modal bool
// Multiple and Directory are the options of OpenFiles: more than one choice, and
// folders instead of files.
Multiple, Directory bool
// Filters are the kinds of file that the dialog offers, in order; CurrentFilter is the
// name of the one chosen when it opens, empty without filters.
Filters []desktop.FileFilter
CurrentFilter string
// CurrentFolder is the folder the dialog opens in; empty when the app gave none.
CurrentFolder string
// CurrentName and CurrentFile are the name and the path of the file that SaveFile
// starts with.
CurrentName, CurrentFile string
// Names are the names of the files of SaveFiles, in order.
Names []string
// Answered says that the test answered the dialog (AnswerFileChooser or
// CancelFileChooser).
Answered bool
}
FakeFileChooser is what the app asked of a file dialog (desktop.OpenFiles, SaveFile or SaveFiles), as the fake desktop's file chooser portal read it from the call.
Flutter: no counterpart
type FakeNotification ¶
type FakeNotification struct {
// ID is the number that the fake desktop gave the notification.
ID uint32
// AppName, Icon, Summary and Body are what the app sent.
AppName, Icon, Summary, Body string
// Actions are the buttons.
Actions []FakeNotificationAction
// Urgency is the urgency hint: 0 low, 1 normal, 2 critical.
Urgency byte
// Closed says that the app or the test closed it.
Closed bool
}
FakeNotification is a notification that the app showed to the fake desktop.
Flutter: no counterpart
type FakeNotificationAction ¶
type FakeNotificationAction struct {
// ID is the key that the app gave the action.
ID string
// Label is the text of the button.
Label string
}
FakeNotificationAction is a button of a FakeNotification.
Flutter: no counterpart
type FakeOpenURIAnswer ¶
type FakeOpenURIAnswer int
FakeOpenURIAnswer is how the fake desktop's OpenURI portal answers desktop.OpenURI (FakeDesktop.SetOpenURIAnswer).
Flutter: no counterpart
const ( // FakeOpenURIAnswerUnspecified is the default: the URI opens. // // Flutter: no counterpart FakeOpenURIAnswerUnspecified FakeOpenURIAnswer = iota // FakeOpenURIAnswerOpens opens the URI: desktop.OpenURI returns nil. // // Flutter: no counterpart FakeOpenURIAnswerOpens // FakeOpenURIAnswerCancelled is the user who closes the desktop's app chooser without // choosing: desktop.OpenURI returns nil, as for a URI that opens. // // Flutter: no counterpart FakeOpenURIAnswerCancelled // FakeOpenURIAnswerFails is a portal that could not open the URI: desktop.OpenURI tries // xdg-open, which a fake desktop never starts, and fails with OpenURIUnavailable, whose // metadata "portalTag" is OpenURIFailed. // // Flutter: no counterpart FakeOpenURIAnswerFails )
type FindOpts ¶
type FindOpts struct {
// IncludeOffstage also looks inside the widgets that are offstage; Flutter's
// skipOffstage: false.
IncludeOffstage bool
// FindRichText makes ByText and ByTextContaining also match RichText widgets,
// not only Text; Flutter's findRichText: true.
FindRichText bool
}
FindOpts are the optional parameters of the finders that look at every element.
Flutter: flutter_test/lib/src/finders.dart CommonFinders
type Finder ¶
type Finder interface {
// Describe says what the finder looks for, for the messages of a failure.
//
// Flutter: flutter_test/lib/src/finders.dart Finder.description
Describe() string
// Find returns the matching elements of the tree under test, in depth first
// order (a parent before its children, siblings in order).
//
// Flutter: flutter_test/lib/src/finders.dart Finder.evaluate
Find(t *Tester) []widgets.Element
}
Finder finds the elements of the tree under test that match some criterion. Make one with ByText, ByKey, ByType and the others of this file, combine them with Descendant and Ancestor, and give it to the methods of the Tester (Tap, Widget, Center) or to the matchers (FindsOneWidget). A finder looks at the tree each time it is used, so it can be made before the widget exists.
Flutter: flutter_test/lib/src/finders.dart Finder
func Ancestor ¶
func Ancestor(of, matching Finder, opts ...DescendantOpts) Finder
Ancestor finds the elements of the second finder that are above an element of the first (or are one, with MatchRoot), the closest first.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.ancestor
func At ¶
At is the match of the finder at the index, or nothing when there are not so many.
Flutter: flutter_test/lib/src/finders.dart FinderBase.at
func ByElementPredicate ¶
func ByElementPredicate(description string, fn func(e widgets.Element) bool, opts ...FindOpts) Finder
ByElementPredicate finds the elements for which the function is true.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.byElementPredicate
func ByIcon ¶
ByIcon finds the widgets that implement IconWidget and show this icon.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.byIcon
func ByKey ¶
func ByKey(key foundation.Key, opts ...FindOpts) Finder
ByKey finds the widgets that have the key.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.byKey
func ByPredicate ¶
ByPredicate finds the widgets for which the function is true. The description is used in the messages of a failure.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.byWidgetPredicate
func BySemanticsLabel ¶
BySemanticsLabel finds the elements whose render object has a semantics node with exactly this label. Ask for semantics with Tester.EnsureSemantics and pump a frame first. It reads RenderObjectBase.SemanticsNode, so it finds the same nodes in every build mode, a release build included.
Deviation: Flutter reads RenderObject.debugSemantics, which is null in a release build; Flutter's tests always run in debug mode (SPEC §12.10).
Flutter: flutter_test/lib/src/finders.dart CommonFinders.bySemanticsLabel
func BySemanticsLabelMatching ¶
BySemanticsLabelMatching is BySemanticsLabel with a regular expression.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.bySemanticsLabel
func ByText ¶
ByText finds the widgets that show exactly this text: those that implement TextWidget (Text, and RichText with FindRichText).
Flutter: flutter_test/lib/src/finders.dart CommonFinders.text
func ByTextContaining ¶
ByTextContaining finds the widgets that show a text with this substring.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.textContaining
func ByTooltip ¶
ByTooltip finds the widgets that implement TooltipWidget and have this message.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.byTooltip
func ByType ¶
ByType finds the widgets of the type T, such as ByType[*Button]().
Flutter: flutter_test/lib/src/finders.dart CommonFinders.byType
func ByWidget ¶
ByWidget finds the elements of this very widget (the same pointer).
Flutter: flutter_test/lib/src/finders.dart CommonFinders.byWidget
func Descendant ¶
func Descendant(of, matching Finder, opts ...DescendantOpts) Finder
Descendant finds the elements of the second finder that are below an element of the first (or are one, with MatchRoot).
Flutter: flutter_test/lib/src/finders.dart CommonFinders.descendant
func Everything ¶
Everything finds every element of the tree.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.everything
type Font ¶
type Font struct {
// Family is the family name that TextStyle.FontFamily uses. When empty, the
// family name inside the font is used.
Family string
// Data is the content of a TrueType or OpenType file.
Data []byte
}
Font is a font file for Opts.Fonts.
Flutter: services/font_loader.dart FontLoader
type GPURecorder ¶
GPURecorder is the GPU device of a tester made with Opts.GPU: a recording device that draws nothing and keeps the log of what the app asked of it, so that the widget tests of an app that uses package gpu (and, later, gpu.View and viewport3d) run with no GPU. A test checks what was encoded, not pixels. gpu.DeviceOf gives the app this device, from the start (a real renderer opens its device at the first frame).
Flutter: no counterpart
func (*GPURecorder) Calls ¶
func (r *GPURecorder) Calls() []string
Calls returns the calls the device received, oldest first, as "Op(args)".
Flutter: no counterpart
func (*GPURecorder) CompleteReads ¶
func (r *GPURecorder) CompleteReads()
CompleteReads finishes the reads and the submissions that wait for the GPU, as a GPU that caught up does: the functions of Buffer.Read and Queue.OnSubmittedWorkDone run on the next Pump.
Flutter: no counterpart
func (*GPURecorder) Device ¶
func (r *GPURecorder) Device() *fakedevice.Device
Device returns the recording device of the moment. After Lose it is the new one.
Flutter: no counterpart
func (*GPURecorder) EndApp ¶
func (r *GPURecorder) EndApp()
EndApp ends the app as the engine does when its windows are gone: the device is closed, which makes the gpu package report the resources that were not released, and the watchers are told. The tester does it when the test ends.
Flutter: no counterpart
func (*GPURecorder) Lose ¶
func (r *GPURecorder) Lose()
Lose loses the device, as a driver reset does, and opens a new one at once, as the renderer does (SPEC §9.4, §9.5). The app's gpu.Device is lost (its OnLost functions run on the next Pump) and gpu.DeviceOf gives the new one.
Flutter: no counterpart
func (*GPURecorder) Ops ¶
func (r *GPURecorder) Ops() []string
Ops returns the names of the calls, without their arguments.
Flutter: no counterpart
func (*GPURecorder) Reset ¶
func (r *GPURecorder) Reset()
Reset forgets the calls, so that a test checks the ones that follow.
Flutter: no counterpart
func (*GPURecorder) SupportTimestamps ¶
func (r *GPURecorder) SupportTimestamps(periodNanoseconds float64)
SupportTimestamps makes the device report Features.TimestampQuery with the period of one tick in nanoseconds. Call it before the app asks for the device.
Flutter: no counterpart
type GestureOpts ¶
type GestureOpts struct {
// Kind is the kind of device; the default is touch.
Kind ui.PointerDeviceKind
// Buttons are the buttons pressed; the default is the primary button.
Buttons foundation.Opt[int]
// Pointer is the ID of the pointer; the default is a new one each time.
Pointer int
// TouchSlopX and TouchSlopY are how far Drag and DragFrom move first, along
// each axis, so that the recognizers of drags win; the default is
// DragSlopDefault.
//
// Flutter: flutter_test/lib/src/controller.dart WidgetController.drag touchSlopX
TouchSlopX, TouchSlopY foundation.Opt[float64]
// View is the view the pointer is in; the default is the implicit view. The
// gestures that take a Finder use the view of the element it finds.
//
// Flutter: flutter_test/lib/src/controller.dart WidgetController.startGesture
View ui.ViewID
}
GestureOpts are the optional parameters of the gestures of the tester.
Flutter: flutter_test/lib/src/controller.dart WidgetController.startGesture
type IconWidget ¶
type IconWidget interface {
widgets.Widget
// IconValue is the icon the widget shows (an IconData).
IconValue() any
}
IconWidget is implemented by the Icon widget (step 7.7): ByIcon matches its IconValue with the icon it is given.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.byIcon
type KeyOpts ¶
type KeyOpts struct {
// Physical is the physical key; the default is the key of the same name as the
// logical key (services.PhysicalKeyOf), or none.
Physical services.PhysicalKeyboardKey
// Character is the text the key produces, for a key down or a repeat.
Character string
}
KeyOpts are the optional parameters of the key events of the tester.
Flutter: flutter_test/lib/src/event_simulation.dart simulateKeyDownEvent
type OffstageWidget ¶
type OffstageWidget interface {
widgets.Widget
// IsOffstage is whether the subtree is hidden.
IsOffstage() bool
}
OffstageWidget is implemented by a widget that hides its subtree from the finders, such as Offstage (step 7.6): the finders skip the subtree unless they are made with IncludeOffstage.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.skipOffstage
type Opts ¶
type Opts struct {
// Size is the size of the view in logical pixels; the default is 800x600,
// the size of flutter_test's view.
Size ui.Size
// DevicePixelRatio is the number of physical pixels per logical pixel; the
// default is 1.
DevicePixelRatio float64
// ViewPadding, ViewInsets and SystemGestureInsets are the areas that the system covers, in
// physical pixels (flutter_test's view.padding, view.viewInsets and view.systemGestureInsets).
// The padding that MediaQuery gives is ViewPadding minus ViewInsets. The default is none.
ViewPadding, ViewInsets, SystemGestureInsets ui.ViewPadding
// TextEngine lays out the text. The default has only the fonts bundled with
// Glutter, so that the text is the same on every machine.
TextEngine ui.ParagraphFactory
// Fonts are added to the text engine of the test, besides the bundled Roboto
// and Material Icons: a golden test can then show monospace text, or any text,
// the same on every machine. Like the fonts of RunAppOpts.Fonts, several fonts
// of one family make a family of weights and slants. The engine has no system
// fonts: a family that no font here has is drawn with Roboto. A font that fails
// to load fails the test, and Fonts together with TextEngine fails it too.
//
// Flutter: flutter_test/lib/src/binding.dart (FontLoader in a test)
Fonts []Font
// Debug are the debug flags; the default is a fresh set, all off.
Debug *widgets.DebugOptions
// Assets is the file system that the binding's asset bundle reads from, as RunAppOpts.Assets is
// for an app: a test of a widget that loads an asset with no bundle of its own (an image, an
// SVG picture) finds its files here. Without it the bundle finds nothing.
//
// Flutter: no counterpart (a test sets rootBundle with a DefaultAssetBundle)
Assets fs.FS
// DiscardScenes drops the scenes that the view renders instead of keeping them
// for Scenes and Screenshot: for benchmarks that run many frames.
//
// Flutter: no counterpart
DiscardScenes bool
// ErrorWidgetBuilder replaces the widget that is built for a widget that
// panicked in Build.
ErrorWidgetBuilder func(err error) widgets.Widget
// SpellChecker gives the fake platform a spell checker, the host side of
// services.DefaultSpellCheckService (ui.SpellCheckHost): it gets the language
// tag and the text and returns the misspelled ranges (UTF-8 byte offsets) with
// their suggestions. The answer arrives on the next Pump, as an engine's does.
// With nil, the platform has no spell checker, as Linux and the web have none.
//
// Flutter: flutter_test/lib/src/platform.dart TestPlatformDispatcher.nativeSpellCheckServiceDefinedTestValue
SpellChecker func(languageTag, text string) []ui.SpellCheckSpan
// GPU gives the fake platform a recording GPU device (Tester.GPUDevice), the device that gpu.DeviceOf returns, so
// that the test of an app that uses package gpu runs with no GPU. The device draws nothing and keeps the log of its
// calls. Without it the platform has no GPU device, as with the software renderer.
//
// Flutter: no counterpart
GPU bool
}
Opts are the optional parameters of New.
Flutter: flutter_test/lib/src/binding.dart TestWidgetsFlutterBinding
type PadRumble ¶
type PadRumble struct {
// Triggers says that the request was for the motors of the triggers.
Triggers bool
// LED says that the request was for the light, which Color holds as red, green and blue.
LED bool
Color [3]uint8
// Low and High (Left and Right for the triggers) are the strengths, from 0 to 65535.
Low, High uint16
Duration time.Duration
}
PadRumble is a request that the app made to a test pad to rumble or to set its light.
Flutter: no counterpart
type PadSpec ¶
type PadSpec struct {
// Name is the name of the pad; "Test Pad" when empty.
Name string
// GUID is the 32 hexadecimal digits that name the model of the pad, as a mapping line does; when empty it is made from Name.
GUID string
// Axes, Buttons and Hats make the pad a raw pad with that many raw inputs.
Axes, Buttons, Hats int
// Mapping is the mapping text ("a:b0,b:b1,...") the platform reports for a raw pad, which is used when the table of mappings
// has none for GUID.
Mapping string
// Rumble, RumbleTriggers and LED say what the pad can do.
Rumble, RumbleTriggers, LED bool
// Touchpads is the number of touchpads of the pad; TestPad.Touch moves fingers on them.
Touchpads int
// Sensors gives the pad a gyroscope and an accelerometer at 250 readings a second; TestPad.Sensor makes readings arrive, and
// the app gets them while one of the pad's sensors is open (Pad.OpenSensor).
Sensors bool
}
PadSpec describes a pad that a test connects with Tester.ConnectPad.
Without Axes, Buttons, Hats and Mapping the pad is a standard pad: it reports the buttons and axes of the standard layout as they are (TestPad.Press, TestPad.SetAxis). With any of them it is a raw pad, like the ones the platforms report: it has that many buttons, axes and hats, the pad manager finds its mapping from GUID (or takes Mapping), and the test drives the raw inputs (TestPad.RawButton and the like).
Flutter: no counterpart
type PumpAndSettleOpts ¶
type PumpAndSettleOpts struct {
// Duration is the time between the frames; the default is 100 ms.
Duration time.Duration
// Timeout is how much fake time to wait for the frames to stop; the default
// is 10 minutes.
Timeout time.Duration
}
PumpAndSettleOpts are the optional parameters of PumpAndSettle.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.pumpAndSettle
type PumpFramesOpts ¶
type PumpFramesOpts struct {
// Interval is the time between the frames; the default is 16.683 ms, a frame
// at 60 Hz.
Interval time.Duration
}
PumpFramesOpts are the optional parameters of PumpFrames.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.pumpFrames
type PumpWidgetOpts ¶
type PumpWidgetOpts struct {
// Duration is how far to advance the clock before the frame; see Pump.
Duration time.Duration
// NoView says not to wrap the widget in a View for the view of the tester
// (Flutter's wrapWithView: false); the widget must be or contain one.
NoView bool
}
PumpWidgetOpts are the optional parameters of PumpWidget.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.pumpWidget
type TB ¶
type TB interface {
Helper()
Errorf(format string, args ...any)
Fatalf(format string, args ...any)
Fatal(args ...any)
Logf(format string, args ...any)
Cleanup(func())
}
TB is the part of testing.TB that gluttertest needs. *testing.T and *testing.B implement it; gluttertest's own tests give a fake one to see how a test fails.
Flutter: no counterpart
type TestAudio ¶
type TestAudio struct {
// contains filtered or unexported fields
}
TestAudio is the scripted audio service of the test platform (SPEC §28.8): it has a speaker and a microphone, which are the default devices, and a test adds and removes devices and plays the part of the audio thread: it pulls frames from the playback device that the app opened, or pushes frames into a capture device, and the app's streams run in the test's goroutine as they would on the backend's thread. Nothing plays by itself, so the test decides when and for how long.
Flutter: no counterpart
func (*TestAudio) AddDevice ¶
func (a *TestAudio) AddDevice(info audio.DeviceInfo)
AddDevice plugs in a device, as the system reports it; a device with Default set becomes the default of its kind. The listeners of audio.System have run when it returns.
Flutter: no counterpart
func (*TestAudio) Capture ¶
func (a *TestAudio) Capture() *TestAudioDevice
Capture returns the first capture device that the app has open, and fails the test when there is none.
Flutter: no counterpart
func (*TestAudio) Devices ¶
func (a *TestAudio) Devices() []*TestAudioDevice
Devices returns the devices that the app has open now, in the order it opened them.
Flutter: no counterpart
func (*TestAudio) FailOpen ¶
FailOpen makes the next opens fail with err; nil makes them work again.
Flutter: no counterpart
func (*TestAudio) Open ¶
func (a *TestAudio) Open(ctx context.Context, kind audio.DeviceKind, opts platform.AudioOpenOptions, h platform.AudioHandler) (platform.AudioDevice, error)
Open is for tests of the platform side: it opens a device the way a backend's client does, without the audio package. Most tests open devices through audio.System instead.
Flutter: no counterpart
func (*TestAudio) Playback ¶
func (a *TestAudio) Playback() *TestAudioDevice
Playback returns the first playback device that the app has open, and fails the test when there is none.
Flutter: no counterpart
func (*TestAudio) RemoveDevice ¶
RemoveDevice unplugs a device: an open device of it is lost. The listeners have run when it returns.
Flutter: no counterpart
func (*TestAudio) SetDefault ¶
SetDefault makes a device the default of its kind. The listeners have run when it returns.
Flutter: no counterpart
func (*TestAudio) SetUnavailable ¶
SetUnavailable makes the platform act as one whose audio server does not run: the lists are empty and the opens fail with AudioUnavailable.
Flutter: no counterpart
type TestAudioDevice ¶
type TestAudioDevice struct {
// contains filtered or unexported fields
}
TestAudioDevice is a device that the app opened, seen from the side of the backend.
Flutter: no counterpart
func (*TestAudioDevice) BufferFrames ¶
func (d *TestAudioDevice) BufferFrames() int
BufferFrames and PauseInBackground are what the app asked for when it opened the device.
Flutter: no counterpart
func (*TestAudioDevice) Format ¶
func (d *TestAudioDevice) Format() audio.Format
Format is the format that the device works in.
Flutter: no counterpart
func (*TestAudioDevice) ID ¶
func (d *TestAudioDevice) ID() string
ID is the ID of the system's device that the app opened.
Flutter: no counterpart
func (*TestAudioDevice) Lose ¶
func (d *TestAudioDevice) Lose()
Lose makes the device lost, as when it is unplugged. The listeners have run when it returns.
Flutter: no counterpart
func (*TestAudioDevice) PauseInBackground ¶
func (d *TestAudioDevice) PauseInBackground() bool
PauseInBackground says whether the app asked for the device to pause when it is hidden.
Flutter: no counterpart
func (*TestAudioDevice) Pull ¶
func (d *TestAudioDevice) Pull(frames, chunk int) []float32
Pull runs the audio thread's callback of a playback device for frames frames, in pieces of at most chunk frames (0 for one piece), and returns what it played, interleaved. A device that is paused, suspended or lost plays silence.
Flutter: no counterpart
func (*TestAudioDevice) PullInto ¶
func (d *TestAudioDevice) PullInto(out []float32)
PullInto does the same for len(out)/channels frames into out, without allocating.
Flutter: no counterpart
func (*TestAudioDevice) Push ¶
func (d *TestAudioDevice) Push(frames []float32)
Push gives the streams of a capture device the frames that it recorded, interleaved in the device's format.
Flutter: no counterpart
func (*TestAudioDevice) Suspend ¶
func (d *TestAudioDevice) Suspend()
Suspend makes the device wait for the user, as a browser's does; Unsuspend lets it run. The listeners have run when they return.
Flutter: no counterpart
func (*TestAudioDevice) Unsuspend ¶
func (d *TestAudioDevice) Unsuspend()
Unsuspend lets a suspended device run.
Flutter: no counterpart
type TestGesture ¶
type TestGesture struct {
// contains filtered or unexported fields
}
TestGesture is a pointer that the test moves: it sent a down event when it was created and sends the moves, the up or the cancel when the test calls them. The events carry the time of the fake clock.
Flutter: flutter_test/lib/src/test_pointer.dart TestGesture
func (*TestGesture) Cancel ¶
func (g *TestGesture) Cancel()
Cancel cancels the pointer, as the system does when it takes the touch away. As with Up, the event has no button down.
Flutter: flutter_test/lib/src/test_pointer.dart TestGesture.cancel
func (*TestGesture) Down ¶
func (g *TestGesture) Down(at ui.Offset)
Down presses the pointer again at the position, after Up or Cancel. A mouse that Up removed is added again first.
Flutter: flutter_test/lib/src/test_pointer.dart TestGesture.down
func (*TestGesture) MoveBy ¶
func (g *TestGesture) MoveBy(by ui.Offset)
MoveBy moves the pressed pointer by the offset.
Flutter: flutter_test/lib/src/test_pointer.dart TestGesture.moveBy
func (*TestGesture) MoveByAt ¶
func (g *TestGesture) MoveByAt(by ui.Offset, timeStamp time.Duration)
MoveByAt moves the pressed pointer by the offset with the event time stamp set to timeStamp (since the start of the test), instead of the time of the fake clock. The next events keep the time stamp until another call sets it.
Flutter: flutter_test/lib/src/test_pointer.dart TestGesture.moveBy timeStamp
func (*TestGesture) MoveTo ¶
func (g *TestGesture) MoveTo(to ui.Offset)
MoveTo moves the pressed pointer to the position.
Flutter: flutter_test/lib/src/test_pointer.dart TestGesture.moveTo
func (*TestGesture) Position ¶
func (g *TestGesture) Position() ui.Offset
Position is where the pointer is.
Flutter: flutter_test/lib/src/test_pointer.dart TestPointer.location
func (*TestGesture) Up ¶
func (g *TestGesture) Up()
Up releases the pointer. The release has no button down, whatever the buttons of the press were, as on every platform; a test that wants other buttons on the release sends the event itself.
Flutter: flutter_test/lib/src/test_pointer.dart TestGesture.up
type TestPad ¶
type TestPad struct {
// contains filtered or unexported fields
}
TestPad is a pad that a test connected. Its methods report to the app as the platform would: on the UI thread, in order, and the app's listeners and key handlers have run when they return.
Flutter: no counterpart
func (*TestPad) Disconnect ¶
func (p *TestPad) Disconnect()
Disconnect unplugs the pad.
Flutter: no counterpart
func (*TestPad) Pad ¶
Pad returns the pad as the app sees it, or nil when the pad has no mapping (it is not a gamepad) or is disconnected.
Flutter: no counterpart
func (*TestPad) Press ¶
Press presses the button of the standard layout. On a raw pad it presses the raw button that the pad's mapping gives the button, and fails the test when there is none.
Flutter: no counterpart
func (*TestPad) RawAxis ¶
RawAxis moves the raw axis i of a raw pad to v, from −32768 to 32767.
Flutter: no counterpart
func (*TestPad) RawButton ¶
RawButton presses or releases the raw button i of a raw pad.
Flutter: no counterpart
func (*TestPad) RawHat ¶
RawHat sets the raw hat i of a raw pad to a mask of 1 (up), 2 (right), 4 (down) and 8 (left).
Flutter: no counterpart
func (*TestPad) Release ¶
Release lets go of the button of the standard layout.
Flutter: no counterpart
func (*TestPad) Rumbles ¶
Rumbles returns what the app asked the pad to do with its motors and its light, in order.
Flutter: no counterpart
func (*TestPad) Sensor ¶
Sensor makes a reading of one of the pad's sensors arrive: the gyroscope in rad/s or the accelerometer in m/s², on the pad's axes. The app gets it only while a sensor of the pad is open.
Flutter: no counterpart
func (*TestPad) SensorsOn ¶
SensorsOn says whether the app has turned the pad's sensors on.
Flutter: no counterpart
func (*TestPad) SetAxis ¶
SetAxis moves an axis of the standard layout: from −1 to 1, from 0 to 1 for a trigger. It is for standard pads.
Flutter: no counterpart
func (*TestPad) SetBattery ¶
SetBattery makes the pad report its battery: the charge from 0 to 1, and whether it is being charged.
Flutter: no counterpart
type TestSensor ¶
type TestSensor struct {
// contains filtered or unexported fields
}
TestSensor is a sensor that the app opened, seen from the side of the backend.
Flutter: no counterpart
func (*TestSensor) Closed ¶
func (s *TestSensor) Closed() bool
Closed says whether the app closed the sensor.
Flutter: no counterpart
func (*TestSensor) Rate ¶
func (s *TestSensor) Rate() float64
Rate is what the app asked for, or 60.
Flutter: no counterpart
func (*TestSensor) RequestedRate ¶
func (s *TestSensor) RequestedRate() float64
RequestedRate is the rate that the app asked for when it opened the sensor, 0 for none.
Flutter: no counterpart
func (*TestSensor) Send ¶
func (s *TestSensor) Send(readings ...sensors.Reading)
Send makes readings arrive, as the backend's thread would send them. The app's listeners are called by the next Pump.
Flutter: no counterpart
func (*TestSensor) SendValues ¶
func (s *TestSensor) SendValues(at time.Duration, x, y, z float64)
SendValues makes one reading arrive at the time given (counted from any start).
Flutter: no counterpart
type TestSensors ¶
type TestSensors struct {
// contains filtered or unexported fields
}
TestSensors is the scripted motion sensors service of the test platform (SPEC §28.8): the device has an accelerometer and a gyroscope, and a test plays the part of the sensor thread by sending readings to the sensor that the app opened. The app's listeners get them in the next frame (Pump), as they would on a phone. Nothing arrives by itself.
Flutter: no counterpart
func (*TestSensors) Count ¶
func (s *TestSensors) Count() int
Count is how many sensors the app has open now.
Flutter: no counterpart
func (*TestSensors) FailOpen ¶
func (s *TestSensors) FailOpen(err error)
FailOpen makes the next opens fail with err; nil makes them work again.
Flutter: no counterpart
func (*TestSensors) Open ¶
func (s *TestSensors) Open(kind sensors.Kind) *TestSensor
Open returns the first open sensor of the kind that the app has, and fails the test when there is none.
Flutter: no counterpart
func (*TestSensors) SetAvailable ¶
func (s *TestSensors) SetAvailable(kind sensors.Kind, available bool)
SetAvailable says whether the device has a sensor of the kind (both are there at the start).
Flutter: no counterpart
type TestTrackpadGesture ¶
type TestTrackpadGesture struct {
// contains filtered or unexported fields
}
TestTrackpadGesture is a pan/zoom gesture of a trackpad that the test updates: it sent a pan/zoom start event when it was created and sends the updates or the end when the test calls them.
Flutter: flutter_test/lib/src/test_pointer.dart TestPointer.panZoomStart
func (*TestTrackpadGesture) End ¶
func (g *TestTrackpadGesture) End()
End ends the gesture.
Flutter: flutter_test/lib/src/test_pointer.dart TestPointer.panZoomEnd
func (*TestTrackpadGesture) PanBy ¶
func (g *TestTrackpadGesture) PanBy(by ui.Offset)
PanBy pans the gesture by the offset from where it is.
Flutter: flutter_test/lib/src/test_pointer.dart TestPointer.panZoomUpdate
type TestWindow ¶
type TestWindow struct {
// View is the view of the window.
View ui.ViewID
// Spec is what the app asked for.
Spec ui.WindowSpec
// Title is the last title the app set; the one it asked for until then.
Title string
// Size is the last content size the app asked for, in logical pixels.
Size ui.Size
// Min and Max are the last limits the app set on the content size; zero is no
// limit.
Min, Max ui.Size
// Destroyed is whether the app destroyed the window.
Destroyed bool
// Hidden is whether the app hid the window.
Hidden bool
}
TestWindow is a window that the app asked the fake platform for.
Flutter: no counterpart
type Tester ¶
type Tester struct {
// Binding is the widgets binding of the app under test.
Binding *widgets.WidgetsBinding
// Clock is the fake clock. Pump moves it; the timers of the recognizers and
// of the image cache run when it passes them.
Clock *fakeclock.Fake
// View is the implicit view of the platform.
View *ui.View
// contains filtered or unexported fields
}
Tester is a widgets binding on a fake platform with one view, a fake clock and the software renderer. It stands for flutter_test's WidgetTester and the binding under it.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester
func New ¶
New creates a tester. It fails the test, when the test ends, if the framework reported an error that the test did not take (TakeError).
Flutter: flutter_test/lib/src/binding.dart TestWidgetsFlutterBinding.ensureInitialized
func (*Tester) ActivatedCursors ¶
func (t *Tester) ActivatedCursors() []CursorActivation
ActivatedCursors are the system mouse cursors that the framework asked the platform to show, in order.
Flutter: no counterpart (the log of a mock handler of SystemChannels.mouseCursor)
func (*Tester) Audio ¶
Audio returns the scripted audio service of the tester.
Flutter: no counterpart
func (*Tester) BottomRight ¶
BottomRight is the position of the bottom right corner of the one widget the finder finds.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetController.getBottomRight
func (*Tester) CancelBackGesture ¶
func (t *Tester) CancelBackGesture()
CancelBackGesture plays the system ending a predictive back gesture without a pop, through PlatformDispatcher.CancelBackGesture. It does not pump.
Flutter: widgets/binding.dart WidgetsBinding._handleCancelBackGesture (the cancelBackGesture call of the flutter/backgesture channel)
func (*Tester) Center ¶
Center is the position of the center of the one widget the finder finds, in logical pixels of the view.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetController.getCenter
func (*Tester) ClearClipboard ¶
func (t *Tester) ClearClipboard()
ClearClipboard empties the fake system clipboard.
Flutter: no counterpart (MockClipboard.clipboardData = null)
func (*Tester) ClearLogs ¶
func (t *Tester) ClearLogs()
ClearLogs forgets what the fake platform keeps of what the app asked of it: the text input states, the cursor activations, the window and view actions, the focus events, the drags, the semantics updates and the windows that the app destroyed. A test that runs the app for many steps and measures its memory calls it, so that the log of the fake platform is not counted as the memory of the app.
Flutter: no counterpart
func (*Tester) ClipboardHTML ¶
ClipboardHTML is the fragment of HTML on the fake system clipboard, or "".
Flutter: no counterpart
func (*Tester) ClipboardPNG ¶
ClipboardPNG is the image on the fake system clipboard, or nil.
Flutter: no counterpart
func (*Tester) ClipboardText ¶
ClipboardText is the text on the fake system clipboard, and whether there is any. The framework's Clipboard calls use it.
Flutter: no counterpart (the state of flutter_test's MockClipboard)
func (*Tester) ClipboardURIs ¶
ClipboardURIs are the URIs on the fake system clipboard, or nil.
Flutter: no counterpart
func (*Tester) ClosePlatformMenu ¶
ClosePlatformMenu closes the menu of the menu bar with the id: its OnClose runs.
Flutter: no counterpart
func (*Tester) CommitBackGesture ¶
func (t *Tester) CommitBackGesture()
CommitBackGesture plays the system ending a predictive back gesture with a pop, through PlatformDispatcher.CommitBackGesture. It does not pump.
Flutter: widgets/binding.dart WidgetsBinding._handleCommitBackGesture (the commitBackGesture call of the flutter/backgesture channel)
func (*Tester) ConnectPad ¶
ConnectPad connects a pad, the way a platform reports a pad that is plugged in, and runs what that posts.
Flutter: no counterpart
func (*Tester) Count ¶
Count is how many elements the finder finds.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetController.any
func (*Tester) Dispatcher ¶
func (t *Tester) Dispatcher() *ui.PlatformDispatcher
Dispatcher is the platform dispatcher of the app: the test calls it as the platform would (for the lifecycle state, the close request, the keys).
Flutter: flutter_test/lib/src/binding.dart TestWidgetsFlutterBinding.platformDispatcher
func (*Tester) Drag ¶
func (t *Tester) Drag(f Finder, by ui.Offset, opts ...GestureOpts)
Drag drags from the center of the one element the finder finds by the offset.
Flutter: flutter_test/lib/src/controller.dart WidgetController.drag
func (*Tester) DragFrom ¶
func (t *Tester) DragFrom(at, by ui.Offset, opts ...GestureOpts)
DragFrom presses a pointer at the position and moves it by the offset, first by the slop (so that the recognizers of drags win), then by the rest, and releases it.
Flutter: flutter_test/lib/src/controller.dart WidgetController.dragFrom
func (*Tester) Drags ¶
func (t *Tester) Drags() []ui.DragRequest
Drags are the drag and drop operations the app started, in order.
Flutter: no counterpart
func (*Tester) Drop ¶
func (t *Tester) Drop(view ui.ViewID, phase ui.DropPhase, at ui.Offset, event ui.DropEvent) ui.DropActions
Drop plays a drag and drop operation of another application (or of the platform) over a view, and returns the action the framework accepts: the way the platform delivers the enter, move, leave and drop events. The position is in logical pixels of the view; the event has it in physical pixels.
Flutter: no counterpart
func (*Tester) Elapsed ¶
Elapsed is how much fake time has passed since the tester was made.
Flutter: flutter_test/lib/src/binding.dart AutomatedTestWidgetsFlutterBinding.clock
func (*Tester) Element ¶
Element is the one element the finder finds. The test fails with the tag FinderNoMatch when there is none, and FinderManyMatches when there are more than one.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetController.element
func (*Tester) Elements ¶
Elements are the elements the finder finds in the tree under test.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetController.elementList
func (*Tester) EndPointerLock ¶
EndPointerLock ends the lock of the window of the view as the platform does when the compositor or the browser ends it, or the window loses the focus: the app's listeners are told. It does nothing when the view is not locked.
Flutter: no counterpart
func (*Tester) EnsureSemantics ¶
func (t *Tester) EnsureSemantics() *semantics.SemanticsHandle
EnsureSemantics asks for semantics until the handle is disposed; pump a frame before looking for a semantics label. Test cleanup disposes the handle if the test did not.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.ensureSemantics
func (*Tester) EnterText ¶
EnterText types the text into the text field the finder finds: the field gets the focus, and its text becomes the text, with the caret at the end, as if the input method had sent the new value.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.enterText
func (*Tester) Errors ¶
Errors are the errors that were reported and not taken, oldest first.
Flutter: no counterpart
func (*Tester) Exists ¶
Exists is whether the finder finds anything.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetController.any
func (*Tester) ExitRequests ¶
ExitRequests is how many times the app asked the platform to exit the application (WidgetsBinding.ExitApplication with the fake platform).
Flutter: no counterpart
func (*Tester) FailDrags ¶
FailDrags makes the fake platform refuse to start drags with err, as a platform that cannot.
Flutter: no counterpart
func (*Tester) FailKeepScreenOn ¶
FailKeepScreenOn makes the fake platform refuse to keep the screen on with err, as a platform that cannot.
Flutter: no counterpart
func (*Tester) FailPointerLock ¶
FailPointerLock makes the fake platform refuse to lock the pointer with err (ui.TagPointerLockUnavailable or ui.TagPointerLockDenied errors, as a platform that cannot or will not); nil makes it lock again.
Flutter: no counterpart
func (*Tester) FakeDesktop ¶
func (t *Tester) FakeDesktop() *FakeDesktop
FakeDesktop installs a fake desktop in the app and returns it, in place of the desktop of every platform (desktop.InstallBus). Call it before the app first uses package desktop (before the SystemTray is pumped).
Flutter: no counterpart
func (*Tester) Fling ¶
Fling flings from the center of the one element the finder finds.
Flutter: flutter_test/lib/src/controller.dart WidgetController.fling
func (*Tester) FlingFrom ¶
func (t *Tester) FlingFrom(at, by ui.Offset, speed float64, opts ...GestureOpts)
FlingFrom presses a pointer at the position and moves it by the offset in 50 steps at the speed (logical pixels per second), pumping between the steps so that the velocity the recognizers measure is the speed, then releases it.
Flutter: flutter_test/lib/src/controller.dart WidgetController.flingFrom
func (*Tester) FlushPosted ¶
func (t *Tester) FlushPosted()
FlushPosted runs the functions that were posted to the UI thread (by State.Go, for one) without running a frame.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.idle
func (*Tester) FocusEvents ¶
func (t *Tester) FocusEvents() []ui.ViewFocusEvent
FocusEvents are the focus changes that the app asked the platform for, in order, with the direction: what Flutter's TestPlatformDispatcher.testFocusEvents has.
Flutter: flutter_test/lib/src/platform.dart TestPlatformDispatcher.testFocusEvents
func (*Tester) FocusRequests ¶
FocusRequests are the views that the app asked the platform to focus, in order.
Flutter: no counterpart
func (*Tester) GPUDevice ¶
func (t *Tester) GPUDevice() *GPURecorder
GPUDevice returns the recording GPU device of the tester; nil when Opts.GPU was not set. Without it the app has no GPU device, as with the software renderer: gpu.DeviceOf fails with GPUUnavailable.
Flutter: no counterpart
func (*Tester) Hover ¶
Hover moves a mouse to the position without pressing it; the first hover adds the mouse.
Flutter: flutter_test/lib/src/test_pointer.dart TestPointer.hover
func (*Tester) LongPress ¶
func (t *Tester) LongPress(f Finder, opts ...GestureOpts)
LongPress long-presses the center of the one element the finder finds.
Flutter: flutter_test/lib/src/controller.dart WidgetController.longPress
func (*Tester) LongPressAt ¶
func (t *Tester) LongPressAt(at ui.Offset, opts ...GestureOpts)
LongPressAt presses a pointer at the position, lets enough fake time pass for a long press to be recognized, and releases it. It pumps while it waits.
Flutter: flutter_test/lib/src/controller.dart WidgetController.longPressAt
func (*Tester) MatchesGolden ¶
MatchesGolden compares the view, as the last frame drew it, with the golden image testdata/goldens/<name>.png of the package under test. Run the tests with -update-goldens to write the image, and look at every golden that changed (CLAUDE.md).
Flutter: flutter_test/lib/src/matchers.dart matchesGoldenFile
func (*Tester) MoveLockedMouse ¶
MoveLockedMouse sends the motion of a mouse whose pointer is locked: a hover (a move while a button is down) that keeps the position the mouse had and carries delta, in logical pixels, as the platforms report it. Hover first, to put the mouse where the lock began.
Flutter: no counterpart
func (*Tester) NoPlatformMenuBar ¶
func (t *Tester) NoPlatformMenuBar()
NoPlatformMenuBar makes the fake platform one without a menu bar, as Linux and Windows are: setting the menus does nothing.
Flutter: no counterpart
func (*Tester) OpenPlatformMenu ¶
OpenPlatformMenu opens the menu of the menu bar with the id, as the user does: its OnOpen runs.
Flutter: no counterpart
func (*Tester) PadExtrasWoken ¶
PadExtrasWoken says how many times the extras of the fake gamepad service were woken: the first use of package gamepad in the tree's binding wakes them once, as it wakes the HID drivers of a real service (SPEC §28.2, "Decided in step 36.1").
Flutter: no counterpart
func (*Tester) PlatformMenuSets ¶
PlatformMenuSets is how many times the app set the menus of the menu bar: a PlatformMenuBar that did not change does not set them again.
Flutter: no counterpart
func (*Tester) PlatformMenus ¶
func (t *Tester) PlatformMenus() []ui.PlatformMenuItemData
PlatformMenus are the menus that the app last put in the menu bar of the fake platform (a PlatformMenuBar): the top-level items, each with its children, in the form that goes to the platform. It is empty when the app has none.
Flutter: no counterpart
func (*Tester) PointerLocked ¶
PointerLocked says whether the app locked the pointer to the window of the view and the lock has not ended.
Flutter: no counterpart
func (*Tester) PopRoute ¶
func (t *Tester) PopRoute()
PopRoute plays the system asking the app to go back with no gesture (the back button of an old Android), through PlatformDispatcher.PopRoute. It does not pump.
Flutter: widgets/binding.dart WidgetsBinding.handlePopRoute (the popRoute call of the flutter/navigation channel)
func (*Tester) PrimaryText ¶
PrimaryText is the text on the fake primary selection, and whether there is any. Selecting text in a text field puts it there.
Flutter: no counterpart
func (*Tester) Pump ¶
Pump advances the fake clock by the duration (if there is one), then runs one frame at the new time if a frame is scheduled, and the work that was posted to the UI thread (also between the begin and the draw phase of the frame, like the microtasks of flutter_test). The timers that come due while the clock advances run first.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.pump
func (*Tester) PumpAndSettle ¶
func (t *Tester) PumpAndSettle(opts ...PumpAndSettleOpts) int
PumpAndSettle pumps frames, Duration apart, until no frame is scheduled anymore, and returns how many times it pumped. If frames are still scheduled after Timeout of fake time the test fails with the tag PumpAndSettleTimeout.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.pumpAndSettle
func (*Tester) PumpFrame ¶
PumpFrame is Pump for a caller that is the UI thread already (the goroutine that made the tester, or the last one that called Pump): it does not look for the calling goroutine, which costs an allocation, so that a benchmark measures the frame and not the harness.
Flutter: no counterpart
func (*Tester) PumpFrames ¶
PumpFrames pumps the widget, then frames Interval apart until maxDuration of fake time has passed. It is for animations that are watched frame by frame.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.pumpFrames
func (*Tester) PumpWidget ¶
func (t *Tester) PumpWidget(w widgets.Widget, opts ...PumpWidgetOpts)
PumpWidget makes the widget the root of the app, in a View for the view of the tester, and pumps a frame. Calling it again replaces the widget.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.pumpWidget
func (*Tester) RenderObject ¶
func (t *Tester) RenderObject(f Finder) rendering.RenderObject
RenderObject is the render object of the one element the finder finds.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetController.renderObject
func (*Tester) RequestWindowClose ¶
RequestWindowClose tells the framework, as the platform would, that the user asked to close the window of the view. It reports whether the platform would close the window: false when the delegate of the controller took the request, or the app answered the request to exit with a cancel.
Flutter: no counterpart
func (*Tester) RequestWindowCloseFor ¶
RequestWindowCloseFor is RequestWindowClose for a reason: the app's Quit or the end of the session ask each window as macOS does, and the app reads the reason with ui.PlatformDispatcher.ExitRequestReason while it answers.
Flutter: no counterpart
func (*Tester) ResetFocusEvents ¶
func (t *Tester) ResetFocusEvents()
ResetFocusEvents forgets the focus changes that FocusEvents has.
Flutter: flutter_test/lib/src/platform.dart TestPlatformDispatcher.resetFocusedViewTestValues
func (*Tester) RunReleaseHooks ¶
func (t *Tester) RunReleaseHooks()
RunReleaseHooks runs what the platform's host runs when the app ends: the audio devices that the app left open are closed. The tester runs it itself when the test ends; a test calls it to look at the app after that.
Flutter: no counterpart
func (*Tester) Scenes ¶
Scenes are the scenes that the view rendered, one for each frame that was composited.
Flutter: no counterpart
func (*Tester) ScreenKeptOn ¶
ScreenKeptOn is whether the app asked to keep the screen on for the view.
Flutter: no counterpart
func (*Tester) Screenshot ¶
Screenshot renders the last scene with the software renderer, in physical pixels. It fails the test when no frame was composited yet.
Flutter: flutter_test/lib/src/matchers.dart matchesGoldenFile
func (*Tester) Scroll ¶
Scroll scrolls the wheel over the center of the one element the finder finds.
Flutter: flutter_test/lib/src/controller.dart WidgetController.scroll
func (*Tester) ScrollAt ¶
ScrollAt sends a scroll event of a mouse wheel at the position, as the system does for one notch or a trackpad scroll, and pumps nothing.
Flutter: flutter_test/lib/src/controller.dart WidgetController.sendEventToBinding / TestPointer.scroll
func (*Tester) ScrollKindAt ¶
func (t *Tester) ScrollKindAt(kind ui.PointerDeviceKind, at, delta ui.Offset)
ScrollKindAt is ScrollAt for a device of another kind, such as a trackpad. Each kind has one pointer of its own, which stays for the life of the tester.
Flutter: flutter_test/lib/src/test_pointer.dart TestPointer.scroll
func (*Tester) SelectPlatformMenuItem ¶
SelectPlatformMenuItem chooses the item of the menu bar with the id, as the user does: the app's callback or intent runs. It does nothing without menus.
Flutter: no counterpart
func (*Tester) SemanticsUpdates ¶
func (t *Tester) SemanticsUpdates() []*ui.SemanticsUpdate
SemanticsUpdates are the semantics updates that the views sent to the engine, oldest first, as an accessibility bridge gets them. Ask for semantics first (EnsureSemantics) and pump a frame.
Flutter: no counterpart (the embedder's side of the semantics update)
func (*Tester) SendKeyDownEvent ¶
func (t *Tester) SendKeyDownEvent(logical services.LogicalKeyboardKey, opts ...KeyOpts) bool
SendKeyDownEvent sends a key down for the logical key and returns whether something handled it.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.sendKeyDownEvent
func (*Tester) SendKeyEvent ¶
func (t *Tester) SendKeyEvent(logical services.LogicalKeyboardKey, opts ...KeyOpts) bool
SendKeyEvent sends a key down and a key up for the logical key and returns whether the down was handled.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.sendKeyEvent
func (*Tester) SendKeyRepeatEvent ¶
func (t *Tester) SendKeyRepeatEvent(logical services.LogicalKeyboardKey, opts ...KeyOpts) bool
SendKeyRepeatEvent sends a key repeat for the logical key and returns whether something handled it.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.sendKeyRepeatEvent
func (*Tester) SendKeyUpEvent ¶
func (t *Tester) SendKeyUpEvent(logical services.LogicalKeyboardKey, opts ...KeyOpts) bool
SendKeyUpEvent sends a key up for the logical key and returns whether something handled it.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.sendKeyUpEvent
func (*Tester) SendOpenRequest ¶
func (t *Tester) SendOpenRequest(request ui.OpenRequest)
SendOpenRequest tells the app, as macOS would, that the system asks it to open URLs or files: a click on a link of a scheme the app handles, a double click on a document of its type. The listeners of ui.PlatformDispatcher.AddOpenRequestListener get it; a request sent before the app listens waits for its first listener, as the one that starts an app does.
Flutter: no counterpart
func (*Tester) SendTextInputEvent ¶
func (t *Tester) SendTextInputEvent(event ui.TextInputEvent)
SendTextInputEvent plays the input method: it asks the focused text field for a change (a commit, a preedit, a deletion), and runs what that posted.
Flutter: flutter_test/lib/src/test_text_input.dart TestTextInput.updateEditingValue
func (*Tester) Sensors ¶
func (t *Tester) Sensors() *TestSensors
Sensors returns the scripted sensors service of the tester.
Flutter: no counterpart
func (*Tester) SetClipboardHTML ¶
SetClipboardHTML puts a fragment of HTML on the fake system clipboard, as another application would.
Flutter: no counterpart
func (*Tester) SetClipboardPNG ¶
SetClipboardPNG puts an image on the fake system clipboard, as another application would.
Flutter: no counterpart
func (*Tester) SetClipboardText ¶
SetClipboardText puts text on the fake system clipboard, as another application would.
Flutter: no counterpart (MockClipboard.clipboardData)
func (*Tester) SetClipboardURIs ¶
SetClipboardURIs puts URIs (such as copied files) on the fake system clipboard, as another application would.
Flutter: no counterpart
func (*Tester) SetDevicePixelRatio ¶
SetDevicePixelRatio changes the pixel ratio of the view, keeping its logical size.
Flutter: flutter_test/lib/src/window.dart TestFlutterView.devicePixelRatio
func (*Tester) SetLifecycleState ¶
func (t *Tester) SetLifecycleState(state ui.AppLifecycleState)
SetLifecycleState tells the framework that the app lifecycle state changed, as the platform would.
Flutter: flutter_test/lib/src/binding.dart TestWidgetsFlutterBinding.handleAppLifecycleStateChanged
func (*Tester) SetPlatformConfiguration ¶
func (t *Tester) SetPlatformConfiguration(change func(c *ui.PlatformConfiguration))
SetPlatformConfiguration changes the system settings (locales, text scale, brightness, accessibility features) with the function and tells the framework.
Flutter: flutter_test/lib/src/window.dart TestPlatformDispatcher
func (*Tester) SetPrimaryText ¶
SetPrimaryText puts text on the fake primary selection, as another application would.
Flutter: no counterpart
func (*Tester) SetViewConfiguration ¶
func (t *Tester) SetViewConfiguration(change func(c *ui.ViewConfiguration))
SetViewConfiguration changes the configuration of the view with the function, from the current one (sizes in physical pixels), and tells the framework.
Flutter: flutter_test/lib/src/window.dart TestFlutterView
func (*Tester) SetViewFocus ¶
SetViewFocus tells the framework, as the platform would, that the keyboard focus moved into the view (true), or out of it, from the direction (undefined by default).
Flutter: no counterpart
func (*Tester) SetViewSize ¶
SetViewSize changes the size of the view, in logical pixels, and tells the framework as the platform would; the next Pump lays out again.
Flutter: flutter_test/lib/src/window.dart TestFlutterView.physicalSize
func (*Tester) SetWindowCreateError ¶
SetWindowCreateError makes the platform fail to create windows with the error, or, with nil, create them again.
Flutter: no counterpart
func (*Tester) SetWindowInfo ¶
func (t *Tester) SetWindowInfo(view ui.ViewID, info ui.WindowInfo)
SetWindowInfo tells the framework, as the platform would, what it now knows of the window of the view: who draws the title bar, and whether the window is maximized, fullscreen or activated.
Flutter: no counterpart
func (*Tester) SetWindowSize ¶
SetWindowSize tells the framework, as the platform would, that the content of the window of the view now has the size, in logical pixels.
Flutter: no counterpart
func (*Tester) ShowKeyboard ¶
func (t *Tester) ShowKeyboard(f Finder) *widgets.EditableTextState
ShowKeyboard gives the focus to the text field the finder finds (or whose descendant it finds) and opens its input connection, as the tap on a field does. The test fails with the tag EnterTextNoField when the finder finds no EditableText.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.showKeyboard
func (*Tester) SimulateStatusBarTap ¶
func (t *Tester) SimulateStatusBarTap()
SimulateStatusBarTap acts as if the user tapped the status bar, the gesture that scrolls a page of iOS to its top: the binding tells its observers.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetTester.simulateStatusBarTap
func (*Tester) Size ¶
Size is the size of the render box of the one widget the finder finds.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetController.getSize
func (*Tester) StartBackGesture ¶
func (t *Tester) StartBackGesture(progress float64, opts ...BackGestureOpts) bool
StartBackGesture plays the system starting a predictive back gesture at the progress, as the platform does: through PlatformDispatcher.StartBackGesture. It reports whether the framework took the gesture (an observer returned true from HandleStartBackGesture). It runs what the call posted but does not pump; call Pump after it, as flutter_test's tests do.
Flutter: widgets/binding.dart WidgetsBinding._handleStartBackGesture (the startBackGesture call of the flutter/backgesture channel)
func (*Tester) StartGesture ¶
func (t *Tester) StartGesture(at ui.Offset, opts ...GestureOpts) *TestGesture
StartGesture presses a pointer at the position (logical pixels) and returns the gesture to move and release it. A mouse is added first, as a real one would be. The tester runs the posted functions after the press (and after every move, up and cancel), as the await in Flutter's test gestures runs the microtasks: a recognizer alone in the arena wins at once.
Flutter: flutter_test/lib/src/controller.dart WidgetController.startGesture
func (*Tester) StartTrackpadGesture ¶
func (t *Tester) StartTrackpadGesture(at ui.Offset) *TestTrackpadGesture
StartTrackpadGesture starts a pan/zoom gesture of a trackpad at the position (logical pixels). The tester runs the posted functions after every event, as StartGesture does.
Flutter: flutter_test/lib/src/test_pointer.dart TestPointer.panZoomStart
func (*Tester) TakeError ¶
TakeError returns the oldest error that the framework reported and that the test did not take yet, and forgets it; nil when there is none. A test that expects an error takes it and checks its tag.
Flutter: flutter_test/lib/src/binding.dart TestWidgetsFlutterBinding.takeException
func (*Tester) TakeErrors ¶
TakeErrors returns all the errors that the framework reported and the test did not take yet, oldest first, and forgets them.
Flutter: flutter_test/lib/src/binding.dart TestWidgetsFlutterBinding.takeException
func (*Tester) Tap ¶
func (t *Tester) Tap(f Finder, opts ...GestureOpts)
Tap taps the center of the one element the finder finds.
Flutter: flutter_test/lib/src/controller.dart WidgetController.tap
func (*Tester) TapAt ¶
func (t *Tester) TapAt(at ui.Offset, opts ...GestureOpts)
TapAt presses and releases a pointer at the position, without time passing in between.
Flutter: flutter_test/lib/src/controller.dart WidgetController.tapAt
func (*Tester) TextInputStates ¶
func (t *Tester) TextInputStates() []ui.TextInputState
TextInputStates are the states of the text field that the framework gave to the input method of the fake platform, in order: the last one is what the input method knows now.
Flutter: flutter_test/lib/src/test_text_input.dart TestTextInput
func (*Tester) TopLeft ¶
TopLeft is the position of the top left corner of the one widget the finder finds, in logical pixels of the view.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetController.getTopLeft
func (*Tester) TrackpadFling ¶
TrackpadFling flings a trackpad from the center of the one element the finder finds.
Flutter: flutter_test/lib/src/controller.dart WidgetController.trackpadFling
func (*Tester) TrackpadFlingFrom ¶
TrackpadFlingFrom starts a trackpad pan at the position and pans it by the offset in 50 steps at the speed (logical pixels per second), pumping between the steps, then ends it.
Flutter: flutter_test/lib/src/controller.dart WidgetController.trackpadFlingFrom
func (*Tester) UpdateBackGestureProgress ¶
func (t *Tester) UpdateBackGestureProgress(progress float64, opts ...BackGestureOpts)
UpdateBackGestureProgress plays the system moving the finger of a predictive back gesture, through PlatformDispatcher.UpdateBackGestureProgress. It does not pump.
Flutter: widgets/binding.dart WidgetsBinding._handleUpdateBackGestureProgress (the updateBackGestureProgress call of the flutter/backgesture channel)
func (*Tester) ViewActions ¶
func (t *Tester) ViewActions(view ui.ViewID) []ui.WindowAction
ViewActions are the actions that were asked of the window of a view (minimize, maximize, ...), in order.
Flutter: no counterpart
func (*Tester) ViewScenes ¶
ViewScenes are the scenes that the view rendered so far.
Flutter: no counterpart
func (*Tester) ViewTitle ¶
ViewTitle is the last title that the app set for the window of the view, the implicit view's too (Windows lists only the windows that the app created). It is the title of a created window until the app sets another one, and empty for a view whose title was never set.
Flutter: no counterpart
func (*Tester) Widget ¶
Widget is the one widget the finder finds (see Element).
Flutter: flutter_test/lib/src/widget_tester.dart WidgetController.widget
func (*Tester) Widgets ¶
Widgets are the widgets the finder finds.
Flutter: flutter_test/lib/src/widget_tester.dart WidgetController.widgetList
func (*Tester) WindowActions ¶
func (t *Tester) WindowActions() []ui.WindowAction
WindowActions are the actions that a title bar of the app asked of the window (move, resize, minimize, ...), in order.
Flutter: no counterpart
func (*Tester) WindowContentType ¶
func (t *Tester) WindowContentType(view ui.ViewID) ui.ContentType
WindowContentType is the last content type hint the app set for the view.
Flutter: no counterpart
func (*Tester) WindowHidden ¶
WindowHidden is whether the app hid the window of the view (RegularWindowController.SetHidden): the implicit view's too.
Flutter: no counterpart
func (*Tester) WindowIcon ¶
func (t *Tester) WindowIcon(view ui.ViewID) ui.WindowIcon
WindowIcon is the last icon the app set for the view; the zero icon if none.
Flutter: no counterpart
func (*Tester) Windows ¶
func (t *Tester) Windows() []TestWindow
Windows are the windows that the app asked the platform for with the window controllers, in order, destroyed ones included. The implicit view is not one of them.
Flutter: no counterpart
type TextWidget ¶
type TextWidget interface {
widgets.Widget
// PlainText is the text the widget shows, without styles.
PlainText() string
}
TextWidget is implemented by a widget that shows text: Text, RichText and EditableText (steps 7.7 and 11.4). ByText and ByTextContaining match their PlainText.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.text
type TooltipWidget ¶
type TooltipWidget interface {
widgets.Widget
// TooltipMessage is the message the widget shows.
TooltipMessage() string
}
TooltipWidget is implemented by the Tooltip widget (step 9.x): ByTooltip matches its message.
Flutter: flutter_test/lib/src/finders.dart CommonFinders.byTooltip