Merge lp:~diegosarmentero/ubuntuone-windows-installer/message-critical into lp:ubuntuone-windows-installer

Proposed by Diego Sarmentero
Status: Merged
Approved by: Roberto Alsina
Approved revision: 53
Merged at revision: 53
Proposed branch: lp:~diegosarmentero/ubuntuone-windows-installer/message-critical
Merge into: lp:ubuntuone-windows-installer
Diff against target: 48 lines (+20/-2)
2 files modified
ubuntuone_installer/gui/qt/gui.py (+4/-2)
ubuntuone_installer/gui/qt/tests/test_gui.py (+16/-0)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-windows-installer/message-critical
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Natalia Bidart Approve
Review via email: mp+74464@code.launchpad.net

Commit message

Set the page where the critical message is going to be displayed.

Description of the change

Set the page where the critical message is going to be displayed.

To post a comment you must log in.
Natalia Bidart (nataliabidart) wrote :

Can you please add a test for this change?

Thanks!

review: Needs Fixing
53. By Diego Sarmentero on 2011-09-07

Added test for critical method.

Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve
Roberto Alsina (ralsina) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone_installer/gui/qt/gui.py'
2--- ubuntuone_installer/gui/qt/gui.py 2011-09-07 11:24:12 +0000
3+++ ubuntuone_installer/gui/qt/gui.py 2011-09-07 16:08:25 +0000
4@@ -388,13 +388,15 @@
5 # Invalid name "closeEvent"
6 # pylint: disable=C0103
7
8- def critical(self, message):
9+ def critical(self, message, page=None):
10 """Show a message at the bottom of the page on form errors."""
11 self.overlay.hide()
12 self.form_errors_label.setText(message)
13 self.form_errors_label.show()
14- if self.currentPage():
15+ if page is None and self.currentPage():
16 self.currentPage().layout().addWidget(self.form_errors_label)
17+ elif page is not None:
18+ page.layout().addWidget(self.form_errors_label)
19
20 def next(self):
21 """Show the next page to display and remove the form errors label."""
22
23=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
24--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-07 11:24:12 +0000
25+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-07 16:08:25 +0000
26@@ -287,6 +287,22 @@
27 self.assertEqual(self.ui.overlay.hide_counter, 2)
28 self.assertEqual(self.ui.form_errors_label.text(), "WORRY!")
29
30+ def test_critical_in_proper_page(self):
31+ """Check that the critical message is added in the proper page."""
32+ setup_page = self.ui.page(self.ui.setup_account_page_id)
33+ folders_page = self.ui.page(self.ui.folders_page_id)
34+ self.ui.critical("WORRY!", setup_page)
35+ self.assertEqual(self.ui.form_errors_label.text(), "WORRY!")
36+ self.assertEqual(self.ui.form_errors_label.parent(),
37+ setup_page)
38+ self.assertNotEqual(self.ui.form_errors_label.parent(),
39+ folders_page)
40+ self.ui.critical("WORRY!", folders_page)
41+ self.assertEqual(self.ui.form_errors_label.parent(),
42+ folders_page)
43+ self.assertNotEqual(self.ui.form_errors_label.parent(),
44+ setup_page)
45+
46 def test_forgotten_password_controller_error(self):
47 """When there is an error, it should hide the overlay."""
48 self.assertEqual(self.ui.overlay.hide_counter, 1)

Subscribers

People subscribed via source and target branches