aboutsummaryrefslogtreecommitdiffstats
path: root/tests/init.rs
blob: ba54fd48234b2530afaac45d5b0812874f423217 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#[test]
fn init() {
    let parser = vt100::Parser::default();
    assert_eq!(parser.screen().size(), (24, 80));
    assert_eq!(parser.screen().cursor_position(), (0, 0));

    let cell = parser.screen().cell(0, 0);
    assert_eq!(cell.unwrap().contents(), "");
    let cell = parser.screen().cell(23, 79);
    assert_eq!(cell.unwrap().contents(), "");
    let cell = parser.screen().cell(24, 0);
    assert!(cell.is_none());
    let cell = parser.screen().cell(0, 80);
    assert!(cell.is_none());

    assert_eq!(parser.screen().contents(), "");
    assert_eq!(
        parser.screen().contents_formatted(),
        b"\x1b[?25h\x1b[m\x1b[H\x1b[J"
    );

    assert_eq!(parser.screen().title(), "");
    assert_eq!(parser.screen().icon_name(), "");

    assert!(!parser.screen().application_keypad());
    assert!(!parser.screen().application_cursor());
    assert!(!parser.screen().hide_cursor());
    assert!(!parser.screen().bracketed_paste());
    assert_eq!(
        parser.screen().mouse_protocol_mode(),
        vt100::MouseProtocolMode::None
    );
    assert_eq!(
        parser.screen().mouse_protocol_encoding(),
        vt100::MouseProtocolEncoding::Default
    );
}