pub struct TuiSnapshot {
pub name: String,
pub hash: String,
pub width: u16,
pub height: u16,
pub content: Vec<String>,
pub metadata: HashMap<String, String>,
}Expand description
TUI Snapshot for golden file testing
Fields§
§name: StringSnapshot name/identifier
hash: StringContent hash for quick comparison
width: u16Frame width
height: u16Frame height
content: Vec<String>Frame content as lines
metadata: HashMap<String, String>Optional metadata
Implementations§
Source§impl TuiSnapshot
impl TuiSnapshot
Sourcepub fn from_frame(name: &str, frame: &TuiFrame) -> Self
pub fn from_frame(name: &str, frame: &TuiFrame) -> Self
Create a snapshot from a TUI frame
Sourcepub fn from_lines(name: &str, lines: &[&str]) -> Self
pub fn from_lines(name: &str, lines: &[&str]) -> Self
Create a snapshot from raw lines
Sourcepub fn with_metadata(self, key: &str, value: &str) -> Self
pub fn with_metadata(self, key: &str, value: &str) -> Self
Add metadata to the snapshot
Sourcepub fn matches(&self, other: &TuiSnapshot) -> bool
pub fn matches(&self, other: &TuiSnapshot) -> bool
Check if this snapshot matches another
Sourcepub fn save(&self, path: &Path) -> ProbarResult<()>
pub fn save(&self, path: &Path) -> ProbarResult<()>
Save snapshot to a YAML file
Sourcepub fn load(path: &Path) -> ProbarResult<Self>
pub fn load(path: &Path) -> ProbarResult<Self>
Load snapshot from a YAML file
Sourcepub fn assert_matches(&self, expected: &TuiSnapshot) -> ProbarResult<()>
pub fn assert_matches(&self, expected: &TuiSnapshot) -> ProbarResult<()>
Assert this snapshot matches an expected snapshot
Trait Implementations§
Source§impl Clone for TuiSnapshot
impl Clone for TuiSnapshot
Source§fn clone(&self) -> TuiSnapshot
fn clone(&self) -> TuiSnapshot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TuiSnapshot
impl Debug for TuiSnapshot
Source§impl<'de> Deserialize<'de> for TuiSnapshot
impl<'de> Deserialize<'de> for TuiSnapshot
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TuiSnapshot
impl RefUnwindSafe for TuiSnapshot
impl Send for TuiSnapshot
impl Sync for TuiSnapshot
impl Unpin for TuiSnapshot
impl UnsafeUnpin for TuiSnapshot
impl UnwindSafe for TuiSnapshot
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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