perf: fast display (row runs, bulk fills, pixel scroll), terminal draws changed cells only + scrolls pixels, print! batched (was IPC per fmt fragment), snake sleeps on timer
This commit is contained in:
@@ -53,3 +53,14 @@ fn dimensions_response_roundtrip() {
|
||||
fn invalid_request_returns_none() {
|
||||
assert!(DisplayRequest::decode([99, 0, 0, 0]).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scroll_roundtrip() {
|
||||
let req = DisplayRequest::Scroll {
|
||||
top: ScreenCoord::new(0),
|
||||
height: Dimension::new(800),
|
||||
by: Dimension::new(16),
|
||||
fill: Color::from_raw(0x101018),
|
||||
};
|
||||
assert_eq!(DisplayRequest::decode(req.encode()), Some(req));
|
||||
}
|
||||
|
||||
@@ -167,3 +167,18 @@ fn text_past_the_edge_is_cut_not_wrapped() {
|
||||
server.handle(DisplayRequest::DrawText(low));
|
||||
assert_eq!(server.framebuffer().pixel_count(), 256);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_scroll_off_the_screen_moves_nothing() {
|
||||
let mut s = test_server();
|
||||
let scroll = |top| DisplayRequest::Scroll {
|
||||
top: ScreenCoord::new(top),
|
||||
height: Dimension::new(u16::MAX),
|
||||
by: Dimension::new(u16::MAX),
|
||||
fill: Color::from_raw(0),
|
||||
};
|
||||
s.handle(scroll(u16::MAX));
|
||||
assert_eq!(s.framebuffer().scrolls(), 0);
|
||||
s.handle(scroll(0));
|
||||
assert_eq!(s.framebuffer().scrolls(), 1, "clipped, then done");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user