pub struct TestHost<W: View> { /* private fields */ }Expand description
A screen hosted for tests.
Implementations§
Source§impl<W: View> TestHost<W>
impl<W: View> TestHost<W>
Sourcepub fn new(vm: W::Vm) -> Self
pub fn new(vm: W::Vm) -> Self
The screen with vm, sized 427 × 240 (a common GUI size) — not
opened yet (see Self::open).
Sourcepub fn event(&mut self, raw: &str) -> bool
pub fn event(&mut self, raw: &str) -> bool
Sends a raw host event (click:X:Y, key:K:M, …), then a frame;
returns whether the screen consumed it.
Sourcepub fn click_path(&mut self, path: &[u16]) -> bool
pub fn click_path(&mut self, path: &[u16]) -> bool
Clicks (and releases) the middle of the widget at content path.
Sourcepub fn drag(&mut self, points: &[(f32, f32)]) -> bool
pub fn drag(&mut self, points: &[(f32, f32)]) -> bool
A mouse drag: the button goes down at the first point, moves through the others and comes up at the last; returns whether the press was consumed.
pub fn key_mods(&mut self, key: i32, mods: i32) -> bool
Sourcepub fn type_into(&mut self, id: &str, text: &str) -> &mut Self
pub fn type_into(&mut self, id: &str, text: &str) -> &mut Self
Clicks the text box id and types text at its end.
pub fn vm(&self) -> &W::Vm
Sourcepub fn vm_mut(&mut self) -> &mut W::Vm
pub fn vm_mut(&mut self) -> &mut W::Vm
The view model, for arranging state; the bindings update at the next frame.
Sourcepub fn handle(&self) -> ScreenHandle<W::Vm>
pub fn handle(&self) -> ScreenHandle<W::Vm>
A handle like the one register() returns.
Sourcepub fn path(&self, id: &str) -> Vec<u16>
pub fn path(&self, id: &str) -> Vec<u16>
Content path of the widget tagged id; panics when there’s none.
pub fn widget(&self, id: &str) -> Option<&Widget>
Sourcepub fn is_visible(&self, id: &str) -> bool
pub fn is_visible(&self, id: &str) -> bool
The widget id is visible (it and every ancestor).
pub fn state(&self, id: &str) -> StateFlags
pub fn node(&self, id: &str) -> Option<&LayoutNode>
pub fn rect(&self, id: &str) -> Option<Rect>
Sourcepub fn scroll_offset(&self, i: usize) -> f32
pub fn scroll_offset(&self, i: usize) -> f32
Scroll offset of scroller i.
Auto Trait Implementations§
impl<W> !RefUnwindSafe for TestHost<W>
impl<W> !UnwindSafe for TestHost<W>
impl<W> Freeze for TestHost<W>where
Host<W>: Freeze,
impl<W> Send for TestHost<W>where
Host<W>: Send,
impl<W> Sync for TestHost<W>where
Host<W>: Sync,
impl<W> Unpin for TestHost<W>where
Host<W>: Unpin,
impl<W> UnsafeUnpin for TestHost<W>where
Host<W>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.