Merge lp:~suutari-olli/openlp/fix-advanced-bible-search-clear-button-giving-focus-to-quick into lp:openlp

Proposed by Azaziah
Status: Superseded
Proposed branch: lp:~suutari-olli/openlp/fix-advanced-bible-search-clear-button-giving-focus-to-quick
Merge into: lp:openlp
Diff against target: 85 lines (+37/-5)
2 files modified
openlp/plugins/bibles/lib/mediaitem.py (+17/-4)
tests/functional/openlp_plugins/bibles/test_mediaitem.py (+20/-1)
To merge this branch: bzr merge lp:~suutari-olli/openlp/fix-advanced-bible-search-clear-button-giving-focus-to-quick
Reviewer Review Type Date Requested Status
Raoul Snyman Pending
Tim Bentley Pending
Review via email: mp+303474@code.launchpad.net

This proposal supersedes a proposal from 2016-08-19.

This proposal has been superseded by a proposal from 2016-08-20.

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Looks OK but needs tests!

review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Please see my comments.

review: Needs Fixing
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Tests? The rest looks good though

review: Needs Fixing
2698. By Azaziah

- Renamed test title from x_test to test_x

2699. By Azaziah

- Fixed the test

2700. By Azaziah

- Combined some <strong> tags in expection dialogue.
- Added new line to the end of the test.

2701. By Azaziah

- Merged trunk on 9.9.16

2702. By Azaziah

- Fixed a bug where web bible's trigger traceback in search while typing.

2703. By Azaziah

- Added param: to Lock toggle button

2704. By Azaziah

- Merged trunk on 16.9.16

2705. By Azaziah

- Added a test for toggle lock button
- Removed give focus to Select bookname on Select tab, may be confusing.

2706. By Azaziah

- Added two new tests for lock button toggle.

2707. By Azaziah

- The checking for not_called_once does not work apparently, fails in jenkins but passes in nosetests.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2016-08-10 18:31:33 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2016-08-20 19:00:29 +0000
@@ -254,8 +254,8 @@
254 self.quickStyleComboBox.activated.connect(self.on_quick_style_combo_box_changed)254 self.quickStyleComboBox.activated.connect(self.on_quick_style_combo_box_changed)
255 self.advancedStyleComboBox.activated.connect(self.on_advanced_style_combo_box_changed)255 self.advancedStyleComboBox.activated.connect(self.on_advanced_style_combo_box_changed)
256 # Buttons256 # Buttons
257 self.advancedClearButton.clicked.connect(self.on_clear_button)257 self.advancedClearButton.clicked.connect(self.on_advanced_clear_button_clicked)
258 self.quickClearButton.clicked.connect(self.on_clear_button)258 self.quickClearButton.clicked.connect(self.on_clear_button_clicked)
259 self.advancedSearchButton.clicked.connect(self.on_advanced_search_button)259 self.advancedSearchButton.clicked.connect(self.on_advanced_search_button)
260 self.quickSearchButton.clicked.connect(self.on_quick_search_button)260 self.quickSearchButton.clicked.connect(self.on_quick_search_button)
261 # Other stuff261 # Other stuff
@@ -548,19 +548,32 @@
548 self.advancedTab.setVisible(True)548 self.advancedTab.setVisible(True)
549 self.advanced_book_combo_box.setFocus()549 self.advanced_book_combo_box.setFocus()
550550
551 def on_clear_button(self):551 def on_clear_button_clicked(self):
552 # Clear the list, then set the "No search Results" message, then clear the text field and give it focus.552 # Clear the list, then set the "No search Results" message, then clear the text field and give it focus.
553 self.list_view.clear()553 self.list_view.clear()
554 self.check_search_result()554 self.check_search_result()
555 self.quick_search_edit.clear()555 self.quick_search_edit.clear()
556 self.quick_search_edit.setFocus()556 self.quick_search_edit.setFocus()
557557
558 def on_advanced_clear_button_clicked(self):
559 # The same as the on_clear_button_clicked, but gives focus to Book name field in "Select" (advanced).
560 self.list_view.clear()
561 self.check_search_result()
562 self.advanced_book_combo_box.setFocus()
563
558 def on_lock_button_toggled(self, checked):564 def on_lock_button_toggled(self, checked):
559 self.quick_search_edit.setFocus()565 """
566 Toggle the lock button, if Search tab is used, set focus to search field, if Select tab is used,
567 give focus to Bible book name field.
568 """
560 if checked:569 if checked:
561 self.sender().setIcon(self.lock_icon)570 self.sender().setIcon(self.lock_icon)
562 else:571 else:
563 self.sender().setIcon(self.unlock_icon)572 self.sender().setIcon(self.unlock_icon)
573 if self.quickTab.isVisible():
574 self.quick_search_edit.setFocus()
575 else:
576 self.advanced_book_combo_box.setFocus()
564577
565 def on_quick_style_combo_box_changed(self):578 def on_quick_style_combo_box_changed(self):
566 self.settings.layout_style = self.quickStyleComboBox.currentIndex()579 self.settings.layout_style = self.quickStyleComboBox.currentIndex()
567580
=== modified file 'tests/functional/openlp_plugins/bibles/test_mediaitem.py'
--- tests/functional/openlp_plugins/bibles/test_mediaitem.py 2016-06-14 21:55:37 +0000
+++ tests/functional/openlp_plugins/bibles/test_mediaitem.py 2016-08-20 19:00:29 +0000
@@ -114,7 +114,7 @@
114 self.assertEqual(self.media_item.search_results, {})114 self.assertEqual(self.media_item.search_results, {})
115 self.assertEqual(self.media_item.second_search_results, {})115 self.assertEqual(self.media_item.second_search_results, {})
116116
117 def on_quick_search_button_general_test(self):117 def test_on_quick_search_button_general(self):
118 """118 """
119 Test that general things, which should be called on all Quick searches are called.119 Test that general things, which should be called on all Quick searches are called.
120 """120 """
@@ -150,3 +150,22 @@
150 self.assertEqual(2, self.media_item.quickSearchButton.setEnabled.call_count, 'Disable and Enable the button')150 self.assertEqual(2, self.media_item.quickSearchButton.setEnabled.call_count, 'Disable and Enable the button')
151 self.assertEqual(1, self.media_item.check_search_result.call_count, 'Check results Should had been called once')151 self.assertEqual(1, self.media_item.check_search_result.call_count, 'Check results Should had been called once')
152 self.assertEqual(1, self.app.set_normal_cursor.call_count, 'Normal cursor should had been called once')152 self.assertEqual(1, self.app.set_normal_cursor.call_count, 'Normal cursor should had been called once')
153
154 def test_on_clear_button_clicked(self):
155 """
156 Test that the on_clear_button_clicked works properly. (Used by Bible search tab)
157 """
158
159 # GIVEN: Mocked list_view, check_search_results & quick_search_edit.
160 self.media_item.list_view = MagicMock()
161 self.media_item.check_search_result = MagicMock()
162 self.media_item.quick_search_edit = MagicMock()
163
164 # WHEN: on_clear_button_clicked is called
165 self.media_item.on_clear_button_clicked()
166
167 # THEN: Search result should be reset and search field should receive focus.
168 self.assertEqual(1, self.media_item.list_view.clear.call_count, 'List_view.clear should had been called once.')
169 self.assertEqual(1, self.media_item.check_search_result.call_count, 'Check results Should had been called once')
170 self.assertEqual(1, self.media_item.quick_search_edit.clear.call_count, 'Should had been called once')
171 self.assertEqual(1, self.media_item.quick_search_edit.setFocus.call_count, 'Should had been called once')