pub struct TuiTestBackend {
pub width: u16,
pub height: u16,
/* private fields */
}Expand description
In-memory TUI test backend. Renders widgets to a buffer for assertions.
Fields§
§width: u16Width in columns.
height: u16Height in rows.
Implementations§
Source§impl TuiTestBackend
impl TuiTestBackend
Sourcepub fn with_deterministic(self, enabled: bool) -> Self
pub fn with_deterministic(self, enabled: bool) -> Self
Enable/disable deterministic mode.
Sourcepub fn draw_text(&mut self, x: u16, y: u16, text: &str, fg: (u8, u8, u8))
pub fn draw_text(&mut self, x: u16, y: u16, text: &str, fg: (u8, u8, u8))
Draw text at position.
Sourcepub fn extract_row(&self, y: u16) -> String
pub fn extract_row(&self, y: u16) -> String
Extract text from a row.
Sourcepub fn extract_text_at(&self, x: u16, y: u16) -> String
pub fn extract_text_at(&self, x: u16, y: u16) -> String
Extract text at position (reads until whitespace or boundary).
Sourcepub fn extract_region(
&self,
x: u16,
y: u16,
width: u16,
height: u16,
) -> Vec<String>
pub fn extract_region( &self, x: u16, y: u16, width: u16, height: u16, ) -> Vec<String>
Extract text in region.
Sourcepub fn to_string_plain(&self) -> String
pub fn to_string_plain(&self) -> String
Convert buffer to string representation.
Sourcepub fn frame_count(&self) -> u64
pub fn frame_count(&self) -> u64
Get current frame count.
Sourcepub fn metrics(&self) -> &RenderMetrics
pub fn metrics(&self) -> &RenderMetrics
Get render metrics.
Sourcepub fn snapshot(&self) -> TuiSnapshot
pub fn snapshot(&self) -> TuiSnapshot
Create a snapshot of current state.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TuiTestBackend
impl RefUnwindSafe for TuiTestBackend
impl Send for TuiTestBackend
impl Sync for TuiTestBackend
impl Unpin for TuiTestBackend
impl UnwindSafe for TuiTestBackend
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
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