diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index a4bfa4bc5..d9a9a6468 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -408,10 +408,7 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties): self.application.process_events() # Workaround for bug #1531319, should not be needed with PyQt 5.6. if is_win(): - # Workaround for bug #1531319, should not be needed with PyQt 5.6. fade_shake_timer.stop() - elif is_win(): - self.shake_web_view() # Wait for the webview to update before getting the preview. # Important otherwise first preview will miss the background ! while not self.web_loaded: @@ -429,6 +426,9 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties): self.setVisible(True) else: self.setVisible(True) + # Workaround for bug #1531319, should not be needed with PyQt 5.6. + if is_win(): + self.shake_web_view() return self.grab() def build_html(self, service_item, image_path=''): diff --git a/tests/functional/openlp_plugins/songusage/test_songusage.py b/tests/functional/openlp_plugins/songusage/test_songusage.py index 6b103c9f1..61d8a22bb 100644 --- a/tests/functional/openlp_plugins/songusage/test_songusage.py +++ b/tests/functional/openlp_plugins/songusage/test_songusage.py @@ -81,3 +81,19 @@ class TestSongUsage(TestCase): # THEN: It should return True self.assertTrue(ret) + + @patch('openlp.plugins.songusage.songusageplugin.Manager') + def toggle_song_usage_state_test(self, MockedManager): + """ + Test that toggle_song_usage_state does toggle song_usage_state + """ + # GIVEN: A SongUsagePlugin + song_usage = SongUsagePlugin() + song_usage.set_button_state = MagicMock() + song_usage.song_usage_active = True + + # WHEN: calling toggle_song_usage_state + song_usage.toggle_song_usage_state() + + # THEN: song_usage_state should have been toogled + self.assertFalse(song_usage.song_usage_active)