module pkg::alloy::window::headlesssource
A window with no platform behind it, for tests: a list of events replayed through the program's handler, and the frames it presents kept for the test to look at.
type Framesource
exp type Frame = struct
A frame the program presented.
Fields
exp size: Sizeexp pixels: Vector<u32>
type Replaysource
exp type Replay<S> = struct
How a headless run went.
Fields
exp state: Sas the handler left it
exp frames: Vector<Frame>each one presented, in order
exp redraws: u32exp wakes: u32the times
wake_atchanged the deadlineexp closed: boolwhether the program closed the window
exp text_input: Option<Area>the input method's, as the program left it
exp secret_input: boolwhether the input method was told a password is typed
exp access: AccessTreethe accessibility tree the program sent
exp announcements: Vector<Announcement>what screen readers were given to say
exp clipboard: Stringthe clipboard, kept for the run
exp dialogs: Vector<FileDialog>the file dialogs the program asked for, which the events answer
exp history: Vector<HistoryEntry>each entry the program put the page's history at (
set_history), in orderexp language: String = String::from(&"en")the language the program said its content is in, and whether it reads right to left (
set_language)exp right_to_left: bool = false
fn run_headlesssource
exp fn run_headless<S>(
config: &WindowConfig,
scale: f32,
state: S,
handler: |&| (&var S, &var Window, &Event),
events: &[Event]
) -> Replay<S>
Runs the handler as run does, over the events instead of a
platform's. The window opens at the configuration's size and the scale
(Scaled when the scale is not 1, then Resized and Redraw); after
each event it delivers a Redraw when the event resized the window or
the handler asked for one, and a Clipboard when it asked for the
clipboard's text. It stops when the window closes or the events end.
The window's clock stands at 0 but as the events move it: a Redraw
among them moves it to the Redraw's time, giving the Timer wake_at
asked for on the way at its time, and every other event comes at the
time the clock is at.