Merge lp:~rpadovani/ubuntu-calculator-app/1188716bis into lp:~ubuntu-calculator-dev/ubuntu-calculator-app/old_trunk

Proposed by Riccardo Padovani on 2013-07-31
Status: Merged
Approved by: Nicholas Skaggs on 2013-07-31
Approved revision: 117
Merged at revision: 117
Proposed branch: lp:~rpadovani/ubuntu-calculator-app/1188716bis
Merge into: lp:~ubuntu-calculator-dev/ubuntu-calculator-app/old_trunk
Diff against target: 68 lines (+44/-1)
1 file modified
tests/autopilot/ubuntu_calculator_app/tests/test_simple_page.py (+44/-1)
To merge this branch: bzr merge lp:~rpadovani/ubuntu-calculator-app/1188716bis
Reviewer Review Type Date Requested Status
Nicholas Skaggs (community) 2013-07-31 Approve on 2013-07-31
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2013-07-31
Review via email: mp+177771@code.launchpad.net

Commit message

Added test to check if a calc is saved when you close and reopen the app

Description of the change

Added test to check if a calc is saved when you close and reopen the app

To post a comment you must log in.
Nicholas Skaggs (nskaggs) wrote :

Excellent. This fills in the final needed testcase. We'll have to see what happens with the issue of sending the kill signal. For now, let's add it :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntu_calculator_app/tests/test_simple_page.py'
2--- tests/autopilot/ubuntu_calculator_app/tests/test_simple_page.py 2013-07-17 13:53:51 +0000
3+++ tests/autopilot/ubuntu_calculator_app/tests/test_simple_page.py 2013-07-31 09:23:42 +0000
4@@ -16,6 +16,8 @@
5 from ubuntu_calculator_app.tests import CalculatorTestCase
6 from ubuntu_calculator_app.emulators.simple_page import SimplePage
7
8+import os.path
9+
10
11 class TestSimplePage(CalculatorTestCase):
12
13@@ -95,6 +97,38 @@
14 self.assertThat(
15 get_result, Eventually(Equals(expected_result)))
16
17+ def _close_and_reopen(self):
18+ # See #1188292, there is a bug in SDK that prevents to use terminate
19+ #self.simple_page.app.process.terminate()
20+ #self.simple_page.app.process.wait()
21+
22+ screen = self.simple_page.get_screen()
23+ x, y, h, w = screen.globalRect
24+
25+ self.pointing_device.move(x + (h / 25), y + w / 2.7)
26+ self.pointing_device.click()
27+
28+ self.simple_page.app.process.wait()
29+
30+ local_location = "../../ubuntu-calculator-app.qml"
31+
32+ # Yes, I know, it's a duplication of CalculatorTestCase().setUp(), but I didn't find a better way to implement it
33+ if os.path.exists(self.local_location):
34+ self.app = self.launch_test_application(
35+ "qmlscene",
36+ self.local_location,
37+ app_type='qt')
38+ else:
39+ self.app = self.launch_test_application(
40+ "qmlscene",
41+ "/usr/share/ubuntu-calculator-app/ubuntu-calculator-app.qml",
42+ "--desktop_file_hint="
43+ "/usr/share/applications/ubuntu-calculator-app.desktop",
44+ app_type='qt')
45+
46+ # Check if windows has been launch
47+ self.assertThat(self.simple_page.app.select_single("QQuickView").visible, Eventually(Equals(True)))
48+
49 def test_equals_dont_change_numbers(self):
50 """ Test that typing a number and pressing "=" won't change the number
51 (bug #1165894).
52@@ -229,4 +263,13 @@
53 self.pointing_device.click_object(calc)
54
55 self._calculate("+5")
56- self._assert_result("25")
57\ No newline at end of file
58+ self._assert_result("25")
59+
60+ def test_save_calculation_between_reload(self):
61+ # Do the calc
62+ self._tear_off("44-2")
63+
64+ self._close_and_reopen()
65+
66+ label = lambda: self.simple_page.get_calc_label("42")
67+ self.assertThat(label, Eventually(NotEquals(None)))
68\ No newline at end of file

Subscribers

People subscribed via source and target branches