fake

package
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package 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

View Source
const FakeActivationToken = "fake-activation-token"

FakeActivationToken is the token that RequestActivationToken gives.

Flutter: no counterpart

View Source
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

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) Devices

func (a *Audio) Devices(kind platform.AudioKind) ([]platform.AudioDeviceInfo, error)

Devices implements platform.Audio.

func (*Audio) FailOpen

func (a *Audio) FailOpen(err error)

FailOpen makes the next opens fail with err (nil makes them work again).

Flutter: no counterpart

func (*Audio) Open

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

func (a *Audio) RemoveDevice(id string)

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

func (a *Audio) SetDefault(id string)

SetDefault makes a device the default of its kind.

Flutter: no counterpart

func (*Audio) SetUnavailable

func (a *Audio) SetUnavailable(v bool)

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

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
}

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

type ContentLostEvent struct {
	// View is the view that lost its content.
	View ui.ViewID
}

ContentLostEvent delivers a window whose content was lost to Handler.OnContentLost.

Flutter: no counterpart

type DisplaysEvent

type DisplaysEvent struct {
	// Displays is the new list of displays.
	Displays []platform.Display
}

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

func (Entry) String

func (e Entry) String() string

String describes the entry, for test failure messages.

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

func (g *Gamepads) Connect(info platform.PadInfo) platform.PadID

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) Disconnect

func (g *Gamepads) Disconnect(id platform.PadID)

Disconnect unplugs the pad.

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

func (g *Gamepads) Extras() int

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) ExtrasAtStart

func (g *Gamepads) ExtrasAtStart() int

ExtrasAtStart is documented with Extras.

Flutter: no counterpart

func (*Gamepads) MappingPlatform

func (g *Gamepads) MappingPlatform() string

MappingPlatform implements platform.Gamepads: the fake platform is Linux, whose evdev numbering the tests use.

func (*Gamepads) Rumble

func (g *Gamepads) Rumble(id platform.PadID, low, high uint16, d time.Duration) error

Rumble implements platform.Gamepads.

func (*Gamepads) RumbleTriggers

func (g *Gamepads) RumbleTriggers(id platform.PadID, left, right uint16, d time.Duration) error

RumbleTriggers implements platform.Gamepads.

func (*Gamepads) Rumbles

func (g *Gamepads) Rumbles() []Rumble

Rumbles returns the requests of the app to rumble the pads and set their lights.

Flutter: no counterpart

func (*Gamepads) Send

func (g *Gamepads) Send(events ...platform.PadEvent)

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

func (g *Gamepads) SendSensor(s platform.PadSensor)

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) SendTouch

func (g *Gamepads) SendTouch(t platform.PadTouch)

SendTouch makes a finger of a touchpad arrive.

Flutter: no counterpart

func (*Gamepads) SensorsOn

func (g *Gamepads) SensorsOn(id platform.PadID) bool

SensorsOn says whether the app turned the sensors of the pad on.

Flutter: no counterpart

func (*Gamepads) SetLED

func (g *Gamepads) SetLED(id platform.PadID, r, gr, b uint8) error

SetLED implements platform.Gamepads.

func (*Gamepads) SetPadSensors

func (g *Gamepads) SetPadSensors(id platform.PadID, on bool) error

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.

func (*Gamepads) Starts

func (g *Gamepads) Starts() int

Starts returns how many times the service was started.

Flutter: no counterpart

func (*Gamepads) Stop

func (g *Gamepads) Stop()

Stop implements platform.Gamepads.

type KeyEvent

type KeyEvent struct {
	// Data is the key event.
	Data ui.KeyData
}

KeyEvent delivers a key event to Handler.OnKey.

Flutter: no counterpart

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 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

func (p *Platform) Audio() *Audio

Audio returns the scripted audio service, which Services gives the engine.

Flutter: no counterpart

func (*Platform) Clipboard

func (p *Platform) Clipboard() 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

func (p *Platform) ClipboardText() (string, bool)

ClipboardText is the text that the in-memory clipboard holds, and whether it holds any.

