mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-13 12:09:35 +03:00
Add a simple test for SGR
This commit is contained in:
parent
ce1514963b
commit
b343625b9f
@ -932,6 +932,14 @@ reset_mode(Screen *self, PyObject *args) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
_select_graphic_rendition(Screen *self, PyObject *args) {
|
||||
unsigned int params[256] = {0};
|
||||
for (int i = 0; i < PyTuple_GET_SIZE(args); i++) { params[i] = PyLong_AsUnsignedLong(PyTuple_GET_ITEM(args, i)); }
|
||||
select_graphic_rendition(self, params, PyList_GET_SIZE(args));
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
set_mode(Screen *self, PyObject *args) {
|
||||
int private = false;
|
||||
@ -1139,6 +1147,7 @@ static PyMethodDef methods[] = {
|
||||
MND(mouse_move_tracking_enabled, METH_NOARGS)
|
||||
MND(mouse_in_sgr_mode, METH_NOARGS)
|
||||
{"update_cell_data", (PyCFunction)screen_update_cell_data, METH_VARARGS, ""},
|
||||
{"select_graphic_rendition", (PyCFunction)_select_graphic_rendition, METH_VARARGS, ""},
|
||||
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
@ -313,3 +313,17 @@ class TestScreen(BaseTest):
|
||||
c = chr(ord('I') + l - 2)
|
||||
self.ae(c + ' ' * (s.columns - 2) + c.lower(), str(s.line(l)))
|
||||
s.reset_mode(DECOM)
|
||||
|
||||
def test_sgr(self):
|
||||
s = self.create_screen()
|
||||
s.select_graphic_rendition(0, 1, 37, 42)
|
||||
s.draw('a')
|
||||
c = s.line(0).cursor_from(0)
|
||||
self.assertTrue(c.bold)
|
||||
self.ae(c.bg, (2 << 8) | 1)
|
||||
s.cursor_position(2, 1)
|
||||
s.select_graphic_rendition(0, 35)
|
||||
s.draw('b')
|
||||
c = s.line(1).cursor_from(0)
|
||||
self.ae(c.fg, (5 << 8) | 1)
|
||||
self.ae(c.bg, 0)
|
||||
|
Loading…
Reference in New Issue
Block a user