Some simple tests for sc81t

This commit is contained in:
Kovid Goyal 2017-12-03 17:28:51 +05:30
parent c17c6cae4c
commit b191727567
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 13 additions and 1 deletions

View File

@ -283,8 +283,9 @@ handle_esc_mode_char(Screen *screen, uint32_t ch, PyObject DUMP_UNUSED *dump_cal
REPORT_COMMAND(screen_set_8bit_controls, ch == 'G'); REPORT_COMMAND(screen_set_8bit_controls, ch == 'G');
screen_set_8bit_controls(screen, ch == 'G'); screen_set_8bit_controls(screen, ch == 'G');
break; break;
} default:
REPORT_ERROR("Unhandled ESC SP escape code: 0x%x", ch); break; REPORT_ERROR("Unhandled ESC SP escape code: 0x%x", ch); break;
}
break; break;
default: default:
REPORT_ERROR("Unhandled charset related escape code: 0x%x 0x%x", screen->parser_buf[0], ch); break; REPORT_ERROR("Unhandled charset related escape code: 0x%x 0x%x", screen->parser_buf[0], ch); break;

View File

@ -215,6 +215,17 @@ class TestParser(BaseTest):
pb('\033P$qr\033\\', ('screen_request_capabilities', ord('$'), 'r')) pb('\033P$qr\033\\', ('screen_request_capabilities', ord('$'), 'r'))
self.ae(c.wtcbuf, '\033P1$r{};{}r\033\\'.format(s.margin_top + 1, s.margin_bottom + 1).encode('ascii')) self.ae(c.wtcbuf, '\033P1$r{};{}r\033\\'.format(s.margin_top + 1, s.margin_bottom + 1).encode('ascii'))
def test_sc81t(self):
s = self.create_screen()
pb = partial(self.parse_bytes_dump, s)
pb('\033 G', ('screen_set_8bit_controls', 1))
c = s.callbacks
pb('\033P$qm\033\\', ('screen_request_capabilities', ord('$'), 'm'))
self.ae(c.wtcbuf, b'\x901$r0m\x9c')
c.clear()
pb('\033[0c', ('report_device_attributes', 0, 0))
self.ae(c.wtcbuf, b'\x9b?62;c')
def test_oth_codes(self): def test_oth_codes(self):
s = self.create_screen() s = self.create_screen()
pb = partial(self.parse_bytes_dump, s) pb = partial(self.parse_bytes_dump, s)