From df328c13903d5a0e595d27b14f79e2a61f66f8fc Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 27 Apr 2016 02:36:30 -0400 Subject: implement fgcolor and bgcolor for cells --- tests/basic.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/basic.rs') diff --git a/tests/basic.rs b/tests/basic.rs index 4828ea9..7af33f0 100644 --- a/tests/basic.rs +++ b/tests/basic.rs @@ -43,4 +43,28 @@ mod tests { assert_eq!(screen.cell(0, 5).unwrap().contents(), "r"); assert_eq!(screen.cell(0, 6).unwrap().contents(), ""); } + + #[test] + fn cell_colors() { + let mut screen = vt100::Screen::new(24, 80); + let input = b"foo\x1b[31m\x1b[32mb\x1b[3;7;42ma\x1b[23mr"; + screen.process(input); + + assert_eq!( + screen.cell(0, 0).unwrap().fgcolor(), + vt100::Color::ColorDefault + ); + assert_eq!( + screen.cell(0, 3).unwrap().fgcolor(), + vt100::Color::ColorIdx(2) + ); + assert_eq!( + screen.cell(0, 4).unwrap().fgcolor(), + vt100::Color::ColorIdx(2) + ); + assert_eq!( + screen.cell(0, 4).unwrap().bgcolor(), + vt100::Color::ColorIdx(2) + ); + } } -- cgit v1.2.3-54-g00ecf