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§
Sourcefn find(&self, id: impl Into<ElementId>) -> ElementSnapshot
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.
Sourcefn try_find(&self, id: impl Into<ElementId>) -> Option<ElementSnapshot>
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.
Sourcefn find_all(&self, id: impl Into<ElementId>) -> Vec<ElementSnapshot>
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).
Sourcefn within(&mut self, id: impl Into<ElementId>) -> ScopedWindow<'_>
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.
Sourcefn render_frame(&mut self, cx: &mut App)
fn render_frame(&mut self, cx: &mut App)
Refreshes and draws one frame so snapshots reflect external state changes.
Sourcefn click(&mut self, id: impl Into<ElementId>, cx: &mut App)
fn click(&mut self, id: impl Into<ElementId>, cx: &mut App)
Moves the pointer to the target center and dispatches a left click.
Sourcefn click_at(
&mut self,
id: impl Into<ElementId>,
offset: Point<Pixels>,
cx: &mut App,
)
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.
Sourcefn click_with_options(
&mut self,
id: impl Into<ElementId>,
options: ClickOptions,
cx: &mut App,
)
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.
Sourcefn right_click(&mut self, id: impl Into<ElementId>, cx: &mut App)
fn right_click(&mut self, id: impl Into<ElementId>, cx: &mut App)
Dispatches a centered right click on id.
Sourcefn double_click(&mut self, id: impl Into<ElementId>, cx: &mut App)
fn double_click(&mut self, id: impl Into<ElementId>, cx: &mut App)
Dispatches a centered left double-click on id.
Sourcefn hover(&mut self, id: impl Into<ElementId>, cx: &mut App)
fn hover(&mut self, id: impl Into<ElementId>, cx: &mut App)
Moves the pointer to the center of id without pressing a mouse button.
Sourcefn scroll(&mut self, id: impl Into<ElementId>, delta: ScrollDelta, cx: &mut App)
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.
Sourcefn drag(&mut self, from: Point<Pixels>, to: Point<Pixels>, cx: &mut App)
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.
Sourcefn drag_to(
&mut self,
from: impl Into<ElementId>,
to: impl Into<ElementId>,
cx: &mut App,
)
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.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".