Merge lp:~trb143/openlp/fixes245 into lp:openlp/2.4

Proposed by Tim Bentley
Status: Merged
Merged at revision: 2669
Proposed branch: lp:~trb143/openlp/fixes245
Merge into: lp:openlp/2.4
Diff against target: 100 lines (+48/-31)
2 files modified
openlp/core/ui/mainwindow.py (+1/-1)
tests/functional/openlp_core_ui/test_aboutform.py (+47/-30)
To merge this branch: bzr merge lp:~trb143/openlp/fixes245
Reviewer Review Type Date Requested Status
Tomas Groth Approve
Raoul Snyman Approve
Review via email: mp+316049@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve
Revision history for this message
Tomas Groth (tomasgroth) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2017-01-21 20:50:30 +0000
+++ openlp/core/ui/mainwindow.py 2017-01-31 19:13:52 +0000
@@ -189,7 +189,7 @@
189 triggers=self.service_manager_contents.on_load_service_clicked)189 triggers=self.service_manager_contents.on_load_service_clicked)
190 self.file_save_item = create_action(main_window, 'fileSaveItem', icon=':/general/general_save.png',190 self.file_save_item = create_action(main_window, 'fileSaveItem', icon=':/general/general_save.png',
191 can_shortcuts=True, category=UiStrings().File,191 can_shortcuts=True, category=UiStrings().File,
192 triggers=self.service_manager_contents.save_file)192 triggers=self.service_manager_contents.decide_save_method)
193 self.file_save_as_item = create_action(main_window, 'fileSaveAsItem', can_shortcuts=True,193 self.file_save_as_item = create_action(main_window, 'fileSaveAsItem', can_shortcuts=True,
194 category=UiStrings().File,194 category=UiStrings().File,
195 triggers=self.service_manager_contents.save_file_as)195 triggers=self.service_manager_contents.save_file_as)
196196
=== modified file 'tests/functional/openlp_core_ui/test_aboutform.py'
--- tests/functional/openlp_core_ui/test_aboutform.py 2016-12-31 11:05:48 +0000
+++ tests/functional/openlp_core_ui/test_aboutform.py 2017-01-31 19:13:52 +0000
@@ -22,36 +22,53 @@
22"""22"""
23Package to test the openlp.core.ui.firsttimeform package.23Package to test the openlp.core.ui.firsttimeform package.
24"""24"""
25from unittest.mock import patch25from unittest import TestCase
2626
27from openlp.core.ui.aboutform import AboutForm27from openlp.core.ui.aboutform import AboutForm
2828
2929from tests.functional import patch
30@patch('openlp.core.ui.aboutform.get_application_version')30from tests.helpers.testmixin import TestMixin
31def test_create_about_form(mocked_get_application_version):31
32 """32
33 Test creating an about form33class TestAboutForm(TestCase, TestMixin):
34 """34
35 # GIVEN: An application version with a build number35 @patch('openlp.core.ui.aboutform.get_application_version')
36 mocked_get_application_version.return_value = {'version': '3.1.1', 'build': '3000'}36 def test_create_about_form(self, mocked_get_application_version):
3737 """
38 # WHEN: The about form is created38 Test creating an about form
39 about_form = AboutForm(None)39 """
4040 # GIVEN: An application version with a build number
41 # THEN: The correct version information should be in the dialog41 mocked_get_application_version.return_value = {'version': '3.1.1', 'build': '3000'}
42 assert 'OpenLP 3.1.1 build 3000' in about_form.about_text_edit.toPlainText()42
4343 # WHEN: The about form is created
4444 about_form = AboutForm(None)
45@patch('openlp.core.ui.aboutform.webbrowser')45
46def test_on_volunteer_button_clicked(mocked_webbrowser):46 # THEN: The correct version information should be in the dialog
47 """47 assert 'OpenLP 3.1.1 build 3000' in about_form.about_text_edit.toPlainText()
48 Test that clicking on the "Volunteer" button opens a web page.48
49 """49 @patch('openlp.core.ui.aboutform.webbrowser')
50 # GIVEN: A new About dialog and a mocked out webbrowser module50 def test_on_volunteer_button_clicked(self, mocked_webbrowser):
51 about_form = AboutForm(None)51 """
5252 Test that clicking on the "Volunteer" button opens a web page.
53 # WHEN: The "Volunteer" button is "clicked"53 """
54 about_form.on_volunteer_button_clicked()54 # GIVEN: A new About dialog and a mocked out webbrowser module
5555 about_form = AboutForm(None)
56 # THEN: A web browser is opened56
57 mocked_webbrowser.open_new.assert_called_with('http://openlp.org/en/contribute')57 # WHEN: The "Volunteer" button is "clicked"
58 about_form.on_volunteer_button_clicked()
59
60 # THEN: A web browser is opened
61 mocked_webbrowser.open_new.assert_called_with('http://openlp.org/en/contribute')
62
63 def test_about_form_date_test(self):
64 """
65 Test that the copyright date is included correctly
66 """
67 # GIVEN: A correct application date
68 # WHEN: The about form is created
69 about_form = AboutForm(None)
70 license_text = about_form.license_text_edit.toPlainText()
71
72 # THEN: The date should be in the text twice.
73 self.assertTrue(license_text.count('2017', 0) == 2,
74 "The text string should be added twice to the license string")

Subscribers

People subscribed via source and target branches

to all changes: