forked from openlp/openlp
- Added a test for toggle lock button
- Removed give focus to Select bookname on Select tab, may be confusing.
This commit is contained in:
parent
ba3b2396e7
commit
09da152372
@ -563,8 +563,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
|
||||
def on_lock_button_toggled(self, checked):
|
||||
"""
|
||||
Toggle the lock button, if Search tab is used, set focus to search field, if Select tab is used,
|
||||
give focus to Bible book name field.
|
||||
Toggle the lock button, if Search tab is used, set focus to search field.
|
||||
:param checked: The state of the toggle button. bool
|
||||
:return: None
|
||||
"""
|
||||
@ -574,8 +573,6 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.sender().setIcon(self.unlock_icon)
|
||||
if self.quickTab.isVisible():
|
||||
self.quick_search_edit.setFocus()
|
||||
else:
|
||||
self.advanced_book_combo_box.setFocus()
|
||||
|
||||
def on_quick_style_combo_box_changed(self):
|
||||
self.settings.layout_style = self.quickStyleComboBox.currentIndex()
|
||||
|
@ -168,3 +168,18 @@ class TestMediaItem(TestCase, TestMixin):
|
||||
self.media_item.check_search_result.assert_called_once_with(),
|
||||
self.media_item.quick_search_edit.clear.assert_called_once_with(),
|
||||
self.media_item.quick_search_edit.setFocus.assert_called_once_with()
|
||||
|
||||
def test_on_lock_button_toggled_search_tab(self):
|
||||
"""
|
||||
Test that "on_lock_button_toggled" gives focus to the right field.
|
||||
"""
|
||||
# GIVEN: Mocked functions
|
||||
self.media_item.sender = MagicMock()
|
||||
self.media_item.quickTab = MagicMock()
|
||||
self.media_item.quick_search_edit = MagicMock()
|
||||
|
||||
# WHEN: on_lock_button_toggled is called and quickTab.isVisible() returns = True.
|
||||
self.media_item.on_lock_button_toggled(True)
|
||||
|
||||
# THEN: on_quick_search_edit should receive focus.
|
||||
self.media_item.quick_search_edit.setFocus.assert_called_once_with()
|
||||
|
Loading…
Reference in New Issue
Block a user