mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-14 00:47:14 +00:00
feat(test): expose test buffer (#160)
Allow a way to expose the buffer of the `TestBackend`, to easier support different testing methodologies.
This commit is contained in:
parent
5f12f06297
commit
86c3fc9fac
1 changed files with 10 additions and 1 deletions
|
@ -3,7 +3,10 @@ use crate::{
|
|||
buffer::{Buffer, Cell},
|
||||
layout::Rect,
|
||||
};
|
||||
use std::{fmt::Write, io};
|
||||
use std::{
|
||||
fmt::{Display, Write},
|
||||
io,
|
||||
};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
/// A backend used for the integration tests.
|
||||
|
@ -105,6 +108,12 @@ impl TestBackend {
|
|||
}
|
||||
}
|
||||
|
||||
impl Display for TestBackend {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", buffer_view(&self.buffer))
|
||||
}
|
||||
}
|
||||
|
||||
impl Backend for TestBackend {
|
||||
fn draw<'a, I>(&mut self, content: I) -> Result<(), io::Error>
|
||||
where
|
||||
|
|
Loading…
Reference in a new issue