summaryrefslogtreecommitdiffstats
path: root/src/tests/fakes/fake_output.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/fakes/fake_output.rs')
-rw-r--r--src/tests/fakes/fake_output.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/tests/fakes/fake_output.rs b/src/tests/fakes/fake_output.rs
index ac6f3cd..7741cc2 100644
--- a/src/tests/fakes/fake_output.rs
+++ b/src/tests/fakes/fake_output.rs
@@ -4,7 +4,11 @@ use std::{
sync::{Arc, Mutex},
};
-use ratatui::{backend::Backend, buffer::Cell, layout::Rect};
+use ratatui::{
+ backend::{Backend, WindowSize},
+ buffer::Cell,
+ layout::{Rect, Size},
+};
#[derive(Hash, Debug, PartialEq)]
pub enum TerminalEvent {
@@ -109,6 +113,16 @@ impl Backend for TestBackend {
Ok(Rect::new(0, 0, *terminal_width, *terminal_height))
}
+ fn window_size(&mut self) -> io::Result<WindowSize> {
+ let width = *self.terminal_width.lock().unwrap();
+ let height = *self.terminal_height.lock().unwrap();
+
+ Ok(WindowSize {
+ columns_rows: Size { width, height },
+ pixels: Size::default(),
+ })
+ }
+
fn flush(&mut self) -> io::Result<()> {
self.events.lock().unwrap().push(TerminalEvent::Flush);
Ok(())