added renderer test case

This commit is contained in:
Andreas Preikschat 2014-03-31 17:17:40 +02:00
parent c64723371a
commit d77c6fe7c0

View File

@ -49,7 +49,7 @@ class TestRenderer(TestCase):
def setUp(self): def setUp(self):
""" """
Set up the components need for all tests. Set up the components need for all tests
""" """
# Mocked out desktop object # Mocked out desktop object
self.desktop = MagicMock() self.desktop = MagicMock()
@ -67,7 +67,7 @@ class TestRenderer(TestCase):
def initial_renderer_test(self): def initial_renderer_test(self):
""" """
Test the initial renderer state . Test the initial renderer state
""" """
# GIVEN: A new renderer instance. # GIVEN: A new renderer instance.
renderer = Renderer() renderer = Renderer()
@ -77,7 +77,7 @@ class TestRenderer(TestCase):
def default_screen_layout_test(self): def default_screen_layout_test(self):
""" """
Test the default layout calculations. Test the default layout calculations
""" """
# GIVEN: A new renderer instance. # GIVEN: A new renderer instance.
renderer = Renderer() renderer = Renderer()
@ -86,4 +86,20 @@ class TestRenderer(TestCase):
self.assertEqual(renderer.width, 1024, 'The base renderer should be a live controller') self.assertEqual(renderer.width, 1024, 'The base renderer should be a live controller')
self.assertEqual(renderer.height, 768, 'The base renderer should be a live controller') self.assertEqual(renderer.height, 768, 'The base renderer should be a live controller')
self.assertEqual(renderer.screen_ratio, 0.75, 'The base renderer should be a live controller') self.assertEqual(renderer.screen_ratio, 0.75, 'The base renderer should be a live controller')
self.assertEqual(renderer.footer_start, 691, 'The base renderer should be a live controller') self.assertEqual(renderer.footer_start, 691, 'The base renderer should be a live controller')
def _get_start_tags_test(self):
"""
Test the _get_start_tags() method
"""
# GIVEN: A new renderer instance.
renderer = Renderer()
given_raw_text = '{st}{r}Text text text'
expected_tuple = ('{st}{r}Text text text{/r}{/st}', '{st}{r}',
'<strong><span style="-webkit-text-fill-color:red">')
# WHEN:
result = renderer._get_start_tags(given_raw_text)
# THEN:
self.assertEqual(result, expected_tuple)