pub struct Simulation { /* private fields */ }Expand description
A cloneable in-process controller for one Incular application window.
Calls block until the application’s UI thread services the command. Use this handle from a test/automation thread, not from an application build or event callback, because those already run on the UI thread.
Implementations§
Source§impl Simulation
impl Simulation
Sourcepub fn window(&self, handle: &WindowHandle) -> Self
pub fn window(&self, handle: &WindowHandle) -> Self
Returns a controller targeting the window represented by handle.
Sourcepub fn for_window(&self, window_id: WindowId) -> Self
pub fn for_window(&self, window_id: WindowId) -> Self
Returns a controller targeting a known Incular window ID.
pub const fn window_id(&self) -> WindowId
Sourcepub fn keyboard(&self) -> SimulationKeyboard
pub fn keyboard(&self) -> SimulationKeyboard
Returns the keyboard command group for this window.
Sourcepub fn click(&self, label: impl Into<String>) -> Result<(), SimulationError>
pub fn click(&self, label: impl Into<String>) -> Result<(), SimulationError>
Clicks the first enabled semantic node whose label exactly matches
label, using move → down → up through the ordinary pointer pipeline.
Sourcepub fn click_at(&self, position: Offset) -> Result<(), SimulationError>
pub fn click_at(&self, position: Offset) -> Result<(), SimulationError>
Clicks at position in logical pixels; the same as
Self::click_logical. Use Self::click_physical for a point read
off a Self::capture screenshot.
Sourcepub fn click_logical(&self, position: Offset) -> Result<(), SimulationError>
pub fn click_logical(&self, position: Offset) -> Result<(), SimulationError>
Clicks at position in logical pixels, the space layout bounds and
widget sizes use.
Sourcepub fn click_physical(&self, position: Offset) -> Result<(), SimulationError>
pub fn click_physical(&self, position: Offset) -> Result<(), SimulationError>
Clicks at position in physical pixels, the space of
Self::capture screenshots. The runtime divides it by the window’s
current scale factor before dispatch.
Sourcepub fn click_in(
&self,
position: Offset,
space: PointSpace,
) -> Result<(), SimulationError>
pub fn click_in( &self, position: Offset, space: PointSpace, ) -> Result<(), SimulationError>
Clicks at position in the given coordinate space.
Sourcepub fn scale_factor(&self) -> Result<f64, SimulationError>
pub fn scale_factor(&self) -> Result<f64, SimulationError>
The window’s current scale factor: physical pixels per logical pixel. Divide a screenshot point by it to get the logical point.
Sourcepub fn focus(&self, label: impl Into<String>) -> Result<(), SimulationError>
pub fn focus(&self, label: impl Into<String>) -> Result<(), SimulationError>
Gives keyboard focus to the first enabled semantic node whose label
exactly matches label; a text field also matches by its placeholder.
Focusable nodes take focus through their semantic focus action (no
pointer event, so no tap side effects); anything else is clicked at
its center, as a user would to focus it.
Sourcepub fn type_into(
&self,
label: impl Into<String>,
text: impl Into<String>,
) -> Result<(), SimulationError>
pub fn type_into( &self, label: impl Into<String>, text: impl Into<String>, ) -> Result<(), SimulationError>
Focuses the field labeled label (see Self::focus) and types
text into it at the caret. Self::type_text alone delivers text
only to an already focused field.
pub fn move_mouse_to(&self, position: Offset) -> Result<(), SimulationError>
pub fn scroll(&self, delta: Offset) -> Result<(), SimulationError>
pub fn key_down(&self, code: Code) -> Result<(), SimulationError>
pub fn key_up(&self, code: Code) -> Result<(), SimulationError>
pub fn press(&self, code: Code) -> Result<(), SimulationError>
pub fn press_key( &self, key: KeyboardKey, code: Code, ) -> Result<(), SimulationError>
pub fn type_text(&self, text: impl Into<String>) -> Result<(), SimulationError>
Sourcepub fn wait_for_frame(&self) -> Result<(), SimulationError>
pub fn wait_for_frame(&self) -> Result<(), SimulationError>
Waits until the next frame for this window has been presented.
Sourcepub fn capture(&self) -> Result<Screenshot, SimulationError>
pub fn capture(&self) -> Result<Screenshot, SimulationError>
Requests and returns the next rendered frame for this window.
The screenshot is in physical pixels. Click a point read off it with
Self::click_physical, or convert it with Self::scale_factor.
Sourcepub fn query_gpu_resources(&self) -> Result<GpuResourceSummary, SimulationError>
pub fn query_gpu_resources(&self) -> Result<GpuResourceSummary, SimulationError>
Reads the current GPU residency snapshot for this window’s device without presenting a frame. Resolves once the native adapter’s maintenance path fulfills it from current state.
Sourcepub fn release_all_keys(&self) -> Result<(), SimulationError>
pub fn release_all_keys(&self) -> Result<(), SimulationError>
Releases every modifier/key held by this simulation keyboard.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Simulation
impl Freeze for Simulation
impl Move for Simulation
impl RefUnwindSafe for Simulation
impl Send for Simulation
impl Sync for Simulation
impl Unpin for Simulation
impl UnsafeUnpin for Simulation
impl UnwindSafe for Simulation
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
Source§type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
Source§fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T, C> ComponentsInto<C> for T
impl<T, C> ComponentsInto<C> for T
Source§fn components_into(self) -> C
fn components_into(self) -> C
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.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, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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 moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more