Merge branch 'AchimStuy-master-patch-36540' into 'master'

Keep unique_identifier of PDF service items.

See merge request openlp/openlp!419
This commit is contained in:
Tim Bentley 2022-02-19 08:20:28 +00:00
commit b94bc0021e
2 changed files with 5 additions and 0 deletions

View File

@ -342,6 +342,7 @@ class MessageListener(object):
item.iconic_representation = item_cpy.icon
item.main = item_cpy.main
item.theme = item_cpy.theme
item.unique_identifier = item_cpy.unique_identifier
# When presenting PDF/XPS/OXPS, we are using the image presentation code,
# so handler & processor is set to None, and we skip adding the handler.
self.handler = None

View File

@ -98,6 +98,7 @@ def test_start_pdf_presentation(media_mock, media_item):
mock_item = MagicMock()
mock_item.processor = 'Pdf'
mock_item.get_frame_path.return_value = "test.pdf"
expected_identifier = mock_item.unique_identifier
media_item.generate_slide_data = MagicMock()
ml = MessageListener(media_item)
ml.media_item = media_item
@ -109,6 +110,9 @@ def test_start_pdf_presentation(media_mock, media_item):
# THEN: The handler should be set to None
assert ml.handler is None, 'The handler should be None'
# THEN: unique_identifier should still be the same.
assert mock_item.unique_identifier == expected_identifier, 'unique_identifier should not be changed'
def test_add_handler_failure():
"""