@@ -0,0 +1,3087 @@
+from random import randint%0Aimport unittest%0Afrom asciimatics.screen import Screen%0A%0Aclass TestScreen(unittest.TestCase):%0A    def test_wrapper(self):%0A        %22%22%22%0A        Check that you can create a blank Screen.%0A        %22%22%22%0A        def internal_checks(screen):%0A            # Check screen basically exists%0A            self.assertIsNotNone(screen)%0A            self.assertGreater(screen.width, 0)%0A            self.assertGreater(screen.height, 0)%0A            self.assertGreater(screen.colours, 0)%0A%0A            # Check that the Screen is cleared ready for use.%0A            for x in range(screen.width):%0A                for y in range(screen.height):%0A                    char, fg, attr, bg = screen.get_from(x, y)%0A                    self.assertEqual(char, ord(%22 %22))%0A                    self.assertEqual(fg, Screen.COLOUR_WHITE)%0A                    self.assertEqual(attr, 0)%0A                    self.assertEqual(bg, Screen.COLOUR_BLACK)%0A%0A        Screen.wrapper(internal_checks)%0A%0A    def test_print_and_get(self):%0A        %22%22%22%0A        Check that basic print_at and get_from work as expected.%0A        %22%22%22%0A        def internal_checks(screen):%0A            for x in range(screen.width):%0A                for y in range(screen.height):%0A                    char = randint(0, 255)%0A                    fg = randint(0, Screen.COLOUR_WHITE)%0A                    bg = randint(0, Screen.COLOUR_WHITE)%0A                    attr = randint(0, Screen.A_UNDERLINE)%0A                    screen.print_at(chr(char), x, y, fg, attr, bg)%0A                    char2, fg2, attr2, bg2 = screen.get_from(x, y)%0A                    self.assertEqual(char, char2)%0A                    self.assertEqual(fg, fg2)%0A                    self.assertEqual(attr, attr2)%0A                    self.assertEqual(bg, bg2)%0A%0A        Screen.wrapper(internal_checks)%0A%0A    def test_visible(self):%0A        %22%22%22%0A        Check that is_visible works as expected.%0A        %22%22%22%0A        def internal_checks(screen):%0A            # Check some points that must always be visible%0A            self.assertTrue(screen.is_visible(0, 0))%0A            self.assertTrue(screen.is_visible(%0A                screen.width - 1, screen.height - 1))%0A%0A            # Check some points that cannot be visible%0A            self.assertFalse(screen.is_visible(-1, -1))%0A            self.assertFalse(screen.is_visible(%0A                screen.width, screen.height))%0A%0A        Screen.wrapper(internal_checks)%0A%0A    def test_paint(self):%0A        %22%22%22%0A        Check that paint with colour map works.%0A        %22%22%22%0A        def internal_checks(screen):%0A            # Put a simple colour map to screen.%0A            screen.paint(%0A                %22Text%22, 0, 0, colour_map=((1, 0, 4), (2, 0, 3), (3, 0, 2), (4, 0, 1)))%0A%0A            # Check it is rendered as expected.%0A            char, fg, _, bg = screen.get_from(0, 0)%0A            self.assertEqual(fg, 1)%0A            self.assertEqual(bg, 4)%0A            char, fg, _, bg = screen.get_from(3, 0)%0A            self.assertEqual(fg, 4)%0A            self.assertEqual(bg, 1)%0A%0A%0A        Screen.wrapper(internal_checks)%0A%0A%0Aif __name__ == '__main__':%0A    unittest.main()%0A

Add some basic low-level Screen UTs.