Skip to content

Commit

Permalink
test(clear): test Clear rendering (#432)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshka authored Aug 26, 2023
1 parent a890f2a commit e9bd736
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/widgets/clear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,28 @@ impl Widget for Clear {
}
}
}

#[cfg(test)]
mod tests {
use super::*;
use crate::assert_buffer_eq;

#[test]
fn render() {
let mut buf = Buffer::with_lines(vec!["xxxxxxxxxxxxxxx"; 7]);
let clear = Clear;
clear.render(Rect::new(1, 2, 3, 4), &mut buf);
assert_buffer_eq!(
buf,
Buffer::with_lines(vec![
"xxxxxxxxxxxxxxx",
"xxxxxxxxxxxxxxx",
"x xxxxxxxxxxx",
"x xxxxxxxxxxx",
"x xxxxxxxxxxx",
"x xxxxxxxxxxx",
"xxxxxxxxxxxxxxx",
])
);
}
}

0 comments on commit e9bd736

Please sign in to comment.