[][src]Struct unsegen::base::terminal::test::FakeTerminal

pub struct FakeTerminal { /* fields omitted */ }

A fake terminal that can be used in tests to create windows and compare the resulting contents to the expected contents of windows.

Implementations

impl FakeTerminal[src]

pub fn with_size((w, h): (u32, u32)) -> Self[src]

Create a window with the specified (width, height).

pub fn from_str(
    (w, h): (u32, u32),
    description: &str
) -> Result<Self, ShapeError>
[src]

Create a fake terminal from a format string that looks roughly like this:

"1 1 2 2 3 3 4 4"

Spaces and newlines are ignored and the string is coerced into the specified size.

pub fn assert_looks_like(&self, string_description: &str)[src]

Test if the terminal contents look like the given format string. The rows are separated by a "|".

Examples:

use unsegen::base::terminal::test::FakeTerminal;
use unsegen::base::GraphemeCluster;

let mut term = FakeTerminal::with_size((2,3));
{
    let mut win = term.create_root_window();
    win.fill(GraphemeCluster::try_from('_').unwrap());
}

term.assert_looks_like("__|__|__");

pub fn create_root_window(&mut self) -> Window<'_>[src]

Create a root window that covers the whole terminal grid.

Trait Implementations

impl Debug for FakeTerminal[src]

impl PartialEq<FakeTerminal> for FakeTerminal[src]

impl StructuralPartialEq for FakeTerminal[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.