diff --git a/tests/functional/openlp_core_lib/test_lib.py b/tests/functional/openlp_core_lib/test_lib.py
index 8527373dc..1f09ad75c 100644
--- a/tests/functional/openlp_core_lib/test_lib.py
+++ b/tests/functional/openlp_core_lib/test_lib.py
@@ -7,7 +7,7 @@ from datetime import datetime, timedelta
from mock import MagicMock, patch
from openlp.core.lib import str_to_bool, translate, check_directory_exists, get_text_file_string, build_icon, \
- image_to_byte, check_item_selected, validate_thumb, create_separated_list
+ image_to_byte, check_item_selected, validate_thumb, create_separated_list, expand_tags
class TestLib(TestCase):
@@ -299,6 +299,46 @@ class TestLib(TestCase):
MockedQtGui.QMessageBox.information.assert_called_with(u'parent', u'mocked translate', 'message')
assert not result, u'The result should be False'
+ def expand_tags_test(self):
+ """
+ Test the expand_tags() method.
+ """
+ with patch(u'openlp.core.lib.FormattingTags.get_html_tags') as mocked_get_tags:
+ # GIVEN: Mocked get_html_tags() method.
+ mocked_get_tags.return_value = [
+ {
+ u'desc': u'Black',
+ u'start tag': u'{b}',
+ u'start html': u'',
+ u'end tag': u'{/b}', u'end html': u'', u'protected': True,
+ u'temporary': False
+ },
+ {
+ u'desc': u'Yellow',
+ u'start tag': u'{y}',
+ u'start html': u'',
+ u'end tag': u'{/y}', u'end html': u'', u'protected': True,
+ u'temporary': False
+ },
+ {
+ u'desc': u'Green',
+ u'start tag': u'{g}',
+ u'start html': u'',
+ u'end tag': u'{/g}', u'end html': u'', u'protected': True,
+ u'temporary': False
+ }
+ ]
+ string_to_pass = u'{b}black{/b}{y}yellow{/y}'
+ wanted_string = u'black' + \
+ 'yellow'
+
+ # WHEN: Replace the tags.
+ result_string = expand_tags(string_to_pass)
+
+ # THEN: The strings should be identical.
+ assert result_string == wanted_string, u'The strings should be identical.'
+
+
def validate_thumb_file_does_not_exist_test(self):
"""
Test the validate_thumb() function when the thumbnail does not exist