← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/bug-1146964 into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol/openlp/bug-1146964 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1146964 in OpenLP: "Attach button on exception form does not work "
  https://bugs.launchpad.net/openlp/+bug/1146964

For more details, see:
https://code.launchpad.net/~googol/openlp/bug-1146964/+merge/216541

Hello,

- fixed bug #1146964 (Attach button on exception form does not work)

Tim has a proposal which fixes the pep errors.

lp:~googol/openlp/bug-1146964 (revision 2367)
[SUCCESS] http://ci.openlp.org/job/Branch-01-Pull/365/
[SUCCESS] http://ci.openlp.org/job/Branch-02-Functional-Tests/322/
[SUCCESS] http://ci.openlp.org/job/Branch-03-Interface-Tests/269/
[SUCCESS] http://ci.openlp.org/job/Branch-04-Windows_Tests/231/
[FAILURE] http://ci.openlp.org/job/Branch-05a-Code_Analysis/158/
[SUCCESS] http://ci.openlp.org/job/Branch-05b-Test_Coverage/33/
-- 
https://code.launchpad.net/~googol/openlp/bug-1146964/+merge/216541
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/bug-1146964 into lp:openlp.
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py	2014-03-20 19:10:31 +0000
+++ openlp/core/ui/advancedtab.py	2014-04-20 13:14:27 +0000
@@ -511,7 +511,7 @@
         """
         Select an image for the default display screen.
         """
-        file_filters = '%s;;%s (*.*) (*)' % (get_images_filter(), UiStrings().AllFiles)
+        file_filters = '%s;;%s (*.*)' % (get_images_filter(), UiStrings().AllFiles)
         filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.AdvancedTab', 'Open File'), '',
                                                      file_filters)
         if filename:

=== modified file 'openlp/core/ui/exceptionform.py'
--- openlp/core/ui/exceptionform.py	2014-03-20 19:10:31 +0000
+++ openlp/core/ui/exceptionform.py	2014-04-20 13:14:27 +0000
@@ -228,7 +228,7 @@
         """
         files = QtGui.QFileDialog.getOpenFileName(self, translate('ImagePlugin.ExceptionDialog', 'Select Attachment'),
                                                   Settings().value(self.settings_section + '/last directory'),
-                                                  '%s (*.*) (*)' % UiStrings().AllFiles)
+                                                  '%s (*)' % UiStrings().AllFiles)
         log.info('New files(s) %s', str(files))
         if files:
             self.file_attachment = str(files)

=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py	2014-03-20 19:10:31 +0000
+++ openlp/core/ui/themeform.py	2014-04-20 13:14:27 +0000
@@ -432,7 +432,7 @@
         Background Image button pushed.
         """
         images_filter = get_images_filter()
-        images_filter = '%s;;%s (*.*) (*)' % (images_filter, UiStrings().AllFiles)
+        images_filter = '%s;;%s (*.*)' % (images_filter, UiStrings().AllFiles)
         filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.ThemeWizard', 'Select Image'), '',
                                                      images_filter)
         if filename:

=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py	2014-03-31 18:48:10 +0000
+++ openlp/plugins/images/lib/mediaitem.py	2014-04-20 13:14:27 +0000
@@ -75,7 +75,7 @@
     def retranslateUi(self):
         self.on_new_prompt = translate('ImagePlugin.MediaItem', 'Select Image(s)')
         file_formats = get_images_filter()
-        self.on_new_file_masks = '%s;;%s (*.*) (*)' % (file_formats, UiStrings().AllFiles)
+        self.on_new_file_masks = '%s;;%s (*)' % (file_formats, UiStrings().AllFiles)
         self.add_group_action.setText(UiStrings().AddGroup)
         self.add_group_action.setToolTip(UiStrings().AddGroup)
         self.replace_action.setText(UiStrings().ReplaceBG)

=== added file 'tests/functional/test_init.py'
--- tests/functional/test_init.py	1970-01-01 00:00:00 +0000
+++ tests/functional/test_init.py	2014-04-20 13:14:27 +0000
@@ -0,0 +1,70 @@
+# -*- 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                          #
+###############################################################################
+"""
+Package to test the openlp.core.__init__ package.
+"""
+import os
+
+from unittest import TestCase
+from unittest.mock import MagicMock, patch
+from PyQt4 import QtCore
+
+from openlp.core import OpenLP
+from tests.helpers.testmixin import TestMixin
+
+
+TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'resources'))
+
+
+class TestInit(TestCase, TestMixin):
+    def setUp(self):
+        with patch('openlp.core.common.OpenLPMixin.__init__') as constructor:
+            constructor.return_value = None
+            self.openlp = OpenLP(list())
+
+    def tearDown(self):
+        del self.openlp
+
+    def event_test(self):
+        """
+        Test the reimplemented event method
+        """
+        # GIVEN: A file path and a QEvent.
+        file_path = os.path.join(TEST_PATH, 'church.jpg')
+        mocked_file_method = MagicMock(return_value=file_path)
+        event = QtCore.QEvent(QtCore.QEvent.FileOpen)
+        event.file = mocked_file_method
+
+        # WHEN: Call the vent method.
+        result = self.openlp.event(event)
+
+        # THEN: The path should be inserted.
+        self.assertTrue(result, "The method should have returned True.")
+        mocked_file_method.assert_called_once_with()
+        self.assertEqual(self.openlp.args[0], file_path, "The path should be in args.")


Follow ups