Merge lp:~googol-deactivatedaccount/openlp/bug-1146964 into lp:openlp

Proposed by Andreas Preikschat
Status: Merged
Approved by: Raoul Snyman
Approved revision: 2367
Merged at revision: 2368
Proposed branch: lp:~googol-deactivatedaccount/openlp/bug-1146964
Merge into: lp:openlp
Diff against target: 126 lines (+74/-4)
5 files modified
openlp/core/ui/advancedtab.py (+1/-1)
openlp/core/ui/exceptionform.py (+1/-1)
openlp/core/ui/themeform.py (+1/-1)
openlp/plugins/images/lib/mediaitem.py (+1/-1)
tests/functional/test_init.py (+70/-0)
To merge this branch: bzr merge lp:~googol-deactivatedaccount/openlp/bug-1146964
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Tim Bentley Approve
Review via email: mp+216541@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) :
review: Approve
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/ui/advancedtab.py'
2--- openlp/core/ui/advancedtab.py 2014-03-20 19:10:31 +0000
3+++ openlp/core/ui/advancedtab.py 2014-04-20 13:14:27 +0000
4@@ -511,7 +511,7 @@
5 """
6 Select an image for the default display screen.
7 """
8- file_filters = '%s;;%s (*.*) (*)' % (get_images_filter(), UiStrings().AllFiles)
9+ file_filters = '%s;;%s (*.*)' % (get_images_filter(), UiStrings().AllFiles)
10 filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.AdvancedTab', 'Open File'), '',
11 file_filters)
12 if filename:
13
14=== modified file 'openlp/core/ui/exceptionform.py'
15--- openlp/core/ui/exceptionform.py 2014-03-20 19:10:31 +0000
16+++ openlp/core/ui/exceptionform.py 2014-04-20 13:14:27 +0000
17@@ -228,7 +228,7 @@
18 """
19 files = QtGui.QFileDialog.getOpenFileName(self, translate('ImagePlugin.ExceptionDialog', 'Select Attachment'),
20 Settings().value(self.settings_section + '/last directory'),
21- '%s (*.*) (*)' % UiStrings().AllFiles)
22+ '%s (*)' % UiStrings().AllFiles)
23 log.info('New files(s) %s', str(files))
24 if files:
25 self.file_attachment = str(files)
26
27=== modified file 'openlp/core/ui/themeform.py'
28--- openlp/core/ui/themeform.py 2014-03-20 19:10:31 +0000
29+++ openlp/core/ui/themeform.py 2014-04-20 13:14:27 +0000
30@@ -432,7 +432,7 @@
31 Background Image button pushed.
32 """
33 images_filter = get_images_filter()
34- images_filter = '%s;;%s (*.*) (*)' % (images_filter, UiStrings().AllFiles)
35+ images_filter = '%s;;%s (*.*)' % (images_filter, UiStrings().AllFiles)
36 filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.ThemeWizard', 'Select Image'), '',
37 images_filter)
38 if filename:
39
40=== modified file 'openlp/plugins/images/lib/mediaitem.py'
41--- openlp/plugins/images/lib/mediaitem.py 2014-03-31 18:48:10 +0000
42+++ openlp/plugins/images/lib/mediaitem.py 2014-04-20 13:14:27 +0000
43@@ -75,7 +75,7 @@
44 def retranslateUi(self):
45 self.on_new_prompt = translate('ImagePlugin.MediaItem', 'Select Image(s)')
46 file_formats = get_images_filter()
47- self.on_new_file_masks = '%s;;%s (*.*) (*)' % (file_formats, UiStrings().AllFiles)
48+ self.on_new_file_masks = '%s;;%s (*)' % (file_formats, UiStrings().AllFiles)
49 self.add_group_action.setText(UiStrings().AddGroup)
50 self.add_group_action.setToolTip(UiStrings().AddGroup)
51 self.replace_action.setText(UiStrings().ReplaceBG)
52
53=== added file 'tests/functional/test_init.py'
54--- tests/functional/test_init.py 1970-01-01 00:00:00 +0000
55+++ tests/functional/test_init.py 2014-04-20 13:14:27 +0000
56@@ -0,0 +1,70 @@
57+# -*- coding: utf-8 -*-
58+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
59+
60+###############################################################################
61+# OpenLP - Open Source Lyrics Projection #
62+# --------------------------------------------------------------------------- #
63+# Copyright (c) 2008-2014 Raoul Snyman #
64+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
65+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
66+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
67+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
68+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
69+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
70+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
71+# --------------------------------------------------------------------------- #
72+# This program is free software; you can redistribute it and/or modify it #
73+# under the terms of the GNU General Public License as published by the Free #
74+# Software Foundation; version 2 of the License. #
75+# #
76+# This program is distributed in the hope that it will be useful, but WITHOUT #
77+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
78+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
79+# more details. #
80+# #
81+# You should have received a copy of the GNU General Public License along #
82+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
83+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
84+###############################################################################
85+"""
86+Package to test the openlp.core.__init__ package.
87+"""
88+import os
89+
90+from unittest import TestCase
91+from unittest.mock import MagicMock, patch
92+from PyQt4 import QtCore
93+
94+from openlp.core import OpenLP
95+from tests.helpers.testmixin import TestMixin
96+
97+
98+TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'resources'))
99+
100+
101+class TestInit(TestCase, TestMixin):
102+ def setUp(self):
103+ with patch('openlp.core.common.OpenLPMixin.__init__') as constructor:
104+ constructor.return_value = None
105+ self.openlp = OpenLP(list())
106+
107+ def tearDown(self):
108+ del self.openlp
109+
110+ def event_test(self):
111+ """
112+ Test the reimplemented event method
113+ """
114+ # GIVEN: A file path and a QEvent.
115+ file_path = os.path.join(TEST_PATH, 'church.jpg')
116+ mocked_file_method = MagicMock(return_value=file_path)
117+ event = QtCore.QEvent(QtCore.QEvent.FileOpen)
118+ event.file = mocked_file_method
119+
120+ # WHEN: Call the vent method.
121+ result = self.openlp.event(event)
122+
123+ # THEN: The path should be inserted.
124+ self.assertTrue(result, "The method should have returned True.")
125+ mocked_file_method.assert_called_once_with()
126+ self.assertEqual(self.openlp.args[0], file_path, "The path should be in args.")