pub struct HeadlessHandle { /* private fields */ }Expand description
Shared access to a HeadlessBackend after it was moved into a Ui.
Implementations§
Source§impl HeadlessHandle
impl HeadlessHandle
Sourcepub fn record_commands(&self, on: bool)
pub fn record_commands(&self, on: bool)
Records the commands applied from now on, for command_log and
take_command_log, or stops and drops them.
Sourcepub fn command_log(&self) -> Vec<Command>
pub fn command_log(&self) -> Vec<Command>
Every command applied since recording started (record_commands),
in order.
pub fn take_command_log(&self) -> Vec<Command>
Sourcepub fn app_locale(&self) -> Option<(String, bool)>
pub fn app_locale(&self) -> Option<(String, bool)>
The app’s language as the core last gave it (Backend::set_locale),
and whether it’s right to left.
Sourcepub fn resize_window(&self, window: NodeId, size: Size)
pub fn resize_window(&self, window: NodeId, size: Size)
Simulates the user resizing a window, which goes no smaller than its minimum size, and keeps its height if its content sets it. A window that isn’t resizable keeps its size.
Sourcepub fn set_window_active(&self, window: NodeId, active: bool)
pub fn set_window_active(&self, window: NodeId, active: bool)
Simulates a window becoming the active one, or another taking over.
Sourcepub fn active_window(&self) -> Option<NodeId>
pub fn active_window(&self) -> Option<NodeId>
The window taking keys: the last one presented or made active.
Sourcepub fn set_full_screen(&self, window: NodeId, on: bool)
pub fn set_full_screen(&self, window: NodeId, on: bool)
Simulates the user putting a window in full screen, or taking it out (the title bar’s button, the window manager’s key).
Sourcepub fn new_window_at(&self) -> Point
pub fn new_window_at(&self) -> Point
Where a new window opens when nothing places it.
Sourcepub fn move_window(&self, window: NodeId, to: Point)
pub fn move_window(&self, window: NodeId, to: Point)
Simulates the user moving a window by its title bar; it stays on the screen.
Sourcepub fn set_maximized(&self, window: NodeId, on: bool)
pub fn set_maximized(&self, window: NodeId, on: bool)
Simulates the user maximizing a window, or restoring it (the title bar’s button, a double-click on it, the window manager’s key).
Simulates the user showing or hiding a window’s sidebar (the platform’s toggle, its divider dragged away).
Sourcepub fn set_viewport_insets(&self, scroll_view: NodeId, insets: Insets)
pub fn set_viewport_insets(&self, scroll_view: NodeId, insets: Insets)
Simulates a platform whose scroll bars take room from a scroll view’s content, as classic scroll bars do (the viewport is inside these insets).
Sourcepub fn set_metrics(&self, metrics: PlatformMetrics)
pub fn set_metrics(&self, metrics: PlatformMetrics)
Simulates a change of system settings (text size, dark mode, …).
pub fn focused(&self) -> Option<NodeId>
Sourcepub fn deactivate(&self, window: NodeId)
pub fn deactivate(&self, window: NodeId)
Simulates the user switching to another app: the window’s GPU surfaces lose their pointer lock and keyboard grab, as every platform ends them.
Sourcepub fn move_locked_pointer(&self, surface: NodeId, dx: f32, dy: f32)
pub fn move_locked_pointer(&self, surface: NodeId, dx: f32, dy: f32)
Simulates the mouse moving while a surface holds the pointer: its move with the host’s acceleration, and before it. Headless has no acceleration, and one count to a point.
pub fn a11y(&self, id: NodeId) -> Option<A11yProps>
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of live native nodes: a leak detector for tests.
Trait Implementations§
Source§impl Clone for HeadlessHandle
impl Clone for HeadlessHandle
Source§impl TestHooks for HeadlessHandle
impl TestHooks for HeadlessHandle
Source§fn hit(&self, window: NodeId, at: Point) -> Result<Option<NodeId>, ActionError>
fn hit(&self, window: NodeId, at: Point) -> Result<Option<NodeId>, ActionError>
The topmost node with a frame there (later children are over earlier ones), past containers clicks pass through.
Source§fn dragged_files(&self, node: NodeId) -> Option<Vec<PathBuf>>
fn dragged_files(&self, node: NodeId) -> Option<Vec<PathBuf>>
The selected rows’ files if the row is selected, else its own, as platforms’ lists drag.
Source§fn app_info(&self, _window: NodeId) -> NativeAppInfo
fn app_info(&self, _window: NodeId) -> NativeAppInfo
All of it, as every platform has a place for some of it; the icon’s size from its PNG header.
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
"appkit",
"gtk", "winui", "kirigami".Source§fn resize_window(&self, window: NodeId, size: Size)
fn resize_window(&self, window: NodeId, size: Size)
WindowResized.Source§fn close_window(&self, window: NodeId)
fn close_window(&self, window: NodeId)
WindowCloseRequested. Whether it closes is the
app’s call.