Start work on supporting changing of entries in the color table

This commit is contained in:
Kovid Goyal
2016-11-24 15:28:52 +05:30
parent c983f002c1
commit 3031d41e72
11 changed files with 53 additions and 99 deletions

View File

@@ -273,8 +273,8 @@ class TestDataTypes(BaseTest):
c.update_ansi_color_table(build_ansi_color_table())
for i in range(8):
col = getattr(defaults, 'color{}'.format(i))
self.assertEqual(c.ansi_color(30 + i), col[0] << 16 | col[1] << 8 | col[2])
self.ae(c.color_256(255), 0xeeeeee)
self.assertEqual(c.as_color(i << 8 | 1), (col[0], col[1], col[2]))
self.ae(c.as_color(255 << 8 | 1), (0xee, 0xee, 0xee))
def test_sprite_map(self):
s = SpriteMap(10, 2)

View File

@@ -123,14 +123,14 @@ class TestParser(BaseTest):
for attr in 'bold italic reverse strikethrough'.split():
self.assertTrue(getattr(s.cursor, attr))
self.ae(s.cursor.decoration, 1)
self.ae(s.cursor.fg, 34 << 8 | 1)
self.ae(s.cursor.bg, 44 << 8 | 1)
self.ae(s.cursor.fg, 4 << 8 | 1)
self.ae(s.cursor.bg, 4 << 8 | 1)
pb('\033[38;5;1;48;5;7m', ('select_graphic_rendition', 6))
self.ae(s.cursor.fg, 1 << 8 | 2)
self.ae(s.cursor.bg, 7 << 8 | 2)
self.ae(s.cursor.fg, 1 << 8 | 1)
self.ae(s.cursor.bg, 7 << 8 | 1)
pb('\033[38;2;1;2;3;48;2;7;8;9m', ('select_graphic_rendition', 10))
self.ae(s.cursor.fg, 1 << 24 | 2 << 16 | 3 << 8 | 3)
self.ae(s.cursor.bg, 7 << 24 | 8 << 16 | 9 << 8 | 3)
self.ae(s.cursor.fg, 1 << 24 | 2 << 16 | 3 << 8 | 2)
self.ae(s.cursor.bg, 7 << 24 | 8 << 16 | 9 << 8 | 2)
c = Callbacks()
s.callbacks = c
pb('\033[5n', ('report_device_status', 5, 0))