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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
from . import VT100Test
class EscapeTest(VT100Test):
def test_deckpam(self):
assert not self.vt.application_keypad()
self.process("\033=")
assert self.vt.application_keypad()
self.process("\033>")
assert not self.vt.application_keypad()
def test_ri(self):
self.process("foo\nbar\033Mbaz")
assert self.vt.get_string_plaintext(0, 0, 23, 79) == 'foo baz\n bar' + ('\n' * 23)
def test_ris(self):
row, col = self.vt.cursor_pos()
assert row == 0
assert col == 0
cell = self.vt.cell(0, 0)
assert cell.contents() == ""
assert self.vt.get_string_plaintext(0, 0, 500, 500) == ('\n' * 24)
assert self.vt.get_string_formatted(0, 0, 500, 500) == ('\n' * 24)
assert self.vt.title() == ""
assert self.vt.icon_name() == ""
color = self.vt.default_fgcolor()
assert color.color() is None
color = self.vt.default_bgcolor()
assert color.color() is None
assert not self.vt.default_bold()
assert not self.vt.default_italic()
assert not self.vt.default_underline()
assert not self.vt.default_inverse()
assert not self.vt.hide_cursor()
assert not self.vt.application_keypad()
assert not self.vt.application_cursor()
assert not self.vt.mouse_reporting_press()
assert not self.vt.mouse_reporting_press_release()
assert not self.vt.mouse_reporting_button_motion()
assert not self.vt.mouse_reporting_sgr_mode()
assert not self.vt.bracketed_paste()
assert not self.vt.seen_visual_bell()
assert not self.vt.seen_audible_bell()
self.process("f\033[31m\033[47;1;3;4moo\033[7m\033[21;21H\033]2;window title\007\033]1;window icon name\007\033[?25l\033[?1h\033=\033[?9h\033[?1000h\033[?1002h\033[?1006h\033[?2004h\007\033g")
row, col = self.vt.cursor_pos()
assert row == 20
assert col == 20
cell = self.vt.cell(0, 0)
assert cell.contents() == "f"
assert self.vt.get_string_plaintext(0, 0, 500, 500) == 'foo' + ('\n' * 24)
assert self.vt.get_string_formatted(0, 0, 500, 500) == 'f\033[31;47;1;3;4moo' + ('\n' * 24)
assert self.vt.title() == "window title"
assert self.vt.icon_name() == "window icon name"
color = self.vt.default_fgcolor()
assert color.color() is 1
color = self.vt.default_bgcolor()
assert color.color() is 7
assert self.vt.default_bold()
assert self.vt.default_italic()
assert self.vt.default_underline()
assert self.vt.default_inverse()
assert self.vt.hide_cursor()
assert self.vt.application_keypad()
assert self.vt.application_cursor()
assert self.vt.mouse_reporting_press()
assert self.vt.mouse_reporting_press_release()
assert self.vt.mouse_reporting_button_motion()
assert self.vt.mouse_reporting_sgr_mode()
assert self.vt.bracketed_paste()
assert self.vt.seen_visual_bell()
assert self.vt.seen_audible_bell()
self.process("\033c")
row, col = self.vt.cursor_pos()
assert row == 0
assert col == 0
cell = self.vt.cell(0, 0)
assert cell.contents() == ""
assert self.vt.get_string_plaintext(0, 0, 500, 500) == ('\n' * 24)
assert self.vt.get_string_formatted(0, 0, 500, 500) == ('\n' * 24)
# title and icon name don't change with reset
assert self.vt.title() == "window title"
assert self.vt.icon_name() == "window icon name"
color = self.vt.default_fgcolor()
assert color.color() is None
color = self.vt.default_bgcolor()
assert color.color() is None
assert not self.vt.default_bold()
assert not self.vt.default_italic()
assert not self.vt.default_underline()
assert not self.vt.default_inverse()
assert not self.vt.hide_cursor()
assert not self.vt.application_keypad()
assert not self.vt.application_cursor()
assert not self.vt.mouse_reporting_press()
assert not self.vt.mouse_reporting_press_release()
assert not self.vt.mouse_reporting_button_motion()
assert not self.vt.mouse_reporting_sgr_mode()
assert not self.vt.bracketed_paste()
assert not self.vt.seen_visual_bell()
assert not self.vt.seen_audible_bell()
def test_vb(self):
assert not self.vt.seen_visual_bell()
self.process("\033g")
assert self.vt.seen_visual_bell()
assert not self.vt.seen_visual_bell()
def test_decsc(self):
self.process("foo\0337\r\n\r\n\r\n bar\0338baz")
assert self.vt.get_string_plaintext(0, 0, 23, 79) == 'foobaz\n\n\n bar' + ('\n' * 21)
|