test: basic tests to ensure render doesnt panic

should use buffer assertions in the future but this is a start
This commit is contained in:
EdJoPaTo
2024-05-01 18:24:53 +02:00
parent e9656f82d1
commit be05a341f4
+18
View File
@@ -338,3 +338,21 @@ where
StatefulWidget::render(self, area, buf, &mut state);
}
}
#[test]
fn does_not_panic_on_render() {
fn inner(width: u16, height: u16) {
let tree = Tree::new(TreeItem::example()).unwrap();
let area = Rect::new(0, 0, width, height);
let mut buffer = Buffer::empty(area);
Widget::render(tree, area, &mut buffer);
// TODO: assert buffer is empty
}
inner(0, 0);
inner(10, 0);
inner(0, 10);
// TODO: use dedicated test to ensure the content is correct
inner(10, 10);
}