aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-11-03 13:54:34 -0500
committerJesse Luehrs <doy@tozt.net>2019-11-03 13:54:34 -0500
commit3fb01c1d74debdb4c8fd7395f7a2e0671dfac46b (patch)
treedacde910750bdbf072eecb9c4a6de1322f123235 /tests
parent7a915a84819ef52561306c74ec813f57974265d2 (diff)
downloadvt100-rust-3fb01c1d74debdb4c8fd7395f7a2e0671dfac46b.tar.gz
vt100-rust-3fb01c1d74debdb4c8fd7395f7a2e0671dfac46b.zip
clean up public api a bit
Diffstat (limited to 'tests')
-rw-r--r--tests/basic.rs24
-rw-r--r--tests/escape.rs52
-rw-r--r--tests/init.rs18
-rw-r--r--tests/mode.rs343
-rw-r--r--tests/processing.rs76
5 files changed, 282 insertions, 231 deletions
diff --git a/tests/basic.rs b/tests/basic.rs
index 0d97bb5..071bdd3 100644
--- a/tests/basic.rs
+++ b/tests/basic.rs
@@ -1,8 +1,7 @@
#[test]
fn object_creation() {
let screen = vt100::Screen::new(24, 80);
- assert_eq!(screen.rows(), 24);
- assert_eq!(screen.cols(), 80);
+ assert_eq!(screen.window_size(), (24, 80));
}
#[test]
@@ -16,41 +15,34 @@ fn process_text() {
#[test]
fn set_window_size() {
let mut screen = vt100::Screen::new(24, 80);
- assert_eq!(screen.rows(), 24);
- assert_eq!(screen.cols(), 80);
+ assert_eq!(screen.window_size(), (24, 80));
assert_eq!(screen.cursor_position(), (0, 0));
screen.set_window_size(34, 8);
- assert_eq!(screen.rows(), 34);
- assert_eq!(screen.cols(), 8);
+ assert_eq!(screen.window_size(), (34, 8));
assert_eq!(screen.cursor_position(), (0, 0));
screen.process(b"\x1b[30;5H");
assert_eq!(screen.cursor_position(), (29, 4));
screen.set_window_size(24, 80);
- assert_eq!(screen.rows(), 24);
- assert_eq!(screen.cols(), 80);
+ assert_eq!(screen.window_size(), (24, 80));
assert_eq!(screen.cursor_position(), (23, 4));
screen.set_window_size(34, 8);
- assert_eq!(screen.rows(), 34);
- assert_eq!(screen.cols(), 8);
+ assert_eq!(screen.window_size(), (34, 8));
assert_eq!(screen.cursor_position(), (23, 4));
screen.process(b"\x1b[?1049h");
- assert_eq!(screen.rows(), 34);
- assert_eq!(screen.cols(), 8);
+ assert_eq!(screen.window_size(), (34, 8));
assert_eq!(screen.cursor_position(), (0, 0));
screen.set_window_size(24, 80);
- assert_eq!(screen.rows(), 24);
- assert_eq!(screen.cols(), 80);
+ assert_eq!(screen.window_size(), (24, 80));
assert_eq!(screen.cursor_position(), (0, 0));
screen.process(b"\x1b[?1049l");
- assert_eq!(screen.rows(), 24);
- assert_eq!(screen.cols(), 80);
+ assert_eq!(screen.window_size(), (24, 80));
assert_eq!(screen.cursor_position(), (23, 4));
}
diff --git a/tests/escape.rs b/tests/escape.rs
index cf46241..999074c 100644
--- a/tests/escape.rs
+++ b/tests/escape.rs
@@ -48,16 +48,17 @@ fn ris() {
assert!(!screen.underline());
assert!(!screen.inverse());
- assert!(!screen.hide_cursor());
+ assert!(!screen.check_visual_bell());
+ assert!(!screen.check_audible_bell());
assert!(!screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(!screen.bracketed_paste());
- assert!(!screen.check_visual_bell());
- assert!(!screen.check_audible_bell());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Default
+ );
screen.process(b"f\x1b[31m\x1b[47;1;3;4moo\x1b[7m\x1b[21;21H\x1b]2;window title\x07\x1b]1;window icon name\x07\x1b[?25l\x1b[?1h\x1b=\x1b[?9h\x1b[?1000h\x1b[?1006h\x1b[?2004h\x07\x1bg");
@@ -83,18 +84,20 @@ fn ris() {
assert!(screen.underline());
assert!(screen.inverse());
- assert!(screen.hide_cursor());
+ assert!(screen.check_visual_bell());
+ assert!(screen.check_audible_bell());
assert!(screen.application_keypad());
assert!(screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_any_motion());
- assert!(screen.mouse_reporting_sgr_mode());
- assert!(!screen.mouse_reporting_utf8_mode());
+ assert!(screen.hide_cursor());
assert!(screen.bracketed_paste());
- assert!(screen.check_visual_bell());
- assert!(screen.check_audible_bell());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Sgr
+ );
screen.process(b"\x1bc");
assert_eq!(screen.cursor_position(), (0, 0));
@@ -123,18 +126,17 @@ fn ris() {
assert!(!screen.underline());
assert!(!screen.inverse());
- assert!(!screen.hide_cursor());
+ assert!(!screen.check_visual_bell());
+ assert!(!screen.check_audible_bell());
assert!(!screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(!screen.bracketed_paste());
- assert!(!screen.check_visual_bell());
- assert!(!screen.check_audible_bell());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Default
+ );
}
#[test]
diff --git a/tests/init.rs b/tests/init.rs
index 4eb3910..ab56278 100644
--- a/tests/init.rs
+++ b/tests/init.rs
@@ -3,8 +3,7 @@
#[test]
fn init() {
let mut screen = vt100::Screen::new(24, 80);
- assert_eq!(screen.rows(), 24);
- assert_eq!(screen.cols(), 80);
+ assert_eq!(screen.window_size(), (24, 80));
assert_eq!(screen.cursor_position(), (0, 0));
let cell = screen.cell(0, 0);
@@ -36,14 +35,15 @@ fn init() {
assert!(!screen.underline());
assert!(!screen.inverse());
- assert!(!screen.hide_cursor());
+ assert!(!screen.check_visual_bell());
+ assert!(!screen.check_audible_bell());
assert!(!screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(!screen.bracketed_paste());
- assert!(!screen.check_visual_bell());
- assert!(!screen.check_audible_bell());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Default
+ );
}
diff --git a/tests/mode.rs b/tests/mode.rs
index d6807a9..2e10fee 100644
--- a/tests/mode.rs
+++ b/tests/mode.rs
@@ -3,276 +3,297 @@
#[test]
fn modes() {
let mut screen = vt100::Screen::new(24, 80);
- assert!(!screen.hide_cursor());
assert!(!screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(!screen.bracketed_paste());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Default
+ );
screen.process(b"\x1b[?1h");
- assert!(!screen.hide_cursor());
assert!(!screen.application_keypad());
assert!(screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(!screen.bracketed_paste());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Default
+ );
screen.process(b"\x1b[?9h");
- assert!(!screen.hide_cursor());
assert!(!screen.application_keypad());
assert!(screen.application_cursor());
- assert!(screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(!screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::Press
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Default
+ );
screen.process(b"\x1b[?25l");
- assert!(screen.hide_cursor());
assert!(!screen.application_keypad());
assert!(screen.application_cursor());
- assert!(screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(screen.hide_cursor());
assert!(!screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::Press
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Default
+ );
screen.process(b"\x1b[?1000h");
- assert!(screen.hide_cursor());
assert!(!screen.application_keypad());
assert!(screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(screen.hide_cursor());
assert!(!screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Default
+ );
screen.process(b"\x1b[?1002h");
- assert!(screen.hide_cursor());
assert!(!screen.application_keypad());
assert!(screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(screen.hide_cursor());
assert!(!screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::ButtonMotion
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Default
+ );
screen.process(b"\x1b[?1003h");
- assert!(screen.hide_cursor());
assert!(!screen.application_keypad());
assert!(screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(screen.hide_cursor());
assert!(!screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::AnyMotion
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Default
+ );
screen.process(b"\x1b[?1005h");
- assert!(screen.hide_cursor());
assert!(!screen.application_keypad());
assert!(screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(screen.mouse_reporting_any_motion());
- assert!(screen.mouse_reporting_utf8_mode());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(screen.hide_cursor());
assert!(!screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::AnyMotion
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Utf8
+ );
screen.process(b"\x1b[?1006h");
- assert!(screen.hide_cursor());
assert!(!screen.application_keypad());
assert!(screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(screen.mouse_reporting_sgr_mode());
+ assert!(screen.hide_cursor());
assert!(!screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::AnyMotion
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Sgr
+ );
screen.process(b"\x1b[?2004h");
- assert!(screen.hide_cursor());
assert!(!screen.application_keypad());
assert!(screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(screen.mouse_reporting_sgr_mode());
+ assert!(screen.hide_cursor());
assert!(screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::AnyMotion
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Sgr
+ );
screen.process(b"\x1b=");
- assert!(screen.hide_cursor());
assert!(screen.application_keypad());
assert!(screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(screen.mouse_reporting_sgr_mode());
+ assert!(screen.hide_cursor());
assert!(screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::AnyMotion
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Sgr
+ );
screen.process(b"\x1b[?1l");
- assert!(screen.hide_cursor());
assert!(screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(screen.mouse_reporting_sgr_mode());
+ assert!(screen.hide_cursor());
assert!(screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::AnyMotion
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Sgr
+ );
screen.process(b"\x1b[?9l");
- assert!(screen.hide_cursor());
assert!(screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(screen.mouse_reporting_sgr_mode());
+ assert!(screen.hide_cursor());
assert!(screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::AnyMotion
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Sgr
+ );
screen.process(b"\x1b[?25h");
- assert!(!screen.hide_cursor());
assert!(screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::AnyMotion
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Sgr
+ );
screen.process(b"\x1b[?1000l");
- assert!(!screen.hide_cursor());
assert!(screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::AnyMotion
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Sgr
+ );
screen.process(b"\x1b[?1002l");
- assert!(!screen.hide_cursor());
assert!(screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(screen.bracketed_paste());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::AnyMotion
+ );
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Sgr
+ );
screen.process(b"\x1b[?1003l");
- assert!(!screen.hide_cursor());
assert!(screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(screen.bracketed_paste());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Sgr
+ );
screen.process(b"\x1b[?1005l");
- assert!(!screen.hide_cursor());
assert!(screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(screen.bracketed_paste());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Sgr
+ );
screen.process(b"\x1b[?1006l");
- assert!(!screen.hide_cursor());
assert!(screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(screen.bracketed_paste());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Default
+ );
screen.process(b"\x1b[?2004l");
- assert!(!screen.hide_cursor());
assert!(screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(!screen.bracketed_paste());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Default
+ );
screen.process(b"\x1b>");
- assert!(!screen.hide_cursor());
assert!(!screen.application_keypad());
assert!(!screen.application_cursor());
- assert!(!screen.mouse_reporting_press());
- assert!(!screen.mouse_reporting_press_release());
- assert!(!screen.mouse_reporting_button_motion());
- assert!(!screen.mouse_reporting_any_motion());
- assert!(!screen.mouse_reporting_utf8_mode());
- assert!(!screen.mouse_reporting_sgr_mode());
+ assert!(!screen.hide_cursor());
assert!(!screen.bracketed_paste());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
+ assert_eq!(
+ screen.mouse_protocol_encoding(),
+ vt100::MouseProtocolEncoding::Default
+ );
}
#[test]
@@ -287,12 +308,12 @@ fn alternate_buffer() {
"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
);
assert_eq!(screen.cursor_position(), (0, 0));
- assert!(!screen.alternate_buffer_active());
+ assert!(!screen.alternate_screen());
screen.process(b"\x1b[m\x1b[2J\x1b[H1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19\r\n20\r\n21\r\n22\r\n23\r\n24");
assert_eq!(screen.window_contents(0, 0, 23, 79), "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n");
assert_eq!(screen.cursor_position(), (23, 2));
- assert!(!screen.alternate_buffer_active());
+ assert!(!screen.alternate_screen());
screen.process(b"\x1b[?47h");
assert_eq!(
@@ -300,7 +321,7 @@ fn alternate_buffer() {
"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
);
assert_eq!(screen.cursor_position(), (0, 0));
- assert!(screen.alternate_buffer_active());
+ assert!(screen.alternate_screen());
screen.process(b"foobar");
assert_eq!(
@@ -308,12 +329,12 @@ fn alternate_buffer() {
"foobar\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
);
assert_eq!(screen.cursor_position(), (0, 6));
- assert!(screen.alternate_buffer_active());
+ assert!(screen.alternate_screen());
screen.process(b"\x1b[?47l");
assert_eq!(screen.window_contents(0, 0, 23, 79), "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n");
assert_eq!(screen.cursor_position(), (23, 2));
- assert!(!screen.alternate_buffer_active());
+ assert!(!screen.alternate_screen());
screen.process(b"\x1b[?47h");
assert_eq!(
@@ -321,12 +342,12 @@ fn alternate_buffer() {
"foobar\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
);
assert_eq!(screen.cursor_position(), (0, 6));
- assert!(screen.alternate_buffer_active());
+ assert!(screen.alternate_screen());
screen.process(b"\x1b[?47l");
assert_eq!(screen.window_contents(0, 0, 23, 79), "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n");
assert_eq!(screen.cursor_position(), (23, 2));
- assert!(!screen.alternate_buffer_active());
+ assert!(!screen.alternate_screen());
// 1049
@@ -336,12 +357,12 @@ fn alternate_buffer() {
"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
);
assert_eq!(screen.cursor_position(), (0, 0));
- assert!(!screen.alternate_buffer_active());
+ assert!(!screen.alternate_screen());
screen.process(b"\x1b[m\x1b[2J\x1b[H1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19\r\n20\r\n21\r\n22\r\n23\r\n24");
assert_eq!(screen.window_contents(0, 0, 23, 79), "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n");
assert_eq!(screen.cursor_position(), (23, 2));
- assert!(!screen.alternate_buffer_active());
+ assert!(!screen.alternate_screen());
screen.process(b"\x1b[?1049h");
assert_eq!(
@@ -349,7 +370,7 @@ fn alternate_buffer() {
"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
);
assert_eq!(screen.cursor_position(), (0, 0));
- assert!(screen.alternate_buffer_active());
+ assert!(screen.alternate_screen());
screen.process(b"foobar");
assert_eq!(
@@ -357,12 +378,12 @@ fn alternate_buffer() {
"foobar\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
);
assert_eq!(screen.cursor_position(), (0, 6));
- assert!(screen.alternate_buffer_active());
+ assert!(screen.alternate_screen());
screen.process(b"\x1b[?1049l");
assert_eq!(screen.window_contents(0, 0, 23, 79), "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n");
assert_eq!(screen.cursor_position(), (23, 2));
- assert!(!screen.alternate_buffer_active());
+ assert!(!screen.alternate_screen());
screen.process(b"\x1b[?1049h");
assert_eq!(
@@ -370,10 +391,10 @@ fn alternate_buffer() {
"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
);
assert_eq!(screen.cursor_position(), (0, 0));
- assert!(screen.alternate_buffer_active());
+ assert!(screen.alternate_screen());
screen.process(b"\x1b[?1049l");
assert_eq!(screen.window_contents(0, 0, 23, 79), "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n");
assert_eq!(screen.cursor_position(), (23, 2));
- assert!(!screen.alternate_buffer_active());
+ assert!(!screen.alternate_screen());
}
diff --git a/tests/processing.rs b/tests/processing.rs
index b5b212a..7ee651e 100644
--- a/tests/processing.rs
+++ b/tests/processing.rs
@@ -39,94 +39,130 @@ fn split_escape_sequences() {
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
- assert!(!screen.mouse_reporting_press_release());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
screen.process(b"\x1b");
- assert!(!screen.mouse_reporting_press_release());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"[");
- assert!(!screen.mouse_reporting_press_release());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"?");
- assert!(!screen.mouse_reporting_press_release());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"1");
- assert!(!screen.mouse_reporting_press_release());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"0");
- assert!(!screen.mouse_reporting_press_release());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"0");
- assert!(!screen.mouse_reporting_press_release());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"0");
- assert!(!screen.mouse_reporting_press_release());
+ assert_eq!(screen.mouse_protocol_mode(), vt100::MouseProtocolMode::None);
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"h");
- assert!(screen.mouse_reporting_press_release());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
assert_eq!(screen.title(), "");
screen.process(b"\x1b");
assert_eq!(screen.title(), "");
- assert!(screen.mouse_reporting_press_release());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"]");
assert_eq!(screen.title(), "");
- assert!(screen.mouse_reporting_press_release());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"0");
assert_eq!(screen.title(), "");
- assert!(screen.mouse_reporting_press_release());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b";");
assert_eq!(screen.title(), "");
- assert!(screen.mouse_reporting_press_release());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"a");
assert_eq!(screen.title(), "");
- assert!(screen.mouse_reporting_press_release());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b" ");
assert_eq!(screen.title(), "");
- assert!(screen.mouse_reporting_press_release());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"'");
assert_eq!(screen.title(), "");
- assert!(screen.mouse_reporting_press_release());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"[");
assert_eq!(screen.title(), "");
- assert!(screen.mouse_reporting_press_release());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"]");
assert_eq!(screen.title(), "");
- assert!(screen.mouse_reporting_press_release());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"_");
assert_eq!(screen.title(), "");
- assert!(screen.mouse_reporting_press_release());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
screen.process(b"\x07");
assert_eq!(screen.title(), "a '[]_");
- assert!(screen.mouse_reporting_press_release());
+ assert_eq!(
+ screen.mouse_protocol_mode(),
+ vt100::MouseProtocolMode::PressRelease
+ );
assert_eq!(screen.cursor_position(), (11, 23));
assert_eq!(screen.window_contents(0, 0, 23, 79), contents);
}