From fd8bf02626d7b45593f5944204ad82f6308b4aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Sun, 5 Nov 2023 12:29:41 +0100 Subject: [PATCH] More tests --- crates/libtiny_tui/src/tests/layout.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/crates/libtiny_tui/src/tests/layout.rs b/crates/libtiny_tui/src/tests/layout.rs index 42a85aae..46ab8f21 100644 --- a/crates/libtiny_tui/src/tests/layout.rs +++ b/crates/libtiny_tui/src/tests/layout.rs @@ -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)); @@ -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()); +}