Skip to main content

TestWindowExt

Trait TestWindowExt 

Source
pub trait TestWindowExt {
Show 17 methods // Required methods fn find(&self, id: impl Into<ElementId>) -> ElementSnapshot; fn try_find(&self, id: impl Into<ElementId>) -> Option<ElementSnapshot>; fn find_all(&self, id: impl Into<ElementId>) -> Vec<ElementSnapshot>; fn within(&mut self, id: impl Into<ElementId>) -> ScopedWindow<'_>; fn render_frame(&mut self, cx: &mut App); fn click(&mut self, id: impl Into<ElementId>, cx: &mut App); fn click_at( &mut self, id: impl Into<ElementId>, offset: Point<Pixels>, cx: &mut App, ); fn click_with_options( &mut self, id: impl Into<ElementId>, options: ClickOptions, cx: &mut App, ); fn right_click(&mut self, id: impl Into<ElementId>, cx: &mut App); fn double_click(&mut self, id: impl Into<ElementId>, cx: &mut App); fn hover(&mut self, id: impl Into<ElementId>, cx: &mut App); fn scroll( &mut self, id: impl Into<ElementId>, delta: ScrollDelta, cx: &mut App, ); fn drag(&mut self, from: Point<Pixels>, to: Point<Pixels>, cx: &mut App); fn drag_to( &mut self, from: impl Into<ElementId>, to: impl Into<ElementId>, cx: &mut App, ); fn press(&mut self, key: &str, cx: &mut App); fn input(&mut self, text: &str, cx: &mut App); // Provided method fn click_with_modifiers( &mut self, id: impl Into<ElementId>, modifiers: Modifiers, cx: &mut App, ) { ... }
}
Expand description

High-level query and native event dispatch operations on a GPUI Window.

Required Methods§

Source

fn find(&self, id: impl Into<ElementId>) -> ElementSnapshot

Returns the uniquely matching observed element from the last completed frame.

Panics with all registered element paths if the target is missing or ambiguous.

Source

fn try_find(&self, id: impl Into<ElementId>) -> Option<ElementSnapshot>

Returns the uniquely matching observed element if present, or None when absent.

Still panics if multiple registered paths match id in this scope.

Source

fn find_all(&self, id: impl Into<ElementId>) -> Vec<ElementSnapshot>

Returns all observed matches for id from the last completed frame, including invisible elements, ordered by bounds origin (y, x).

Source

fn within(&mut self, id: impl Into<ElementId>) -> ScopedWindow<'_>

Narrows subsequent queries and interactions to a GPUI ElementId scope without requiring an extra layout container.

Source

fn render_frame(&mut self, cx: &mut App)

Refreshes and draws one frame so snapshots reflect external state changes.

Source

fn click(&mut self, id: impl Into<ElementId>, cx: &mut App)

Moves the pointer to the target center and dispatches a left click.

Source

fn click_at( &mut self, id: impl Into<ElementId>, offset: Point<Pixels>, cx: &mut App, )

Clicks at a pixel offset relative to the target’s top-left corner.

Source

fn click_with_options( &mut self, id: impl Into<ElementId>, options: ClickOptions, cx: &mut App, )

Dispatches a configurable click sequence, temporarily applying and then restoring window modifiers while preserving Caps Lock.

Source

fn right_click(&mut self, id: impl Into<ElementId>, cx: &mut App)

Dispatches a centered right click on id.

Source

fn double_click(&mut self, id: impl Into<ElementId>, cx: &mut App)

Dispatches a centered left double-click on id.

Source

fn hover(&mut self, id: impl Into<ElementId>, cx: &mut App)

Moves the pointer to the center of id without pressing a mouse button.

Source

fn scroll(&mut self, id: impl Into<ElementId>, delta: ScrollDelta, cx: &mut App)

Moves the pointer to id and dispatches a native wheel scroll event.

Source

fn drag(&mut self, from: Point<Pixels>, to: Point<Pixels>, cx: &mut App)

Drags with the left mouse button between two window-local positions using interpolated pointer moves and native hit testing.

Source

fn drag_to( &mut self, from: impl Into<ElementId>, to: impl Into<ElementId>, cx: &mut App, )

Drags from the center of from to the center of to using native hit testing.

Source

fn press(&mut self, key: &str, cx: &mut App)

Dispatches native key-down and key-up events for a GPUI keystroke string (such as "backspace", "enter", "tab", or "secondary-c").

"enter" and "tab" invoke key bindings without synthesizing IME text.

Source

fn input(&mut self, text: &str, cx: &mut App)

Types Unicode text character-by-character into the current keyboard focus.

Provided Methods§

Source

fn click_with_modifiers( &mut self, id: impl Into<ElementId>, modifiers: Modifiers, cx: &mut App, )

Dispatches a centered left click with temporary modifiers, restoring previous modifiers afterward.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl TestWindowExt for Window

Source§

fn find(&self, id: impl Into<ElementId>) -> ElementSnapshot

Source§

fn try_find(&self, id: impl Into<ElementId>) -> Option<ElementSnapshot>

Source§

fn find_all(&self, id: impl Into<ElementId>) -> Vec<ElementSnapshot>

Source§

fn within(&mut self, id: impl Into<ElementId>) -> ScopedWindow<'_>

Source§

fn render_frame(&mut self, cx: &mut App)

Source§

fn click(&mut self, id: impl Into<ElementId>, cx: &mut App)

Source§

fn click_at( &mut self, id: impl Into<ElementId>, offset: Point<Pixels>, cx: &mut App, )

Source§

fn click_with_options( &mut self, id: impl Into<ElementId>, options: ClickOptions, cx: &mut App, )

Source§

fn right_click(&mut self, id: impl Into<ElementId>, cx: &mut App)

Source§

fn double_click(&mut self, id: impl Into<ElementId>, cx: &mut App)

Source§

fn hover(&mut self, id: impl Into<ElementId>, cx: &mut App)

Source§

fn scroll(&mut self, id: impl Into<ElementId>, delta: ScrollDelta, cx: &mut App)

Source§

fn drag_to( &mut self, from: impl Into<ElementId>, to: impl Into<ElementId>, cx: &mut App, )

Source§

fn drag(&mut self, from: Point<Pixels>, to: Point<Pixels>, cx: &mut App)

Source§

fn press(&mut self, key: &str, cx: &mut App)

Source§

fn input(&mut self, text: &str, cx: &mut App)

Implementors§