forked from openlp/openlp
Fix some bugs in Bibles and PresentationManager
This commit is contained in:
parent
0269de5d2f
commit
3390323d4f
@ -608,6 +608,9 @@ class BibleMediaItem(MediaManagerItem):
|
||||
:return: None
|
||||
"""
|
||||
book_ref_id = self.select_book_combo_box.currentData()
|
||||
if not book_ref_id:
|
||||
# If there is no book selected, just exit early
|
||||
return
|
||||
book = self.plugin.manager.get_book_by_id(self.bible.name, book_ref_id)
|
||||
self.chapter_count = self.plugin.manager.get_chapter_count(self.bible.name, book)
|
||||
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(self.bible.name, book_ref_id, 1)
|
||||
|
@ -80,6 +80,7 @@ class PresentationManagerImport(SongImport):
|
||||
except etree.XMLSyntaxError:
|
||||
# Try to detect encoding and use it
|
||||
self.process_xml(file_path, get_file_encoding(file_path))
|
||||
return
|
||||
|
||||
file_str = etree.tostring(tree)
|
||||
if not file_str:
|
||||
|
@ -933,6 +933,20 @@ def test_on_advanced_book_combo_box(media_item):
|
||||
assert mocked_critical_error_message_box.called is True
|
||||
|
||||
|
||||
def test_on_advanced_book_combo_box_no_selection(media_item):
|
||||
"""
|
||||
Test on_advanced_book_combo_box when there is nothing selected
|
||||
"""
|
||||
# GIVEN: An instance of :class:`MediaManagerItem` and a mocked manager
|
||||
media_item.select_book_combo_box = MagicMock(**{'currentData.return_value': None})
|
||||
|
||||
# WHEN: Calling on_advanced_book_combo_box
|
||||
media_item.on_advanced_book_combo_box()
|
||||
|
||||
# THEN: The method should exit early, and no query made
|
||||
assert media_item.plugin.manager.get_book_by_id.call_count == 0
|
||||
|
||||
|
||||
def test_on_advanced_book_combo_box_set_up_comboboxes(media_item):
|
||||
"""
|
||||
Test on_advanced_book_combo_box when the book returns 6 for the verse count.
|
||||
|
Loading…
Reference in New Issue
Block a user