コード例 #1
0
ファイル: test_terminal.py プロジェクト: amjith/curtsies
 def setUp(self):
     self.screen = ReportingScreen(6, 3)
     self.stream = ReportingStream()
     self.stream.attach(self.screen)
     self.stream.attach(Bugger())
     stdout = ScreenStdout(self.stream)
     self.window = CursorAwareWindow(out_stream=stdout,
                                     in_stream=self.screen._report_file)
     blessings.Terminal.height = 3
     blessings.Terminal.width = 6
コード例 #2
0
ファイル: test_terminal.py プロジェクト: amjith/curtsies
class TestCursorAwareWindow(unittest.TestCase):
    def setUp(self):
        self.screen = ReportingScreen(6, 3)
        self.stream = ReportingStream()
        self.stream.attach(self.screen)
        self.stream.attach(Bugger())
        stdout = ScreenStdout(self.stream)
        self.window = CursorAwareWindow(out_stream=stdout,
                                        in_stream=self.screen._report_file)
        blessings.Terminal.height = 3
        blessings.Terminal.width = 6

    def test_render(self):
        with self.window:
            self.assertEqual(self.window.top_usable_row, 0)
            self.window.render_to_terminal([u'hi', u'there'])
            self.assertEqual(self.screen.display,
                             [u'hi    ', u'there ', u'      '])

    def test_cursor_position(self):
        with self.window:
            self.window.render_to_terminal([u'hi', u'there'],
                                           cursor_pos=(2, 4))
            self.assertEqual(self.window.get_cursor_position(), (2, 4))

    def test_inital_cursor_position(self):

        self.screen.cursor.y += 1
        with self.window:
            self.assertEqual(self.window.top_usable_row, 1)
            self.window.render_to_terminal([u'hi', u'there'])
            self.assertEqual(self.screen.display,
                             [u'      ', u'hi    ', u'there '])
コード例 #3
0
ファイル: test_terminal.py プロジェクト: spthaolt/curtsies
class TestCursorAwareWindow(unittest.TestCase):
    def setUp(self):
        self.screen = ReportingScreen(6, 3)
        self.stream = ReportingStream()
        self.stream.attach(self.screen)
        self.stream.attach(Bugger())
        stdout = ScreenStdout(self.stream)
        self.window = CursorAwareWindow(out_stream=stdout,
                                        in_stream=self.screen._report_file)
        self.window.cbreak = NopContext()
        blessings.Terminal.height = 3
        blessings.Terminal.width = 6

    def test_render(self):
        with self.window:
            self.assertEqual(self.window.top_usable_row, 0)
            self.window.render_to_terminal([u'hi', u'there'])
            self.assertEqual(self.screen.display, [u'hi    ', u'there ', u'      '])

    def test_cursor_position(self):
        with self.window:
            self.window.render_to_terminal([u'hi', u'there'], cursor_pos=(2, 4))
            self.assertEqual(self.window.get_cursor_position(), (2, 4))

    def test_inital_cursor_position(self):

        self.screen.cursor.y += 1
        with self.window:
            self.assertEqual(self.window.top_usable_row, 1)
            self.window.render_to_terminal([u'hi', u'there'])
            self.assertEqual(self.screen.display, [u'      ', u'hi    ', u'there '])
コード例 #4
0
ファイル: test_terminal.py プロジェクト: adusca/curtsies
 def setUp(self):
     self.screen = ReportingScreen(6, 3)
     self.stream = ReportingStream()
     self.stream.attach(self.screen)
     self.stream.attach(Bugger())
     stdout = ScreenStdout(self.stream)
     self.window = CursorAwareWindow(out_stream=stdout,
                                     in_stream=self.screen._report_file)
     blessings.Terminal.height = 3
     blessings.Terminal.width = 6
コード例 #5
0
 def setUp(self):
     self.screen = ReportingScreenWithExtra(6, 3)
     self.stream = ReportingStream()
     self.stream.attach(self.screen)
     self.stream.attach(Bugger())
     stdout = ScreenStdout(self.stream)
     self.extra_bytes = []
     self.window = CursorAwareWindow(out_stream=stdout,
                                     in_stream=self.screen._report_file,
                                     extra_bytes_callback=self.extra_bytes_callback)
     self.window.cbreak = NopContext()
     blessings.Terminal.height = 3
     blessings.Terminal.width = 6
コード例 #6
0
class TestCursorAwareWindow(unittest.TestCase):
    def setUp(self):
        self.screen = ReportingScreen(6, 3)
        self.stream = ReportingStream()
        self.stream.attach(self.screen)
        self.stream.attach(Bugger())
        stdout = ScreenStdout(self.stream)
        self.window = CursorAwareWindow(out_stream=stdout,
                                        in_stream=self.screen._report_file)
        self.window.cbreak = NopContext()
        blessings.Terminal.height = 3
        blessings.Terminal.width = 6

    # This isn't passing locally for me anymore :/
    @expectedFailure
    def test_render(self):
        with self.window:
            self.assertEqual(self.window.top_usable_row, 0)
            self.window.render_to_terminal(["hi", "there"])
            self.assertEqual(self.screen.display,
                             ["hi    ", "there ", "      "])

    # This isn't passing locally for me anymore :/
    @expectedFailure
    def test_cursor_position(self):
        with self.window:
            self.window.render_to_terminal(["hi", "there"], cursor_pos=(2, 4))
            self.assertEqual(self.window.get_cursor_position(), (2, 4))

    # This isn't passing locally for me anymore :/
    @expectedFailure
    def test_inital_cursor_position(self):

        self.screen.cursor.y += 1
        with self.window:
            self.assertEqual(self.window.top_usable_row, 1)
            self.window.render_to_terminal(["hi", "there"])
            self.assertEqual(self.screen.display,
                             ["      ", "hi    ", "there "])