Tidy up tests and formatting

This commit is contained in:
Stewart Becker 2014-07-22 21:06:48 +01:00
parent 9a1ce000b7
commit 668864c38d
2 changed files with 15 additions and 9 deletions

View File

@ -13,7 +13,6 @@ from openlp.core.lib.theme import HorizontalType, VerticalType
from tests.functional import MagicMock, patch
from tests.helpers.testmixin import TestMixin
HTML = """
<!DOCTYPE html>
<html>
@ -216,7 +215,6 @@ class Htmbuilder(TestCase, TestMixin):
"""
self.destroy_settings()
def build_html_test(self):
"""
Test the build_html() function
@ -342,6 +340,18 @@ class Htmbuilder(TestCase, TestMixin):
# THEN: THE css should be the same.
assert FOOTER_CSS == css, 'The footer strings should be equal.'
def build_footer_css_wrap_test(self):
"""
Test the build_footer_css() function
"""
# GIVEN: Create a theme.
item = MagicMock()
item.footer = QtCore.QRect(10, 921, 1260, 103)
item.theme_data.font_footer_name = 'Arial'
item.theme_data.font_footer_size = 12
item.theme_data.font_footer_color = '#FFFFFF'
height = 1024
# WHEN: Settings say that footer should wrap
Settings().setValue('themes/wrap footer', True)
css = build_footer_css(item, height)

View File

@ -504,7 +504,6 @@ class TestSlideController(TestCase):
mocked_item = MagicMock()
mocked_item.is_command.return_value = True
mocked_item.name = 'Mocked Item'
mocked_execute = MagicMock()
mocked_update_preview = MagicMock()
mocked_preview_widget = MagicMock()
mocked_slide_selected = MagicMock()
@ -516,10 +515,10 @@ class TestSlideController(TestCase):
slide_controller.preview_widget = mocked_preview_widget
slide_controller.slide_selected = mocked_slide_selected
slide_controller.is_live = True
# WHEN: The method is called
slide_controller.on_slide_selected_index([9])
# THEN: It should have sent a notification
mocked_item.is_command.assert_called_once_with()
mocked_execute.assert_called_once_with('mocked item_slide', [mocked_item, True, 9])
@ -535,7 +534,6 @@ class TestSlideController(TestCase):
mocked_item = MagicMock()
mocked_item.is_command.return_value = False
mocked_item.name = 'Mocked Item'
mocked_execute = MagicMock()
mocked_update_preview = MagicMock()
mocked_preview_widget = MagicMock()
mocked_slide_selected = MagicMock()
@ -546,7 +544,7 @@ class TestSlideController(TestCase):
slide_controller.update_preview = mocked_update_preview
slide_controller.preview_widget = mocked_preview_widget
slide_controller.slide_selected = mocked_slide_selected
# WHEN: The method is called
slide_controller.on_slide_selected_index([7])
@ -556,5 +554,3 @@ class TestSlideController(TestCase):
self.assertEqual(0, mocked_update_preview.call_count, 'Update preview should not have been called')
mocked_preview_widget.change_slide.assert_called_once_with(7)
mocked_slide_selected.assert_called_once_with()