diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 4fbeab335..9cb69579b 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -26,7 +26,372 @@ # with this program; if not, write to the Free Software Foundation, Inc., 59 # # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### +""" +This module is responsible for generating the HTML for :class:`~openlp.core.ui.maindisplay`. The ``build_html`` function +is the function which has to be called from outside. The generated and returned HTML will look similar to this:: + + + + OpenLP Display + + + + + + + + + + + + + + +
+ +
+ + +""" import logging from PyQt4 import QtWebKit @@ -242,6 +607,7 @@ def build_html(item, screen, is_live, background, image=None, plugins=None): image_src, html_additions ) + print(html) return html diff --git a/tests/functional/openlp_core_lib/test_htmlbuilder.py b/tests/functional/openlp_core_lib/test_htmlbuilder.py index 0ddf2bd4b..ae6a96a23 100644 --- a/tests/functional/openlp_core_lib/test_htmlbuilder.py +++ b/tests/functional/openlp_core_lib/test_htmlbuilder.py @@ -3,11 +3,11 @@ Package to test the openlp.core.lib.htmlbuilder module. """ from unittest import TestCase -from mock import MagicMock +from mock import MagicMock, patch from PyQt4 import QtCore -from openlp.core.lib.htmlbuilder import build_footer_css, build_lyrics_outline_css +from openlp.core.lib.htmlbuilder import build_footer_css, build_lyrics_outline_css, build_lyrics_css FOOTER_CSS = """ @@ -35,13 +35,16 @@ class Htmbuilder(TestCase): def build_lyrics_css_test(self): """ """ - item = MagicMock() - item.main = - item.themedata.font_main_shadow = - item.themedata.font_main_shadow_color = - item.themedata.font_main_shadow_size = - item.themedata.font_main_shadow = - assert LYRICS_CSS = build_lyrics_css(item), 'The lyrics css should be equal.' + with patch('openlp.core.lib.htmlbuilder.build_lyrics_format_css') as mocked_method:# + mocked_method.return_value = '' + item = MagicMock() + item.main = + item.themedata.font_main_shadow = + item.themedata.font_main_shadow_color = + item.themedata.font_main_shadow_size = + item.themedata.font_main_shadow = + print(build_lyrics_css(item)) + assert LYRICS_CSS == build_lyrics_css(item), 'The lyrics css should be equal.' def build_lyrics_outline_css_test(self): """