pub struct ScopedWindow<'a> { /* private fields */ }Expand description
A borrowed GPUI ElementId scope returned by TestWindowExt::within.
Restricts descendant queries and scoped keyboard checks without inserting any extra layout wrapper into the element tree.
Implementations§
Source§impl ScopedWindow<'_>
impl ScopedWindow<'_>
Sourcepub fn find(&self, id: impl Into<ElementId>) -> ElementSnapshot
pub fn find(&self, id: impl Into<ElementId>) -> ElementSnapshot
Returns the uniquely matching observed descendant in this scope.
Sourcepub fn try_find(&self, id: impl Into<ElementId>) -> Option<ElementSnapshot>
pub fn try_find(&self, id: impl Into<ElementId>) -> Option<ElementSnapshot>
Returns the uniquely matching observed descendant in this scope, if present.
Sourcepub fn find_all(&self, id: impl Into<ElementId>) -> Vec<ElementSnapshot>
pub fn find_all(&self, id: impl Into<ElementId>) -> Vec<ElementSnapshot>
Returns all observed descendants matching id in this scope, ordered by (y, x).
Sourcepub fn within(&mut self, id: impl Into<ElementId>) -> ScopedWindow<'_>
pub fn within(&mut self, id: impl Into<ElementId>) -> ScopedWindow<'_>
Narrows further to a nested ElementId scope.
Sourcepub fn click(&mut self, id: impl Into<ElementId>, cx: &mut App)
pub fn click(&mut self, id: impl Into<ElementId>, cx: &mut App)
Dispatches a centered left click on a descendant in this scope.
Sourcepub fn click_at(
&mut self,
id: impl Into<ElementId>,
offset: Point<Pixels>,
cx: &mut App,
)
pub fn click_at( &mut self, id: impl Into<ElementId>, offset: Point<Pixels>, cx: &mut App, )
Clicks a descendant at a local pixel offset from its top-left corner.
Sourcepub fn click_with_options(
&mut self,
id: impl Into<ElementId>,
options: ClickOptions,
cx: &mut App,
)
pub fn click_with_options( &mut self, id: impl Into<ElementId>, options: ClickOptions, cx: &mut App, )
Dispatches a configurable click inside this scope, restoring prior modifiers.
Sourcepub fn click_with_modifiers(
&mut self,
id: impl Into<ElementId>,
modifiers: Modifiers,
cx: &mut App,
)
pub fn click_with_modifiers( &mut self, id: impl Into<ElementId>, modifiers: Modifiers, cx: &mut App, )
Dispatches a centered left click with temporary modifiers inside this scope.
Sourcepub fn right_click(&mut self, id: impl Into<ElementId>, cx: &mut App)
pub fn right_click(&mut self, id: impl Into<ElementId>, cx: &mut App)
Dispatches a centered right click on a descendant in this scope.
Sourcepub fn double_click(&mut self, id: impl Into<ElementId>, cx: &mut App)
pub fn double_click(&mut self, id: impl Into<ElementId>, cx: &mut App)
Dispatches a centered left double-click on a descendant in this scope.
Sourcepub fn hover(&mut self, id: impl Into<ElementId>, cx: &mut App)
pub fn hover(&mut self, id: impl Into<ElementId>, cx: &mut App)
Moves the pointer to the center of a descendant in this scope.
Sourcepub fn scroll(
&mut self,
id: impl Into<ElementId>,
delta: ScrollDelta,
cx: &mut App,
)
pub fn scroll( &mut self, id: impl Into<ElementId>, delta: ScrollDelta, cx: &mut App, )
Dispatches a wheel scroll event over a descendant in this scope.
Sourcepub fn drag_to(
&mut self,
from: impl Into<ElementId>,
to: impl Into<ElementId>,
cx: &mut App,
)
pub fn drag_to( &mut self, from: impl Into<ElementId>, to: impl Into<ElementId>, cx: &mut App, )
Drags between two descendants resolved within this scope.
Trait Implementations§
Source§impl TestQueryExt for ScopedWindow<'_>
impl TestQueryExt for ScopedWindow<'_>
Source§fn elements(&self) -> Vec<ElementSnapshot>
fn elements(&self) -> Vec<ElementSnapshot>
(y, x, path).Source§fn texts(&self) -> Vec<TextSnapshot>
fn texts(&self) -> Vec<TextSnapshot>
Source§fn find_by_label(&self, label: &str) -> ElementSnapshot
fn find_by_label(&self, label: &str) -> ElementSnapshot
label. Panics on absence or ambiguity.Source§fn try_find_by_label(&self, label: &str) -> Option<ElementSnapshot>
fn try_find_by_label(&self, label: &str) -> Option<ElementSnapshot>
label,
or None if absent. Panics on ambiguity.Source§fn find_all_by_label(&self, label: &str) -> Vec<ElementSnapshot>
fn find_all_by_label(&self, label: &str) -> Vec<ElementSnapshot>
label, ordered by (y, x, path).Source§fn find_all_by_role(&self, role: Role) -> Vec<ElementSnapshot>
fn find_all_by_role(&self, role: Role) -> Vec<ElementSnapshot>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ScopedWindow<'a>
impl<'a> !Send for ScopedWindow<'a>
impl<'a> !Sync for ScopedWindow<'a>
impl<'a> !UnwindSafe for ScopedWindow<'a>
impl<'a> Forget for ScopedWindow<'a>
impl<'a> Freeze for ScopedWindow<'a>
impl<'a> Move for ScopedWindow<'a>
impl<'a> Unpin for ScopedWindow<'a>
impl<'a> UnsafeUnpin for ScopedWindow<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more