← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/bug-1388258 into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/bug-1388258 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1388258 in OpenLP: "Focus doesn't switch to Live verse when going live on song"
  https://bugs.launchpad.net/openlp/+bug/1388258

For more details, see:
https://code.launchpad.net/~trb143/openlp/bug-1388258/+merge/240356

fix #1388258 regression

lp:~trb143/openlp/bug-1388258 (revision 2418)
[SUCCESS] http://ci.openlp.org/job/Branch-01-Pull/737/
[SUCCESS] http://ci.openlp.org/job/Branch-02-Functional-Tests/680/
[SUCCESS] http://ci.openlp.org/job/Branch-03-Interface-Tests/624/
[SUCCESS] http://ci.openlp.org/job/Branch-04a-Windows_Functional_Tests/563/
[SUCCESS] http://ci.openlp.org/job/Branch-04b-Windows_Interface_Tests/172/
[SUCCESS] http://ci.openlp.org/job/Branch-05a-Code_Analysis/377/
[SUCCESS] http://ci.openlp.org/job/Branch-05b-Test_Coverage/251/

-- 
https://code.launchpad.net/~trb143/openlp/bug-1388258/+merge/240356
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bug-1388258 into lp:openlp.
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2014-10-28 18:36:54 +0000
+++ openlp/core/ui/slidecontroller.py	2014-11-01 11:16:21 +0000
@@ -851,6 +851,7 @@
         if service_item.is_media():
             self.on_media_start(service_item)
         self.slide_selected(True)
+        self.preview_widget.setFocus()
         if old_item:
             # Close the old item after the new one is opened
             # This avoids the service theme/desktop flashing on screen

=== added file 'tests/functional/openlp_plugins/images/test_imagetab.py'
--- tests/functional/openlp_plugins/images/test_imagetab.py	1970-01-01 00:00:00 +0000
+++ tests/functional/openlp_plugins/images/test_imagetab.py	2014-11-01 11:16:21 +0000
@@ -0,0 +1,98 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
+"""
+This module contains tests for the lib submodule of the Images plugin.
+"""
+from unittest import TestCase
+from PyQt4 import QtGui
+
+from openlp.core.common import Settings
+
+from openlp.core.common import Registry
+from openlp.plugins.images.lib.db import ImageFilenames, ImageGroups
+from openlp.plugins.images.lib.mediaitem import ImageMediaItem
+from openlp.plugins.images.lib import ImageTab
+from tests.functional import MagicMock, patch
+from tests.helpers.testmixin import TestMixin
+
+__default_settings__ = {
+    'images/db type': 'sqlite',
+    'images/background color': '#000000',
+}
+
+
+class TestImageMediaItem(TestCase, TestMixin):
+    """
+    This is a test case to test various methods in the ImageTab.
+    """
+
+    def setUp(self):
+        """
+        Create the UI
+        """
+        Registry.create()
+        Registry().register('settings_form', MagicMock())
+        self.setup_application()
+        self.build_settings()
+        Settings().extend_default_settings(__default_settings__)
+        self.parent = QtGui.QMainWindow()
+        self.form = ImageTab(self.parent, 'Images', None, None)
+        self.form.settings_form.register_post_process = MagicMock()
+
+    def tearDown(self):
+        """
+        Delete all the C++ objects at the end so that we don't have a segfault
+        """
+        del self.parent
+        del self.form
+        self.destroy_settings()
+
+    def save_tab_nochange_test_test(self):
+        """
+        Test no changes does not trigger post processing
+        """
+        # GIVEN: No changes on the form.
+        self.initial_color = '#999999'
+        # WHEN: the save is invoked
+        self.form.save()
+        # THEN: the post process should not be requested
+        self.assertEqual(0, self.form.settings_form.register_post_process.call_count,
+                         'Image Post processing should not have been requested')
+
+    def save_tab_change_test_test(self):
+        """
+        Test a change triggers post processing.
+        """
+        # GIVEN: Apply a change to the form.
+        self.form.background_color = '#999999'
+        # WHEN: the save is invoked
+        self.form.save()
+        # THEN: the post process should be requested
+        self.assertEqual(1, self.form.settings_form.register_post_process.call_count,
+                         'Image Post processing should have been requested')
\ No newline at end of file


Follow ups