summaryrefslogtreecommitdiff
path: root/helix-tui/tests/terminal.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-05-09 08:52:55 +0000
committerBlaž Hrastnik2021-05-09 08:52:55 +0000
commit35606a3daa7ee273845a12f3e03728e0ae23928e (patch)
tree643684eaff6627dbebc4156d33fdb541bf87bbd9 /helix-tui/tests/terminal.rs
parent6c705f09e88a4b63c4ed854bc9e956b0539ca8af (diff)
Inline tui as helix-tui fork.
We only rely on some of the rendering primitives and implement our Cursive-style compositor on top.
Diffstat (limited to 'helix-tui/tests/terminal.rs')
-rw-r--r--helix-tui/tests/terminal.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/helix-tui/tests/terminal.rs b/helix-tui/tests/terminal.rs
new file mode 100644
index 00000000..4734dd9a
--- /dev/null
+++ b/helix-tui/tests/terminal.rs
@@ -0,0 +1,36 @@
+use helix_tui::{
+ backend::{Backend, TestBackend},
+ layout::Rect,
+ widgets::Paragraph,
+ Terminal,
+};
+use std::error::Error;
+
+#[test]
+fn terminal_buffer_size_should_be_limited() {
+ let backend = TestBackend::new(400, 400);
+ let terminal = Terminal::new(backend).unwrap();
+ let size = terminal.backend().size().unwrap();
+ assert_eq!(size.width, 255);
+ assert_eq!(size.height, 255);
+}
+
+// #[test]
+// fn terminal_draw_returns_the_completed_frame() -> Result<(), Box<dyn Error>> {
+// let backend = TestBackend::new(10, 10);
+// let mut terminal = Terminal::new(backend)?;
+// let frame = terminal.draw(|f| {
+// let paragrah = Paragraph::new("Test");
+// f.render_widget(paragrah, f.size());
+// })?;
+// assert_eq!(frame.buffer.get(0, 0).symbol, "T");
+// assert_eq!(frame.area, Rect::new(0, 0, 10, 10));
+// terminal.backend_mut().resize(8, 8);
+// let frame = terminal.draw(|f| {
+// let paragrah = Paragraph::new("test");
+// f.render_widget(paragrah, f.size());
+// })?;
+// assert_eq!(frame.buffer.get(0, 0).symbol, "t");
+// assert_eq!(frame.area, Rect::new(0, 0, 8, 8));
+// Ok(())
+// }