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, T: TextMeasurer> UiDriver<C, T>
impl<C: Component, T: TextMeasurer> UiDriver<C, T>
pub fn new(component: C, text: T, viewport: Size) -> Self
Sourcepub fn advance_time(&mut self, elapsed: Duration)
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.
pub fn finish_loader_frame(&mut self) -> bool
pub fn update(&mut self, update: impl FnOnce(&mut C))
pub fn scroll(&mut self, id: &str, delta: Point) -> bool
pub fn scroll_at(&mut self, point: Point, delta: Point) -> bool
pub fn scroll_bar(&self, id: &str) -> Option<ScrollBarGeometry>
pub fn drag_scroll_bar(&mut self, id: &str, fraction: f32, touch: bool) -> bool
Sourcepub fn drag_scroll_bar_with(
&mut self,
id: &str,
fraction: f32,
touch: bool,
finish: impl FnOnce(&mut Self) -> bool,
) -> bool
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.
pub fn scroll_bar_key(&mut self, key: NavigationKey) -> Option<bool>
pub fn drag_viewport_from(&mut self, id: &str, delta: Point) -> bool
pub fn scene(&self) -> &Node
pub fn component(&self) -> &C
pub fn input(&self) -> &Interaction
Sourcepub fn find_path(&self, id: &str) -> Result<Vec<usize>, TargetError>
pub fn find_path(&self, id: &str) -> Result<Vec<usize>, TargetError>
Resolve a unique ID among the materialized scene nodes.
Sourcepub fn find_row_path(
&self,
view: &str,
key: RowKey,
child: Option<&str>,
) -> Result<Vec<usize>, TargetError>
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.
Sourcepub fn find_table_cell_path(
&self,
view: &str,
key: RowKey,
column: usize,
) -> Result<Vec<usize>, TargetError>
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.
pub fn path(&self, id: &str) -> Vec<usize>
Sourcepub fn layout(&self) -> &LayoutNode
pub fn layout(&self) -> &LayoutNode
Prepared layout for the current frame, usable with the native renderer.
pub fn bounds(&self, id: &str) -> Rect
pub fn layout_at(&self, path: &[usize]) -> Option<&LayoutNode>
pub fn node(&self, id: &str) -> &Node
pub fn focused(&self) -> Option<&str>
pub fn can_hit(&mut self, id: &str) -> bool
pub fn click(&mut self, id: &str)
pub fn click_at_path(&mut self, path: &[usize])
Sourcepub fn activate(&mut self, key: ActivationKey) -> bool
pub fn activate(&mut self, key: ActivationKey) -> bool
Activate the focused control as with Enter or Space.
pub fn tab(&mut self)
pub fn begin_table_edit(&mut self) -> bool
Sourcepub fn finish_table_edit(&mut self) -> TableEditCommit
pub fn finish_table_edit(&mut self) -> TableEditCommit
Commit an active cell editor using normal validation and model writes.
pub fn tab_with_direction(&mut self, backward: bool)
pub fn group_key(&mut self, key: NavigationKey) -> bool
pub fn back(&mut self) -> bool
pub fn choice_key(&mut self, key: ChoiceKey)
pub fn escape(&mut self)
Sourcepub fn fill_focused(&mut self, text: &str)
pub fn fill_focused(&mut self, text: &str)
Replace all text in the focused editor through the normal edit pipeline.
Sourcepub fn edit_focused(&mut self, action: EditAction<'_>) -> bool
pub fn edit_focused(&mut self, action: EditAction<'_>) -> bool
Send an edit to the focused control or active table cell editor.