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
=== 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 @@
511 """511 """
512 Select an image for the default display screen.512 Select an image for the default display screen.
513 """513 """
514 file_filters = '%s;;%s (*.*) (*)' % (get_images_filter(), UiStrings().AllFiles)514 file_filters = '%s;;%s (*.*)' % (get_images_filter(), UiStrings().AllFiles)
515 filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.AdvancedTab', 'Open File'), '',515 filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.AdvancedTab', 'Open File'), '',
516 file_filters)516 file_filters)
517 if filename:517 if filename:
518518
=== 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 @@
228 """228 """
229 files = QtGui.QFileDialog.getOpenFileName(self, translate('ImagePlugin.ExceptionDialog', 'Select Attachment'),229 files = QtGui.QFileDialog.getOpenFileName(self, translate('ImagePlugin.ExceptionDialog', 'Select Attachment'),
230 Settings().value(self.settings_section + '/last directory'),230 Settings().value(self.settings_section + '/last directory'),
231 '%s (*.*) (*)' % UiStrings().AllFiles)231 '%s (*)' % UiStrings().AllFiles)
232 log.info('New files(s) %s', str(files))232 log.info('New files(s) %s', str(files))
233 if files:233 if files:
234 self.file_attachment = str(files)234 self.file_attachment = str(files)
235235
=== 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 @@
432 Background Image button pushed.432 Background Image button pushed.
433 """433 """
434 images_filter = get_images_filter()434 images_filter = get_images_filter()
435 images_filter = '%s;;%s (*.*) (*)' % (images_filter, UiStrings().AllFiles)435 images_filter = '%s;;%s (*.*)' % (images_filter, UiStrings().AllFiles)
436 filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.ThemeWizard', 'Select Image'), '',436 filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.ThemeWizard', 'Select Image'), '',
437 images_filter)437 images_filter)
438 if filename:438 if filename:
439439
=== 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 @@
75 def retranslateUi(self):75 def retranslateUi(self):
76 self.on_new_prompt = translate('ImagePlugin.MediaItem', 'Select Image(s)')76 self.on_new_prompt = translate('ImagePlugin.MediaItem', 'Select Image(s)')
77 file_formats = get_images_filter()77 file_formats = get_images_filter()
78 self.on_new_file_masks = '%s;;%s (*.*) (*)' % (file_formats, UiStrings().AllFiles)78 self.on_new_file_masks = '%s;;%s (*)' % (file_formats, UiStrings().AllFiles)
79 self.add_group_action.setText(UiStrings().AddGroup)79 self.add_group_action.setText(UiStrings().AddGroup)
80 self.add_group_action.setToolTip(UiStrings().AddGroup)80 self.add_group_action.setToolTip(UiStrings().AddGroup)
81 self.replace_action.setText(UiStrings().ReplaceBG)81 self.replace_action.setText(UiStrings().ReplaceBG)
8282
=== 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 @@
1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
3
4###############################################################################
5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #
7# Copyright (c) 2008-2014 Raoul Snyman #
8# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
9# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
10# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
11# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
12# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
13# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
14# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
15# --------------------------------------------------------------------------- #
16# This program is free software; you can redistribute it and/or modify it #
17# under the terms of the GNU General Public License as published by the Free #
18# Software Foundation; version 2 of the License. #
19# #
20# This program is distributed in the hope that it will be useful, but WITHOUT #
21# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
22# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
23# more details. #
24# #
25# You should have received a copy of the GNU General Public License along #
26# with this program; if not, write to the Free Software Foundation, Inc., 59 #
27# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
28###############################################################################
29"""
30Package to test the openlp.core.__init__ package.
31"""
32import os
33
34from unittest import TestCase
35from unittest.mock import MagicMock, patch
36from PyQt4 import QtCore
37
38from openlp.core import OpenLP
39from tests.helpers.testmixin import TestMixin
40
41
42TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'resources'))
43
44
45class TestInit(TestCase, TestMixin):
46 def setUp(self):
47 with patch('openlp.core.common.OpenLPMixin.__init__') as constructor:
48 constructor.return_value = None
49 self.openlp = OpenLP(list())
50
51 def tearDown(self):
52 del self.openlp
53
54 def event_test(self):
55 """
56 Test the reimplemented event method
57 """
58 # GIVEN: A file path and a QEvent.
59 file_path = os.path.join(TEST_PATH, 'church.jpg')
60 mocked_file_method = MagicMock(return_value=file_path)
61 event = QtCore.QEvent(QtCore.QEvent.FileOpen)
62 event.file = mocked_file_method
63
64 # WHEN: Call the vent method.
65 result = self.openlp.event(event)
66
67 # THEN: The path should be inserted.
68 self.assertTrue(result, "The method should have returned True.")
69 mocked_file_method.assert_called_once_with()
70 self.assertEqual(self.openlp.args[0], file_path, "The path should be in args.")