Documentation
¶
Overview ¶
Package fake is a scripted platform for tests: it replays queued events and records what the engine asks of it.
Flutter: no counterpart (the role of the test binding's fake platform).
Index ¶
- Constants
- type Accessibility
- func (a *Accessibility) Close()
- func (a *Accessibility) Closed() bool
- func (a *Accessibility) Perform(event ui.SemanticsActionEvent)
- func (a *Accessibility) RemoveView(view ui.ViewID)
- func (a *Accessibility) Removed() []ui.ViewID
- func (a *Accessibility) ScreenReader(on bool)
- func (a *Accessibility) SetWindow(view ui.ViewID, title string, active bool)
- func (a *Accessibility) Start(_ context.Context, host platform.AccessibilityHost)
- func (a *Accessibility) Started() bool
- func (a *Accessibility) UpdateSemantics(view ui.ViewID, update *ui.SemanticsUpdate)
- func (a *Accessibility) Updates() []ViewUpdate
- func (a *Accessibility) Windows() []WindowRecord
- type Audio
- func (a *Audio) AddDevice(info platform.AudioDeviceInfo)
- func (a *Audio) AddReleaseHook(fn func())
- func (a *Audio) Devices(kind platform.AudioKind) ([]platform.AudioDeviceInfo, error)
- func (a *Audio) FailOpen(err error)
- func (a *Audio) Open(ctx context.Context, kind platform.AudioKind, opts platform.AudioOpenOptions, ...) (platform.AudioDevice, error)
- func (a *Audio) Opened() []*AudioDevice
- func (a *Audio) RemoveDevice(id string)
- func (a *Audio) RunReleaseHooks()
- func (a *Audio) SetChangeHandler(fn func())
- func (a *Audio) SetDefault(id string)
- func (a *Audio) SetUnavailable(v bool)
- type AudioDevice
- func (d *AudioDevice) Close() error
- func (d *AudioDevice) Format() platform.AudioFormat
- func (d *AudioDevice) Info() platform.AudioDeviceInfo
- func (d *AudioDevice) Lose()
- func (d *AudioDevice) Options() platform.AudioOpenOptions
- func (d *AudioDevice) Pause() error
- func (d *AudioDevice) Pull(frames, chunk int) []float32
- func (d *AudioDevice) PullInto(out []float32)
- func (d *AudioDevice) Push(frames []float32)
- func (d *AudioDevice) Resume() error
- func (d *AudioDevice) State() platform.AudioState
- func (d *AudioDevice) Suspend()
- func (d *AudioDevice) Unsuspend()
- type CloseRequestEvent
- type ContentLostEvent
- type DisplaysEvent
- type DragEndEvent
- type DropEvent
- type Entry
- type EntryKind
- type Event
- type FrameEvent
- type Gamepads
- func (g *Gamepads) Connect(info platform.PadInfo) platform.PadID
- func (g *Gamepads) Disconnect(id platform.PadID)
- func (g *Gamepads) EnableExtras()
- func (g *Gamepads) Extras() int
- func (g *Gamepads) ExtrasAtStart() int
- func (g *Gamepads) MappingPlatform() string
- func (g *Gamepads) Rumble(id platform.PadID, low, high uint16, d time.Duration) error
- func (g *Gamepads) RumbleTriggers(id platform.PadID, left, right uint16, d time.Duration) error
- func (g *Gamepads) Rumbles() []Rumble
- func (g *Gamepads) Send(events ...platform.PadEvent)
- func (g *Gamepads) SendBattery(b platform.PadBattery)
- func (g *Gamepads) SendSensor(s platform.PadSensor)
- func (g *Gamepads) SendTouch(t platform.PadTouch)
- func (g *Gamepads) SensorsOn(id platform.PadID) bool
- func (g *Gamepads) SetLED(id platform.PadID, r, gr, b uint8) error
- func (g *Gamepads) SetPadSensors(id platform.PadID, on bool) error
- func (g *Gamepads) Start(h platform.PadHandler) error
- func (g *Gamepads) Starts() int
- func (g *Gamepads) Stop()
- type KeyEvent
- type LifecycleEvent
- type MetricsEvent
- type OpenRequestEvent
- type Platform
- func (p *Platform) Accessibility() *Accessibility
- func (p *Platform) Audio() *Audio
- func (p *Platform) Clipboard() platform.Clipboard
- func (p *Platform) ClipboardContent(kind ui.ClipboardKind) ui.ClipboardContent
- func (p *Platform) ClipboardText() (string, bool)
- func (p *Platform) Displays() []platform.Display
- func (p *Platform) DropAnswers() []ui.DropActions
- func (p *Platform) Gamepads() *Gamepads
- func (p *Platform) Inject(event Event)
- func (p *Platform) Log() []Entry
- func (p *Platform) NewWindow(cfg platform.WindowConfig) (platform.Window, error)
- func (p *Platform) Post(fn func())
- func (p *Platform) RequestActivationToken(view ui.ViewID, done func(token string))
- func (p *Platform) Run(ctx context.Context, h platform.Handler) error
- func (p *Platform) Sensors() *Sensors
- func (p *Platform) Services() platform.Services
- func (p *Platform) SetClipboardContent(kind ui.ClipboardKind, content ui.ClipboardContent)
- func (p *Platform) SetClipboardText(text string)
- func (p *Platform) SetDisplays(displays []platform.Display)
- func (p *Platform) SetSettings(settings platform.Settings)
- func (p *Platform) Settings() platform.Settings
- func (p *Platform) Windows() []*Window
- type PointerEvent
- type PointerLockEndedEvent
- type Rumble
- type SensorDevice
- func (d *SensorDevice) Close() error
- func (d *SensorDevice) Closed() bool
- func (d *SensorDevice) Kind() platform.SensorKind
- func (d *SensorDevice) Options() platform.SensorOpenOptions
- func (d *SensorDevice) Rate() float64
- func (d *SensorDevice) Send(readings ...platform.SensorReading)
- func (d *SensorDevice) SendValues(at time.Duration, x, y, z float64)
- type Sensors
- func (s *Sensors) Available(kind platform.SensorKind) bool
- func (s *Sensors) FailOpen(err error)
- func (s *Sensors) Open(ctx context.Context, kind platform.SensorKind, opts platform.SensorOpenOptions, ...) (platform.SensorDevice, error)
- func (s *Sensors) Opened() []*SensorDevice
- func (s *Sensors) SetAvailable(kind platform.SensorKind, available bool)
- func (s *Sensors) SetDenied(kind platform.SensorKind, denied bool)
- type SettingsEvent
- type SizeConstraints
- type TextInputEvent
- type ViewFocusEvent
- type ViewUpdate
- type Window
- func (w *Window) Close()
- func (w *Window) Closed() bool
- func (w *Window) Config() platform.WindowConfig
- func (w *Window) ContentType() ui.ContentType
- func (w *Window) Cursor() platform.MouseCursor
- func (w *Window) Hidden() bool
- func (w *Window) ID() ui.ViewID
- func (w *Window) Icon() ui.WindowIcon
- func (w *Window) KeepScreenOn(on bool) error
- func (w *Window) LockPointer() error
- func (w *Window) NativeSurface() gpu.SurfaceHandle
- func (w *Window) PerformWindowAction(action ui.WindowAction)
- func (w *Window) PointerLocked() bool
- func (w *Window) PortalHandle(done func(handle string))
- func (w *Window) RequestFrame()
- func (w *Window) ScreenKeptOn() bool
- func (w *Window) SetContentType(contentType ui.ContentType)
- func (w *Window) SetCursor(cursor platform.MouseCursor)
- func (w *Window) SetHidden(hidden bool) bool
- func (w *Window) SetIcon(icon ui.WindowIcon) error
- func (w *Window) SetSize(size ui.Size)
- func (w *Window) SetSizeConstraints(min, max ui.Size)
- func (w *Window) SetState(state platform.WindowState)
- func (w *Window) SetTextInput(state ui.TextInputState)
- func (w *Window) SetTitle(title string)
- func (w *Window) Size() ui.Size
- func (w *Window) SizeConstraints() SizeConstraints
- func (w *Window) StartDrag(data ui.DragRequest) error
- func (w *Window) State() platform.WindowState
- func (w *Window) TextInput() ui.TextInputState
- func (w *Window) Title() string
- func (w *Window) UnlockPointer()
- type WindowRecord
Constants ¶
const FakeActivationToken = "fake-activation-token"
FakeActivationToken is the token that RequestActivationToken gives.
Flutter: no counterpart
const FakePortalHandlePrefix = "fake:"
FakePortalHandlePrefix is what the handle of a fake window starts with; the view ID follows.
Flutter: no counterpart
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Accessibility ¶
type Accessibility struct {
// contains filtered or unexported fields
}
Accessibility is the accessibility bridge of the fake platform: it keeps what the engine gave it, and the test plays the screen reader with ScreenReader and Perform.
Flutter: no counterpart
func (*Accessibility) Close ¶
func (a *Accessibility) Close()
Close records that the engine closed the bridge.
func (*Accessibility) Closed ¶
func (a *Accessibility) Closed() bool
Closed says whether the engine closed the bridge.
func (*Accessibility) Perform ¶
func (a *Accessibility) Perform(event ui.SemanticsActionEvent)
Perform plays an assistive technology that asks for an action on a node.
func (*Accessibility) RemoveView ¶
func (a *Accessibility) RemoveView(view ui.ViewID)
RemoveView records the view that was removed.
func (*Accessibility) Removed ¶
func (a *Accessibility) Removed() []ui.ViewID
Removed are the views that the bridge was told to forget.
func (*Accessibility) ScreenReader ¶
func (a *Accessibility) ScreenReader(on bool)
ScreenReader plays a screen reader that starts or stops: the host is told on the UI thread. It does nothing before Start.
func (*Accessibility) SetWindow ¶
func (a *Accessibility) SetWindow(view ui.ViewID, title string, active bool)
SetWindow records the window.
func (*Accessibility) Start ¶
func (a *Accessibility) Start(_ context.Context, host platform.AccessibilityHost)
Start keeps the host.
func (*Accessibility) Started ¶
func (a *Accessibility) Started() bool
Started says whether the engine started the bridge.
func (*Accessibility) UpdateSemantics ¶
func (a *Accessibility) UpdateSemantics(view ui.ViewID, update *ui.SemanticsUpdate)
UpdateSemantics records the update.
func (*Accessibility) Updates ¶
func (a *Accessibility) Updates() []ViewUpdate
Updates are the semantics updates the bridge got, oldest first.
func (*Accessibility) Windows ¶
func (a *Accessibility) Windows() []WindowRecord
Windows are the windows that the bridge was told about, oldest first.
type Audio ¶
type Audio struct {
// contains filtered or unexported fields
}
Audio is the scripted audio service of the fake platform: a test lists devices, opens them through the app, and plays the part of the audio thread by pulling frames from a playback device or pushing frames into a capture device (SPEC §28.8). Nothing runs by itself, so a test decides when the callback runs and what the clock of the device is.
Flutter: no counterpart
func NewAudio ¶
func NewAudio() *Audio
NewAudio makes the service with a speaker and a microphone, which are the default devices.
Flutter: no counterpart
func (*Audio) AddDevice ¶
func (a *Audio) AddDevice(info platform.AudioDeviceInfo)
AddDevice plugs in a device; a device with Default set becomes the default of its kind. The change handler is called before it returns.
Flutter: no counterpart
func (*Audio) AddReleaseHook ¶
func (a *Audio) AddReleaseHook(fn func())
AddReleaseHook is called by the host's own hook list in tests of the engine; here it only keeps the functions so that a test can run them with RunReleaseHooks, as the engine does when the app ends.
Flutter: no counterpart
func (*Audio) FailOpen ¶
FailOpen makes the next opens fail with err (nil makes them work again).
Flutter: no counterpart
func (*Audio) Open ¶
func (a *Audio) Open(ctx context.Context, kind platform.AudioKind, opts platform.AudioOpenOptions, h platform.AudioHandler) (platform.AudioDevice, error)
Open implements platform.Audio.
func (*Audio) Opened ¶
func (a *Audio) Opened() []*AudioDevice
Opened returns the devices that are open now, in the order they were opened.
Flutter: no counterpart
func (*Audio) RemoveDevice ¶
RemoveDevice unplugs a device; an open device of it is lost.
Flutter: no counterpart
func (*Audio) RunReleaseHooks ¶
func (a *Audio) RunReleaseHooks()
RunReleaseHooks runs the functions of AddReleaseHook, the way the engine does when the app ends.
Flutter: no counterpart
func (*Audio) SetChangeHandler ¶
func (a *Audio) SetChangeHandler(fn func())
SetChangeHandler implements platform.Audio.
func (*Audio) SetDefault ¶
SetDefault makes a device the default of its kind.
Flutter: no counterpart
func (*Audio) SetUnavailable ¶
SetUnavailable makes the service act as a system with no audio server: the lists and the opens fail with AudioUnavailable.
Flutter: no counterpart
type AudioDevice ¶
type AudioDevice struct {
// contains filtered or unexported fields
}
AudioDevice is an open device of the fake service. A test pulls frames from a playback device and pushes frames into a capture device, which calls the handler on the goroutine of the test, as the audio thread of a real backend would.
Flutter: no counterpart
func (*AudioDevice) Close ¶
func (d *AudioDevice) Close() error
Close implements platform.AudioDevice: it waits for a callback that is under way, and the handler is never called again.
func (*AudioDevice) Format ¶
func (d *AudioDevice) Format() platform.AudioFormat
Format implements platform.AudioDevice.
func (*AudioDevice) Info ¶
func (d *AudioDevice) Info() platform.AudioDeviceInfo
Info is the description of the device that was opened.
Flutter: no counterpart
func (*AudioDevice) Lose ¶
func (d *AudioDevice) Lose()
Lose makes the device lost, as when it is unplugged.
Flutter: no counterpart
func (*AudioDevice) Options ¶
func (d *AudioDevice) Options() platform.AudioOpenOptions
Options are the options the device was opened with.
Flutter: no counterpart
func (*AudioDevice) Pause ¶
func (d *AudioDevice) Pause() error
Pause implements platform.AudioDevice.
func (*AudioDevice) Pull ¶
func (d *AudioDevice) Pull(frames, chunk int) []float32
Pull runs the callback of a playback device for frames frames, in pieces of at most chunk frames (0 for one piece), and returns what came out.
Flutter: no counterpart
func (*AudioDevice) PullInto ¶
func (d *AudioDevice) PullInto(out []float32)
PullInto runs the callback of a playback device once for len(out)/channels frames and puts the frames in out. A device that is not running gives silence and the handler is not called. It does not allocate.
Flutter: no counterpart
func (*AudioDevice) Push ¶
func (d *AudioDevice) Push(frames []float32)
Push gives the handler of a capture device the frames that the device recorded; a device that is not running drops them.
Flutter: no counterpart
func (*AudioDevice) Resume ¶
func (d *AudioDevice) Resume() error
Resume implements platform.AudioDevice.
func (*AudioDevice) State ¶
func (d *AudioDevice) State() platform.AudioState
State is the state of the device.
Flutter: no counterpart
func (*AudioDevice) Suspend ¶
func (d *AudioDevice) Suspend()
Suspend makes the device wait, as a browser's does until the user does something.
Flutter: no counterpart
func (*AudioDevice) Unsuspend ¶
func (d *AudioDevice) Unsuspend()
Unsuspend lets a suspended device run.
Flutter: no counterpart
type CloseRequestEvent ¶
type CloseRequestEvent struct {
// View is the view the user asked to close.
View ui.ViewID
// Reason is why (ui.AppExitReason): the event goes to platform.CloseRequest with
// it; AppExitReasonUnspecified is the close button, as Handler.OnCloseRequest.
Reason ui.AppExitReason
}
CloseRequestEvent delivers a close request to Handler.OnCloseRequest. When the handler returns true, the fake closes the view's window.
Flutter: no counterpart
type ContentLostEvent ¶
ContentLostEvent delivers a window whose content was lost to Handler.OnContentLost.
Flutter: no counterpart
type DisplaysEvent ¶
DisplaysEvent changes the displays that Platform.Displays reports and then tells Handler.OnDisplaysChanged.
Flutter: no counterpart
type DragEndEvent ¶
type DragEndEvent struct {
// Result is how the drag ended.
Result ui.DragResult
}
DragEndEvent delivers the end of a drag the app started to Handler.OnDragEnd.
Flutter: no counterpart
type DropEvent ¶
type DropEvent struct {
// Event is the event; its ViewID says which view it is over.
Event ui.DropEvent
}
DropEvent delivers a drag-and-drop event to Handler.OnDrop. The answer of the handler is kept in the platform: see Platform.DropAnswers.
Flutter: no counterpart
type Entry ¶
type Entry struct {
// Kind says what happened.
Kind EntryKind
// View is the view the entry is about, or ui.ImplicitViewID when it is
// about no particular view.
View ui.ViewID
// Value carries the details; its type depends on Kind.
Value any
}
Entry is one line of the log of a fake Platform.
Flutter: no counterpart
type EntryKind ¶
type EntryKind string
EntryKind names what an Entry in the log records.
Flutter: no counterpart
const ( // EntryNewWindow records NewWindow; Value is the platform.WindowConfig. // // Flutter: no counterpart EntryNewWindow EntryKind = "NewWindow" // EntryEvent records an injected event delivered to the handler; Value is // the Event. // // Flutter: no counterpart EntryEvent EntryKind = "Event" // EntryCloseDecision records the handler's answer to a close request; // Value is a bool, true when the window was closed. // // Flutter: no counterpart EntryCloseDecision EntryKind = "CloseDecision" // EntrySetTitle records Window.SetTitle; Value is the string. // // Flutter: no counterpart EntrySetTitle EntryKind = "SetTitle" // EntrySetSize records Window.SetSize; Value is the ui.Size. // // Flutter: no counterpart EntrySetSize EntryKind = "SetSize" // EntrySetState records Window.SetState; Value is the platform.WindowState. // // Flutter: no counterpart EntrySetState EntryKind = "SetState" // EntrySetHidden records Window.SetHidden; Value is the bool. // // Flutter: no counterpart EntrySetHidden EntryKind = "SetHidden" // EntrySetCursor records Window.SetCursor; Value is the // platform.MouseCursor. // // Flutter: no counterpart EntrySetCursor EntryKind = "SetCursor" // EntrySetTextInput records Window.SetTextInput; Value is the // ui.TextInputState. // // Flutter: no counterpart EntrySetTextInput EntryKind = "SetTextInput" // EntryRequestFrame records Window.RequestFrame; Value is nil. // // Flutter: no counterpart EntryRequestFrame EntryKind = "RequestFrame" // EntryStartDrag records Window.StartDrag; Value is the ui.DragRequest. // // Flutter: no counterpart EntryStartDrag EntryKind = "StartDrag" // EntrySetSizeConstraints records Window.SetSizeConstraints; Value is a // SizeConstraints. // // Flutter: no counterpart EntrySetSizeConstraints EntryKind = "SetSizeConstraints" // EntryWindowAction records Window.PerformWindowAction; Value is the // ui.WindowAction. // // Flutter: no counterpart EntryWindowAction EntryKind = "WindowAction" // EntrySetIcon records Window.SetIcon; Value is the ui.WindowIcon. // // Flutter: no counterpart EntrySetIcon EntryKind = "SetIcon" // EntrySetContentType records Window.SetContentType; Value is the // ui.ContentType. // // Flutter: no counterpart EntrySetContentType EntryKind = "SetContentType" // EntryKeepScreenOn records Window.KeepScreenOn; Value is the bool. // // Flutter: no counterpart EntryKeepScreenOn EntryKind = "KeepScreenOn" // EntryLockPointer records Window.LockPointer; Value is nil. // // Flutter: no counterpart EntryLockPointer EntryKind = "LockPointer" // EntryUnlockPointer records Window.UnlockPointer; Value is nil. // // Flutter: no counterpart EntryUnlockPointer EntryKind = "UnlockPointer" // EntryPortalHandle records Window.PortalHandle; Value is nil. // // Flutter: no counterpart EntryPortalHandle EntryKind = "PortalHandle" // EntryActivationToken records Platform.RequestActivationToken; Value is the // ui.ViewID. // // Flutter: no counterpart EntryActivationToken EntryKind = "ActivationToken" // EntryClose records Window.Close; Value is nil. // // Flutter: no counterpart EntryClose EntryKind = "Close" )
The kinds of log entries.
type Event ¶
type Event interface {
// contains filtered or unexported methods
}
Event is an input or system event that Platform.Inject can queue. The set of events is closed: it is the methods of platform.Handler.
Flutter: no counterpart
type FrameEvent ¶
type FrameEvent struct {
// View is the view to draw a frame of.
View ui.ViewID
// FrameTime is the frame time since an arbitrary fixed point.
FrameTime time.Duration
}
FrameEvent delivers a frame request to Handler.OnFrame.
Flutter: no counterpart
type Gamepads ¶
type Gamepads struct {
// contains filtered or unexported fields
}
Gamepads is the scripted gamepad service of the fake platform: a test connects and removes pads and sends their reports, and the handler gets them on the platform's UI thread, in order, as a real backend's would (SPEC §28.8).
Flutter: no counterpart
func NewGamepads ¶
func NewGamepads(post func(func())) *Gamepads
NewGamepads makes a scripted gamepad service whose handler is called through post, which runs a function on the UI thread.
Flutter: no counterpart
func (*Gamepads) Connect ¶
Connect plugs in a pad: it gets the next ID, which is returned and set in the info that the handler receives.
Flutter: no counterpart
func (*Gamepads) EnableExtras ¶
func (g *Gamepads) EnableExtras()
EnableExtras implements platform.PadExtras: it counts the call, as the Linux and Windows services' wake-up would be one.
func (*Gamepads) Extras ¶
Extras returns how many times the extras were woken, and ExtrasAtStart how many times they had been when the service was last started (0 for a service that started asleep, 1 for one that started awake).
Flutter: no counterpart
func (*Gamepads) MappingPlatform ¶
MappingPlatform implements platform.Gamepads: the fake platform is Linux, whose evdev numbering the tests use.
func (*Gamepads) RumbleTriggers ¶
RumbleTriggers implements platform.Gamepads.
func (*Gamepads) Rumbles ¶
Rumbles returns the requests of the app to rumble the pads and set their lights.
Flutter: no counterpart
func (*Gamepads) Send ¶
Send makes the reports arrive, in one call of the handler.
Flutter: no counterpart
func (*Gamepads) SendBattery ¶
func (g *Gamepads) SendBattery(b platform.PadBattery)
SendBattery makes a state of the battery arrive.
Flutter: no counterpart
func (*Gamepads) SendSensor ¶
SendSensor makes a reading of a motion sensor arrive. The pad's service gives it to the app only while the sensors are on.
Flutter: no counterpart
func (*Gamepads) SensorsOn ¶
SensorsOn says whether the app turned the sensors of the pad on.
Flutter: no counterpart
func (*Gamepads) SetPadSensors ¶
SetPadSensors implements platform.PadSensorControl: the request is kept, and fails for a pad without sensors.
func (*Gamepads) Start ¶
func (g *Gamepads) Start(h platform.PadHandler) error
Start implements platform.Gamepads: the pads that were connected before are reported to h.
type LifecycleEvent ¶
type LifecycleEvent struct {
// State is the new lifecycle state.
State ui.AppLifecycleState
}
LifecycleEvent delivers a lifecycle change to Handler.OnLifecycle.
Flutter: no counterpart
type MetricsEvent ¶
type MetricsEvent struct {
// View is the view whose metrics changed.
View ui.ViewID
// Metrics is the new metrics.
Metrics platform.ViewMetrics
}
MetricsEvent delivers new view metrics to Handler.OnMetrics.
Flutter: no counterpart
type OpenRequestEvent ¶
type OpenRequestEvent struct {
// Request is what the system asks the app to open.
Request ui.OpenRequest
}
OpenRequestEvent delivers a request of the system to open URLs or files to platform.OpenRequest, as macOS does for a link or a document of the app.
Flutter: no counterpart
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform is a scripted platform.Platform for tests. Run replays a queue of events and posted functions on the goroutine that called it (the fake UI thread), and everything the engine asks of the platform is recorded in a log. It needs no display.
Flutter: no counterpart
func New ¶
func New() *Platform
New returns a fake platform that has no windows and is not running.
Flutter: no counterpart
func (*Platform) Accessibility ¶
func (p *Platform) Accessibility() *Accessibility
Accessibility is the fake accessibility bridge, which Services gives the engine.
Flutter: no counterpart
func (*Platform) Audio ¶
Audio returns the scripted audio service, which Services gives the engine.
Flutter: no counterpart
func (*Platform) Clipboard ¶
Clipboard returns the in-memory clipboard. Its results come back through Post, like the real ones.
Flutter: no counterpart
func (*Platform) ClipboardContent ¶
func (p *Platform) ClipboardContent(kind ui.ClipboardKind) ui.ClipboardContent
ClipboardContent is what the in-memory clipboard (kind system) or primary selection (kind primary) holds.
Flutter: no counterpart
func (*Platform) ClipboardText ¶
ClipboardText is the text that the in-memory clipboard holds, and whether it holds any.
Flutter: no counterpart
func (*Platform) Displays ¶
Displays returns the displays set by SetDisplays; none by default.
Flutter: no counterpart
func (*Platform) DropAnswers ¶
func (p *Platform) DropAnswers() []ui.DropActions
DropAnswers are the actions that Handler.OnDrop returned for the DropEvents the platform delivered, in order.
Flutter: no counterpart
func (*Platform) Gamepads ¶
Gamepads returns the scripted gamepad service, which Services gives the engine.
Flutter: no counterpart
func (*Platform) Inject ¶
Inject queues an input event for delivery to the handler inside Run. It is safe to call from any goroutine.
Flutter: no counterpart
func (*Platform) Log ¶
Log returns a copy of the log: window creation, calls on windows, and the events delivered to the handler, in the order they happened.
Flutter: no counterpart
func (*Platform) NewWindow ¶
NewWindow creates a fake window and records its config. The first window gets the implicit view ID; later windows get the next IDs.
Flutter: no counterpart
func (*Platform) Post ¶
func (p *Platform) Post(fn func())
Post queues fn to run inside Run. It is safe to call from any goroutine. Functions posted by one goroutine run in the order it posted them, and in order with events added by Inject. A function posted after Run has returned waits for the next Run.
Flutter: no counterpart
func (*Platform) RequestActivationToken ¶
RequestActivationToken records the request and answers with FakeActivationToken on the platform's thread.
Flutter: no counterpart
func (*Platform) Run ¶
Run delivers queued events and posted functions to h, in the order they were queued, until ctx is cancelled. It returns nil on cancellation. Events queued before Run starts are delivered once it does. A second call while Run is active fails with PlatformAlreadyRunning.
Flutter: no counterpart
func (*Platform) Sensors ¶
Sensors returns the scripted sensors service, which Services gives the engine.
Flutter: no counterpart
func (*Platform) Services ¶
Services returns the fake services: the fake accessibility bridge.
Flutter: no counterpart
func (*Platform) SetClipboardContent ¶
func (p *Platform) SetClipboardContent(kind ui.ClipboardKind, content ui.ClipboardContent)
SetClipboardContent sets the in-memory clipboard (kind system) or primary selection (kind primary), as another application would.
Flutter: no counterpart
func (*Platform) SetClipboardText ¶
SetClipboardText sets the text of the in-memory clipboard, as another application would.
Flutter: no counterpart
func (*Platform) SetDisplays ¶
SetDisplays sets the displays that Displays reports.
Flutter: no counterpart
func (*Platform) SetSettings ¶
SetSettings sets the settings that Settings reports, without notifying the handler. Use a SettingsEvent to notify it.
Flutter: no counterpart
type PointerEvent ¶
type PointerEvent struct {
// Data is the batch.
Data []ui.PointerData
}
PointerEvent delivers a batch of pointer reports to Handler.OnPointer.
Flutter: no counterpart
type PointerLockEndedEvent ¶
PointerLockEndedEvent tells the handler that the lock of a window ended by itself, as the compositor or the browser does (platform.PointerLockHandler). The window is unlocked first.
Flutter: no counterpart
type Rumble ¶
type Rumble struct {
Pad platform.PadID
// Triggers says that the request was for the motors of the triggers.
Triggers bool
// LED says that the request was a colour, which Color holds (red, green, blue).
LED bool
Color [3]uint8
Low, High uint16
Duration time.Duration
}
Rumble is a rumble or light request that the fake service recorded.
Flutter: no counterpart
type SensorDevice ¶
type SensorDevice struct {
// contains filtered or unexported fields
}
SensorDevice is a sensor that the app opened on the fake service.
Flutter: no counterpart
func (*SensorDevice) Close ¶
func (d *SensorDevice) Close() error
Close implements platform.SensorDevice.
func (*SensorDevice) Closed ¶
func (d *SensorDevice) Closed() bool
Closed says whether the app closed the sensor.
Flutter: no counterpart
func (*SensorDevice) Kind ¶
func (d *SensorDevice) Kind() platform.SensorKind
Kind is the kind of the sensor.
Flutter: no counterpart
func (*SensorDevice) Options ¶
func (d *SensorDevice) Options() platform.SensorOpenOptions
Options are what the app asked for when it opened the sensor.
Flutter: no counterpart
func (*SensorDevice) Rate ¶
func (d *SensorDevice) Rate() float64
Rate implements platform.SensorDevice: what the app asked for, or 60.
func (*SensorDevice) Send ¶
func (d *SensorDevice) Send(readings ...platform.SensorReading)
Send makes readings arrive, on the caller's goroutine, as the sensor thread of a backend would. A sensor that was closed gets nothing. Values are given for the sensor's kind.
Flutter: no counterpart
func (*SensorDevice) SendValues ¶
func (d *SensorDevice) SendValues(at time.Duration, x, y, z float64)
SendValues makes one reading arrive with the time at which the call was made, counted from the start of the fake clock that the caller passes.
Flutter: no counterpart
type Sensors ¶
type Sensors struct {
// contains filtered or unexported fields
}
Sensors is the scripted motion sensors service of the fake platform: a test says which sensors the device has, opens them through the app, and plays the part of the sensor thread by sending readings to an open sensor (SPEC §28.8). Nothing runs by itself, so a test decides when the readings arrive.
Flutter: no counterpart
func NewSensors ¶
func NewSensors() *Sensors
NewSensors makes the service with an accelerometer and a gyroscope.
Flutter: no counterpart
func (*Sensors) Available ¶
func (s *Sensors) Available(kind platform.SensorKind) bool
Available implements platform.Sensors.
func (*Sensors) FailOpen ¶
FailOpen makes the next opens fail with err (nil makes them work again).
Flutter: no counterpart
func (*Sensors) Open ¶
func (s *Sensors) Open(ctx context.Context, kind platform.SensorKind, opts platform.SensorOpenOptions, h platform.SensorHandler) (platform.SensorDevice, error)
Open implements platform.Sensors.
func (*Sensors) Opened ¶
func (s *Sensors) Opened() []*SensorDevice
Opened returns the sensors that are open now, in the order they were opened.
Flutter: no counterpart
func (*Sensors) SetAvailable ¶
func (s *Sensors) SetAvailable(kind platform.SensorKind, available bool)
SetAvailable says whether the device has a sensor of the kind (both are there at the start).
Flutter: no counterpart
type SettingsEvent ¶
SettingsEvent changes the settings that Platform.Settings reports and then delivers them to Handler.OnSettings.
Flutter: no counterpart
type SizeConstraints ¶
type SizeConstraints struct {
// Min is the smallest size in logical pixels; zero means no limit.
Min ui.Size
// Max is the largest size in logical pixels; zero means no limit.
Max ui.Size
}
SizeConstraints is the value of an EntrySetSizeConstraints entry.
Flutter: no counterpart
type TextInputEvent ¶
type TextInputEvent struct {
// Event is the IME event.
Event ui.TextInputEvent
}
TextInputEvent delivers an IME event to Handler.OnTextInput.
Flutter: no counterpart
type ViewFocusEvent ¶
type ViewFocusEvent struct {
// View is the view whose focus changed.
View ui.ViewID
// Focused is whether the view has the focus now.
Focused bool
}
ViewFocusEvent delivers a keyboard focus change to Handler.OnViewFocus.
Flutter: no counterpart
type ViewUpdate ¶
type ViewUpdate struct {
View ui.ViewID
Update *ui.SemanticsUpdate
}
ViewUpdate is a semantics update that the engine gave the bridge.
Flutter: no counterpart
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window is a fake platform.Window. It records the calls made on it and keeps the last values set, so tests can inspect them.
Flutter: no counterpart
func (*Window) Close ¶
func (w *Window) Close()
Close marks the window closed and records it. Closing a closed window records nothing.
Flutter: no counterpart
func (*Window) Config ¶
func (w *Window) Config() platform.WindowConfig
Config returns the config the window was created with.
Flutter: no counterpart
func (*Window) ContentType ¶
func (w *Window) ContentType() ui.ContentType
ContentType returns the last content type set; the config's until then.
Flutter: no counterpart
func (*Window) Cursor ¶
func (w *Window) Cursor() platform.MouseCursor
Cursor returns the last cursor set.
Flutter: no counterpart
func (*Window) Hidden ¶
Hidden returns whether the last SetHidden was with true.
Flutter: no counterpart
func (*Window) Icon ¶
func (w *Window) Icon() ui.WindowIcon
Icon returns the last icon set; the config's icon until then.
Flutter: no counterpart
func (*Window) KeepScreenOn ¶
KeepScreenOn records the request and always succeeds.
Flutter: no counterpart
func (*Window) LockPointer ¶
LockPointer records the lock and always succeeds (platform.PointerLocker).
Flutter: no counterpart
func (*Window) NativeSurface ¶
func (w *Window) NativeSurface() gpu.SurfaceHandle
NativeSurface returns a handle of kind gpu.SurfaceKindFake whose Window is the view ID.
Flutter: no counterpart
func (*Window) PerformWindowAction ¶
func (w *Window) PerformWindowAction(action ui.WindowAction)
PerformWindowAction records the action.
Flutter: no counterpart
func (*Window) PointerLocked ¶
PointerLocked returns whether the pointer is locked to the window.
Flutter: no counterpart
func (*Window) PortalHandle ¶
PortalHandle records the request and answers with "fake:" and the view ID, on the platform's thread.
Flutter: no counterpart
func (*Window) RequestFrame ¶
func (w *Window) RequestFrame()
RequestFrame records the request.
Flutter: no counterpart
func (*Window) ScreenKeptOn ¶
ScreenKeptOn returns whether the last KeepScreenOn was with true.
Flutter: no counterpart
func (*Window) SetContentType ¶
func (w *Window) SetContentType(contentType ui.ContentType)
SetContentType records the hint.
Flutter: no counterpart
func (*Window) SetCursor ¶
func (w *Window) SetCursor(cursor platform.MouseCursor)
SetCursor records the new cursor.
Flutter: no counterpart
func (*Window) SetHidden ¶
SetHidden records whether the window is hidden; the fake platform can hide windows.
Flutter: no counterpart
func (*Window) SetIcon ¶
func (w *Window) SetIcon(icon ui.WindowIcon) error
SetIcon records the icon.
Flutter: no counterpart
func (*Window) SetSizeConstraints ¶
SetSizeConstraints records the new limits.
Flutter: no counterpart
func (*Window) SetState ¶
func (w *Window) SetState(state platform.WindowState)
SetState records the new state.
Flutter: no counterpart
func (*Window) SetTextInput ¶
func (w *Window) SetTextInput(state ui.TextInputState)
SetTextInput records the new text input state.
Flutter: no counterpart
func (*Window) Size ¶
Size returns the last size set; the config's size until then.
Flutter: no counterpart
func (*Window) SizeConstraints ¶
func (w *Window) SizeConstraints() SizeConstraints
SizeConstraints returns the last limits set; the config's until then.
Flutter: no counterpart
func (*Window) StartDrag ¶
func (w *Window) StartDrag(data ui.DragRequest) error
StartDrag records the drag and always succeeds.
Flutter: no counterpart
func (*Window) State ¶
func (w *Window) State() platform.WindowState
State returns the last state set; the config's state until then.
Flutter: no counterpart
func (*Window) TextInput ¶
func (w *Window) TextInput() ui.TextInputState
TextInput returns the last text input state set.
Flutter: no counterpart
func (*Window) Title ¶
Title returns the last title set; the config's title until then.
Flutter: no counterpart
func (*Window) UnlockPointer ¶
func (w *Window) UnlockPointer()
UnlockPointer records the end of the lock (platform.PointerLocker).
Flutter: no counterpart