pub struct TestApp { /* private fields */ }Implementations§
Source§impl TestApp
impl TestApp
Sourcepub fn new<F, A>(build: F) -> Result<Self>
pub fn new<F, A>(build: F) -> Result<Self>
Examples found in repository?
examples/basic.rs (lines 15-22)
14fn main() -> Result<()> {
15 let app = TestApp::new(|| {
16 let state = Rc::new(RefCell::new(AppState::default()));
17 Application::new().window(
18 WindowBuilder::new()
19 .title("SUI Testing Example")
20 .root(ExampleRoot::new(state)),
21 )
22 })?;
23
24 let window = app.main_window()?;
25
26 window
27 .get_by_role(SemanticsRole::TextInput)
28 .with_name("Name")
29 .fill("Ada")?;
30 window
31 .get_by_role(SemanticsRole::Button)
32 .with_name("Save")
33 .click()?;
34 window.get_by_text("Saved").expect().to_be_visible()?;
35
36 println!("Example passed: filled the name field and observed the Saved status.");
37 Ok(())
38}pub fn new_with_vsync<F, A>(build: F, vsync_enabled: bool) -> Result<Self>
pub fn new_with_options<F, A>( build: F, vsync_enabled: bool, visible: bool, ) -> Result<Self>
pub fn new_no_vsync<F, A>(build: F) -> Result<Self>
pub fn new_visible_no_vsync<F, A>(build: F) -> Result<Self>
pub fn from_runtime(runtime: Runtime) -> Result<Self>
Sourcepub fn from_runtime_with_external_texture_registry(
runtime: Runtime,
registry: WgpuExternalTextureRegistry,
) -> Result<Self>
pub fn from_runtime_with_external_texture_registry( runtime: Runtime, registry: WgpuExternalTextureRegistry, ) -> Result<Self>
Build a headless test harness that can resolve app-owned WGPU textures.
pub fn from_runtime_with_frame_budget( runtime: Runtime, initial_frames: usize, ) -> Result<Self>
pub fn set_default_timeout(&self, timeout: f64) -> Result<()>
pub fn default_timeout(&self) -> f64
pub fn run_until_idle(&self) -> Result<()>
pub fn pump_frames(&self, frames: usize) -> Result<()>
pub fn advance_time(&self, delta: f64) -> Result<()>
pub fn windows(&self) -> Result<Vec<TestWindow>>
Sourcepub fn main_window(&self) -> Result<TestWindow>
pub fn main_window(&self) -> Result<TestWindow>
Examples found in repository?
examples/basic.rs (line 24)
14fn main() -> Result<()> {
15 let app = TestApp::new(|| {
16 let state = Rc::new(RefCell::new(AppState::default()));
17 Application::new().window(
18 WindowBuilder::new()
19 .title("SUI Testing Example")
20 .root(ExampleRoot::new(state)),
21 )
22 })?;
23
24 let window = app.main_window()?;
25
26 window
27 .get_by_role(SemanticsRole::TextInput)
28 .with_name("Name")
29 .fill("Ada")?;
30 window
31 .get_by_role(SemanticsRole::Button)
32 .with_name("Save")
33 .click()?;
34 window.get_by_text("Saved").expect().to_be_visible()?;
35
36 println!("Example passed: filled the name field and observed the Saved status.");
37 Ok(())
38}pub fn window_by_title(&self, title: &str) -> Result<TestWindow>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TestApp
impl !Send for TestApp
impl !Sync for TestApp
impl !UnwindSafe for TestApp
impl Freeze for TestApp
impl Unpin for TestApp
impl UnsafeUnpin for TestApp
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.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> ⓘ
Converts
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> ⓘ
Converts
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