forked from openlp/openlp
This branch fixes the issue where Blank to desktop,
black and theme won't work if Live screen has stolen focus. Examples of this happening: Clicking anything in the live window or certain single screen mode scenarios. This was achieved by adding 3 lines of code, one for each method under the definition of methods available in this screen mode. I also explained this in a comment I inserted to the code. Since the only way to screw this seems to be by removing these additions, a test for the... bzr-revno: 2623
This commit is contained in:
commit
b490772f8b
@ -601,13 +601,21 @@ class SlideController(DisplayController, RegistryProperties):
|
|||||||
def __add_actions_to_widget(self, widget):
|
def __add_actions_to_widget(self, widget):
|
||||||
"""
|
"""
|
||||||
Add actions to the widget specified by `widget`
|
Add actions to the widget specified by `widget`
|
||||||
|
This defines the controls available when Live display has stolen focus.
|
||||||
|
Examples of this happening: Clicking anything in the live window or certain single screen mode scenarios.
|
||||||
|
Needles to say, blank to modes should not be removed from here.
|
||||||
|
For some reason this required a test. It may be found in test_slidecontroller.py as
|
||||||
|
"live_stolen_focus_shortcuts_test. If you want to modify things here, you must also modify them there. (Duh)
|
||||||
|
|
||||||
:param widget: The UI widget for the actions
|
:param widget: The UI widget for the actions
|
||||||
"""
|
"""
|
||||||
widget.addActions([
|
widget.addActions([
|
||||||
self.previous_item, self.next_item,
|
self.previous_item, self.next_item,
|
||||||
self.previous_service, self.next_service,
|
self.previous_service, self.next_service,
|
||||||
self.escape_item])
|
self.escape_item,
|
||||||
|
self.desktop_screen,
|
||||||
|
self.theme_screen,
|
||||||
|
self.blank_screen])
|
||||||
|
|
||||||
def preview_size_changed(self):
|
def preview_size_changed(self):
|
||||||
"""
|
"""
|
||||||
|
@ -685,6 +685,34 @@ class TestSlideController(TestCase):
|
|||||||
self.assertEqual('mocked_presentation_item_stop', mocked_execute.call_args_list[1][0][0],
|
self.assertEqual('mocked_presentation_item_stop', mocked_execute.call_args_list[1][0][0],
|
||||||
'The presentation should have been stopped.')
|
'The presentation should have been stopped.')
|
||||||
|
|
||||||
|
def live_stolen_focus_shortcuts_test(self):
|
||||||
|
"""
|
||||||
|
Test that all the needed shortcuts are available in scenarios where Live has stolen focus.
|
||||||
|
These are found under def __add_actions_to_widget(self, widget): in slidecontroller.py
|
||||||
|
"""
|
||||||
|
# GIVEN: A slide controller, actions needed
|
||||||
|
slide_controller = SlideController(None)
|
||||||
|
mocked_widget = MagicMock()
|
||||||
|
slide_controller.previous_item = MagicMock()
|
||||||
|
slide_controller.next_item = MagicMock()
|
||||||
|
slide_controller.previous_service = MagicMock()
|
||||||
|
slide_controller.next_service = MagicMock()
|
||||||
|
slide_controller.escape_item = MagicMock()
|
||||||
|
slide_controller.desktop_screen = MagicMock()
|
||||||
|
slide_controller.blank_screen = MagicMock()
|
||||||
|
slide_controller.theme_screen = MagicMock()
|
||||||
|
|
||||||
|
# WHEN: __add_actions_to_widget is called
|
||||||
|
slide_controller._SlideController__add_actions_to_widget(mocked_widget)
|
||||||
|
|
||||||
|
# THEN: The call to addActions should be correct
|
||||||
|
mocked_widget.addActions.assert_called_with([
|
||||||
|
slide_controller.previous_item, slide_controller.next_item,
|
||||||
|
slide_controller.previous_service, slide_controller.next_service,
|
||||||
|
slide_controller.escape_item, slide_controller.desktop_screen,
|
||||||
|
slide_controller.theme_screen, slide_controller.blank_screen
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
class TestInfoLabel(TestCase):
|
class TestInfoLabel(TestCase):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user