Skip to main content

UiDriver

Struct UiDriver 

Source
pub struct UiDriver<C, T = FixedText> { /* private fields */ }
Expand description

Drives a component on the test thread with an explicit clock for DSL timers.

Implementations§

Source§

impl<C: Component> UiDriver<C>

Source

pub fn headless(component: C, viewport: Size) -> Self

Use deterministic text metrics and a viewport in logical pixels.

Source§

impl<C: Component, T: TextMeasurer> UiDriver<C, T>

Source

pub fn new(component: C, text: T, viewport: Size) -> Self

Source

pub fn advance_time(&mut self, elapsed: Duration)

Advance DSL timers and deliver due callbacks using the runtime’s timer queue. Repeating timers coalesce missed ticks, just as in a desktop window.

Source

pub fn finish_loader_frame(&mut self) -> bool

Source

pub fn update(&mut self, update: impl FnOnce(&mut C))

Source

pub fn scroll(&mut self, id: &str, delta: Point) -> bool

Source

pub fn scroll_at(&mut self, point: Point, delta: Point) -> bool

Source

pub fn scroll_to_top(&mut self) -> bool

Source

pub fn scroll_bar(&self, id: &str) -> Option<ScrollBarGeometry>

Source

pub fn drag_scroll_bar(&mut self, id: &str, fraction: f32, touch: bool) -> bool

Source

pub fn drag_scroll_bar_with( &mut self, id: &str, fraction: f32, touch: bool, finish: impl FnOnce(&mut Self) -> bool, ) -> bool

Inspect the committed move before release. Returning false cancels the capture.

Source

pub fn scroll_bar_key(&mut self, key: NavigationKey) -> Option<bool>

Source

pub fn drag_viewport_from(&mut self, id: &str, delta: Point) -> bool

Source

pub fn scene(&self) -> &Node

Source

pub fn component(&self) -> &C

Source

pub fn input(&self) -> &Interaction

Source

pub fn find_path(&self, id: &str) -> Result<Vec<usize>, TargetError>

Resolve a unique ID among the materialized scene nodes.

Source

pub fn find_row_path( &self, view: &str, key: RowKey, child: Option<&str>, ) -> Result<Vec<usize>, TargetError>

Resolve a materialized row by its stable model key within the named view. Pass a child ID to select an element within that row.

Source

pub fn find_table_cell_path( &self, view: &str, key: RowKey, column: usize, ) -> Result<Vec<usize>, TargetError>

Resolve a materialized table cell by model row key and logical column index. The column index is the index used by the table’s selection API.

Source

pub fn path(&self, id: &str) -> Vec<usize>

Source

pub fn layout(&self) -> &LayoutNode

Prepared layout for the current frame, usable with the native renderer.

Source

pub fn bounds(&self, id: &str) -> Rect

Source

pub fn layout_at(&self, path: &[usize]) -> Option<&LayoutNode>

Source

pub fn node(&self, id: &str) -> &Node

Source

pub fn focused(&self) -> Option<&str>

Source

pub fn can_hit(&mut self, id: &str) -> bool

Source

pub fn click(&mut self, id: &str)

Source

pub fn click_at_path(&mut self, path: &[usize])

Source

pub fn activate(&mut self, key: ActivationKey) -> bool

Activate the focused control as with Enter or Space.

Source

pub fn tab(&mut self)

Source

pub fn begin_table_edit(&mut self) -> bool

Source

pub fn finish_table_edit(&mut self) -> TableEditCommit

Commit an active cell editor using normal validation and model writes.

Source

pub fn tab_with_direction(&mut self, backward: bool)

Source

pub fn group_key(&mut self, key: NavigationKey) -> bool

Source

pub fn back(&mut self) -> bool

Source

pub fn menus(&self) -> Vec<MenuPanel<'_>>

Source

pub fn context_menu(&mut self, id: &str) -> bool

Source

pub fn keyboard_context_menu(&mut self) -> bool

Source

pub fn menu_key(&mut self, key: MenuKey)

Source

pub fn menu_shortcut(&mut self, key: MenuShortcut) -> bool

Source

pub fn click_menu_row(&mut self, label: &str) -> bool

Source

pub fn choice_key(&mut self, key: ChoiceKey)

Source

pub fn escape(&mut self)

Source

pub fn fill_focused(&mut self, text: &str)

Replace all text in the focused editor through the normal edit pipeline.

Source

pub fn edit_focused(&mut self, action: EditAction<'_>) -> bool

Send an edit to the focused control or active table cell editor.

Auto Trait Implementations§

§

impl<C, T = FixedText> !RefUnwindSafe for UiDriver<C, T>

§

impl<C, T = FixedText> !Send for UiDriver<C, T>

§

impl<C, T = FixedText> !Sync for UiDriver<C, T>

§

impl<C, T = FixedText> !UnwindSafe for UiDriver<C, T>

§

impl<C, T> Forget for UiDriver<C, T>

§

impl<C, T> Freeze for UiDriver<C, T>
where C: Freeze, T: Freeze,

§

impl<C, T> Move for UiDriver<C, T>

§

impl<C, T> Unpin for UiDriver<C, T>
where T: Unpin, C: Unpin,

§

impl<C, T> UnsafeUnpin for UiDriver<C, T>
where C: UnsafeUnpin, T: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more