mirror of https://gitlab.com/openlp/openlp.git
Merge branch 'bug-1098' into 'master'
Fix bug #1098 by checking that the selectedItem is not None See merge request openlp/openlp!468
This commit is contained in:
commit
82f8c05fa5
|
@ -1181,7 +1181,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
|
|||
"""
|
||||
item = self.service_manager_list.currentItem()
|
||||
# Since we only have 2 levels we find them by checking for children
|
||||
if item.childCount():
|
||||
if item and item.childCount():
|
||||
if not self.service_manager_list.isExpanded(self.service_manager_list.currentIndex()):
|
||||
self.service_manager_list.expandItem(item)
|
||||
self.service_manager.expanded(item)
|
||||
|
|
|
@ -1854,6 +1854,19 @@ class TestServiceManager(TestCase, TestMixin):
|
|||
# THEN the on_expand_selection function should have been called.
|
||||
self.service_manager.on_expand_selection.assert_called_once_with()
|
||||
|
||||
def test_on_expand_selection_item_none(self):
|
||||
"""
|
||||
Test that on_expand_selection exits early when there is no item selected.
|
||||
"""
|
||||
# GIVEN a mocked expand function
|
||||
self.service_manager.service_manager_list = MagicMock(**{'currentItem.return_value': None})
|
||||
|
||||
# WHEN on_expand_selection is called
|
||||
self.service_manager.on_expand_selection()
|
||||
|
||||
# THEN on_expand_selection should have exited early
|
||||
self.service_manager.service_manager_list.isExpanded.assert_not_called()
|
||||
|
||||
def test_collapse_selection_on_left_arrow(self):
|
||||
"""
|
||||
Test that a left arrow key press event calls the on_collapse_selection function
|
||||
|
|
Loading…
Reference in New Issue