Flutter: no counterpart

func (*Platform) Displays

func (p *Platform) Displays() []platform.Display

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

func (p *Platform) Gamepads() *Gamepads

Gamepads returns the scripted gamepad service, which Services gives the engine.

Flutter: no counterpart

func (*Platform) Inject

func (p *Platform) Inject(event Event)

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

func (p *Platform) Log() []Entry

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

func (p *Platform) NewWindow(cfg platform.WindowConfig) (platform.Window, error)

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

func (p *Platform) RequestActivationToken(view ui.ViewID, done func(token string))

RequestActivationToken records the request and answers with FakeActivationToken on the platform's thread.

Flutter: no counterpart

func (*Platform) Run

func (p *Platform) Run(ctx context.Context, h platform.Handler) error

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

func (p *Platform) Sensors() *Sensors

Sensors returns the scripted sensors service, which Services gives the engine.

Flutter: no counterpart

func (*Platform) Services

func (p *Platform) Services() 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

func (p *Platform) SetClipboardText(text string)

SetClipboardText sets the text of the in-memory clipboard, as another application would.

Flutter: no counterpart

func (*Platform) SetDisplays

func (p *Platform) SetDisplays(displays []platform.Display)

SetDisplays sets the displays that Displays reports.

Flutter: no counterpart

func (*Platform) SetSettings

func (p *Platform) SetSettings(settings platform.Settings)

SetSettings sets the settings that Settings reports, without notifying the handler. Use a SettingsEvent to notify it.

Flutter: no counterpart

func (*Platform) Settings

func (p *Platform) Settings() platform.Settings

Settings returns the current settings: the zero value, or what the last SettingsEvent or SetSettings set.

Flutter: no counterpart

func (*Platform) Windows

func (p *Platform) Windows() []*Window

Windows returns every window created so far, closed ones included, in creation order.

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

type PointerLockEndedEvent struct {
	// View is the view whose lock ended.
	View ui.ViewID
}

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

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

func (s *Sensors) FailOpen(err error)

FailOpen makes the next opens fail with err (nil makes them work again).

Flutter: no counterpart

func (*Sensors) Open

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

func (*Sensors) SetDenied

func (s *Sensors) SetDenied(kind platform.SensorKind, denied bool)

SetDenied makes the user refuse the sensor of the kind: opening it fails with SensorPermissionDenied.

Flutter: no counterpart

type SettingsEvent

type SettingsEvent struct {
	// Settings is the new settings.
	Settings platform.Settings
}

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) Closed

func (w *Window) Closed() bool

Closed returns whether Close was called.

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

func (w *Window) Hidden() bool

Hidden returns whether the last SetHidden was with true.

Flutter: no counterpart

func (*Window) ID

func (w *Window) ID() ui.ViewID

ID returns the window's view ID.

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

func (w *Window) KeepScreenOn(on bool) error

KeepScreenOn records the request and always succeeds.

Flutter: no counterpart

func (*Window) LockPointer

func (w *Window) LockPointer() error

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

func (w *Window) PointerLocked() bool

PointerLocked returns whether the pointer is locked to the window.

Flutter: no counterpart

func (*Window) PortalHandle

func (w *Window) PortalHandle(done func(handle string))

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

func (w *Window) ScreenKeptOn() bool

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

func (w *Window) SetHidden(hidden bool) bool

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) SetSize

func (w *Window) SetSize(size ui.Size)

SetSize records the new size.

Flutter: no counterpart

func (*Window) SetSizeConstraints

func (w *Window) SetSizeConstraints(min, max ui.Size)

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) SetTitle

func (w *Window) SetTitle(title string)

SetTitle records the new title.

Flutter: no counterpart

func (*Window) Size

func (w *Window) Size() ui.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

func (w *Window) Title() string

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

type WindowRecord

type WindowRecord struct {
	View   ui.ViewID
	Title  string
	Active bool
}

WindowRecord is what the engine told the accessibility bridge about a window.

Flutter: no counterpart

Jump to

Keyboard shortcuts

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