Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
osa1 committed Nov 5, 2023
1 parent 00411c0 commit fd8bf02
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion crates/libtiny_tui/src/tests/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ fn test_compact_layout_activity_timestamp() {

// Test that a timestamp is printed after a `clear`.
#[test]
fn test_clear_timestamp() {
fn test_clear_timestamp_aligned() {
let (mut tui, target) = setup_aligned_tui();

let ts = time::at_utc(time::Timespec::new(0, 0));
Expand All @@ -506,3 +506,25 @@ fn test_clear_timestamp() {

expect_screen(screen, &tui.get_front_buffer(), 40, 5, Location::caller());
}

// Same as `test_clear_timestamp_aligned`, but for compact layout.
#[test]
fn test_clear_timestamp_compact() {
let (mut tui, target) = setup_compact_tui();

let ts = time::at_utc(time::Timespec::new(0, 0));
tui.add_nick("test1", Some(ts), &target);
tui.clear(&target);
tui.add_nick("test2", Some(ts), &target);
tui.draw();

#[rustfmt::skip]
let screen =
"| |
| |
|00:00 +test2 |
|osa1: |
|mentions irc.server_1.org #chan |";

expect_screen(screen, &tui.get_front_buffer(), 40, 5, Location::caller());
}

0 comments on commit fd8bf02

Please sign in to comment.