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

Proposed by Tim Bentley on 2017-01-31
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 on 2017-02-03
Raoul Snyman 2017-01-31 Approve on 2017-02-03
Review via email: mp+316049@code.launchpad.net
To post a comment you must log in.
review: Approve
Tomas Groth (tomasgroth) :
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/mainwindow.py'
2--- openlp/core/ui/mainwindow.py 2017-01-21 20:50:30 +0000
3+++ openlp/core/ui/mainwindow.py 2017-01-31 19:13:52 +0000
4@@ -189,7 +189,7 @@
5 triggers=self.service_manager_contents.on_load_service_clicked)
6 self.file_save_item = create_action(main_window, 'fileSaveItem', icon=':/general/general_save.png',
7 can_shortcuts=True, category=UiStrings().File,
8- triggers=self.service_manager_contents.save_file)
9+ triggers=self.service_manager_contents.decide_save_method)
10 self.file_save_as_item = create_action(main_window, 'fileSaveAsItem', can_shortcuts=True,
11 category=UiStrings().File,
12 triggers=self.service_manager_contents.save_file_as)
13
14=== modified file 'tests/functional/openlp_core_ui/test_aboutform.py'
15--- tests/functional/openlp_core_ui/test_aboutform.py 2016-12-31 11:05:48 +0000
16+++ tests/functional/openlp_core_ui/test_aboutform.py 2017-01-31 19:13:52 +0000
17@@ -22,36 +22,53 @@
18 """
19 Package to test the openlp.core.ui.firsttimeform package.
20 """
21-from unittest.mock import patch
22+from unittest import TestCase
23
24 from openlp.core.ui.aboutform import AboutForm
25
26-
27-@patch('openlp.core.ui.aboutform.get_application_version')
28-def test_create_about_form(mocked_get_application_version):
29- """
30- Test creating an about form
31- """
32- # GIVEN: An application version with a build number
33- mocked_get_application_version.return_value = {'version': '3.1.1', 'build': '3000'}
34-
35- # WHEN: The about form is created
36- about_form = AboutForm(None)
37-
38- # THEN: The correct version information should be in the dialog
39- assert 'OpenLP 3.1.1 build 3000' in about_form.about_text_edit.toPlainText()
40-
41-
42-@patch('openlp.core.ui.aboutform.webbrowser')
43-def test_on_volunteer_button_clicked(mocked_webbrowser):
44- """
45- Test that clicking on the "Volunteer" button opens a web page.
46- """
47- # GIVEN: A new About dialog and a mocked out webbrowser module
48- about_form = AboutForm(None)
49-
50- # WHEN: The "Volunteer" button is "clicked"
51- about_form.on_volunteer_button_clicked()
52-
53- # THEN: A web browser is opened
54- mocked_webbrowser.open_new.assert_called_with('http://openlp.org/en/contribute')
55+from tests.functional import patch
56+from tests.helpers.testmixin import TestMixin
57+
58+
59+class TestAboutForm(TestCase, TestMixin):
60+
61+ @patch('openlp.core.ui.aboutform.get_application_version')
62+ def test_create_about_form(self, mocked_get_application_version):
63+ """
64+ Test creating an about form
65+ """
66+ # GIVEN: An application version with a build number
67+ mocked_get_application_version.return_value = {'version': '3.1.1', 'build': '3000'}
68+
69+ # WHEN: The about form is created
70+ about_form = AboutForm(None)
71+
72+ # THEN: The correct version information should be in the dialog
73+ assert 'OpenLP 3.1.1 build 3000' in about_form.about_text_edit.toPlainText()
74+
75+ @patch('openlp.core.ui.aboutform.webbrowser')
76+ def test_on_volunteer_button_clicked(self, mocked_webbrowser):
77+ """
78+ Test that clicking on the "Volunteer" button opens a web page.
79+ """
80+ # GIVEN: A new About dialog and a mocked out webbrowser module
81+ about_form = AboutForm(None)
82+
83+ # WHEN: The "Volunteer" button is "clicked"
84+ about_form.on_volunteer_button_clicked()
85+
86+ # THEN: A web browser is opened
87+ mocked_webbrowser.open_new.assert_called_with('http://openlp.org/en/contribute')
88+
89+ def test_about_form_date_test(self):
90+ """
91+ Test that the copyright date is included correctly
92+ """
93+ # GIVEN: A correct application date
94+ # WHEN: The about form is created
95+ about_form = AboutForm(None)
96+ license_text = about_form.license_text_edit.toPlainText()
97+
98+ # THEN: The date should be in the text twice.
99+ self.assertTrue(license_text.count('2017', 0) == 2,
100+ "The text string should be added twice to the license string")

Subscribers

People subscribed via source and target branches

to all changes: