Merge lp:~om26er/ubuntu-calculator-app/fix_pep8_and_more into lp:~ubuntu-calculator-dev/ubuntu-calculator-app/old_trunk

Proposed by Omer Akram
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 122
Merged at revision: 120
Proposed branch: lp:~om26er/ubuntu-calculator-app/fix_pep8_and_more
Merge into: lp:~ubuntu-calculator-dev/ubuntu-calculator-app/old_trunk
Diff against target: 140 lines (+32/-24)
2 files modified
tests/autopilot/ubuntu_calculator_app/emulators/simple_page.py (+5/-3)
tests/autopilot/ubuntu_calculator_app/tests/test_simple_page.py (+27/-21)
To merge this branch: bzr merge lp:~om26er/ubuntu-calculator-app/fix_pep8_and_more
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Riccardo Padovani Approve
Review via email: mp+178300@code.launchpad.net

Commit message

fixing pep8 complaints of the autopilot code

Description of the change

fixing pep8 complaints of the autopilot code, also fixes the way order in which we get variables from globalRect, they are in the form of x,y,w,h and we were using it as x,y, h, w

To post a comment you must log in.
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Good, thanks :)

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

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/emulators/simple_page.py'
2--- tests/autopilot/ubuntu_calculator_app/emulators/simple_page.py 2013-08-02 02:51:30 +0000
3+++ tests/autopilot/ubuntu_calculator_app/emulators/simple_page.py 2013-08-02 13:51:28 +0000
4@@ -18,13 +18,15 @@
5 return self.app.select_single('CalcLabel', isLast=True)
6
7 def get_calc_label(self, numbers):
8- return self.app.select_single('CalcLabel', numbers=numbers)
9+ return self.app.select_single('CalcLabel', numbers=numbers)
10
11 def get_screen(self):
12 return self.app.select_many("Screen")[0]
13
14 def get_confirm_delete_button(self):
15- return self.app.select_single("Button", objectName="calculationDelete", visible=True)
16+ return self.app.select_single(
17+ "Button", objectName="calculationDelete", visible=True)
18
19 def get_main_screen_qqlv(self):
20- return self.app.select_single("SimplePage").select_single("QQuickListView")
21+ page = self.app.select_single("SimplePage")
22+ return page.select_single("QQuickListView")
23
24=== modified file 'tests/autopilot/ubuntu_calculator_app/tests/test_simple_page.py'
25--- tests/autopilot/ubuntu_calculator_app/tests/test_simple_page.py 2013-08-02 02:51:30 +0000
26+++ tests/autopilot/ubuntu_calculator_app/tests/test_simple_page.py 2013-08-02 13:51:28 +0000
27@@ -80,10 +80,10 @@
28 def _delete_last_calculation(self):
29 screen = self.simple_page.get_screen()
30 quick_list_view = self.simple_page.get_main_screen_qqlv()
31-
32+
33 x, y, w, h = screen.globalRect
34 tx = x + (w - w / 8)
35- ty = y + (h / 2)
36+ ty = y + (h / 2)
37 self.pointing_device.drag(tx, ty, tx / 8, ty)
38 self.pointing_device.drag(tx, ty, tx, ty + h)
39
40@@ -105,18 +105,19 @@
41 # See #1188292, there is a bug in SDK that prevents to use terminate
42 #self.simple_page.app.process.terminate()
43 #self.simple_page.app.process.wait()
44-
45+
46 screen = self.simple_page.get_screen()
47- x, y, h, w = screen.globalRect
48+ x, y, w, h = screen.globalRect
49
50- self.pointing_device.move(x + (h / 25), y + w / 2.7)
51+ self.pointing_device.move(x + (w / 25), y + h / 2.7)
52 self.pointing_device.click()
53-
54+
55 self.simple_page.app.process.wait()
56
57 local_location = "../../ubuntu-calculator-app.qml"
58
59- # Yes, I know, it's a duplication of CalculatorTestCase().setUp(), but I didn't find a better way to implement it
60+ # Yes, I know, it's a duplication of CalculatorTestCase().setUp(),
61+ # but I didn't find a better way to implement it
62 if os.path.exists(local_location):
63 self.app = self.launch_test_application(
64 "qmlscene",
65@@ -131,7 +132,9 @@
66 app_type='qt')
67
68 # Check if windows has been launch
69- self.assertThat(self.simple_page.app.select_single("QQuickView").visible, Eventually(Equals(True)))
70+ self.assertThat(
71+ self.simple_page.app.select_single("QQuickView").visible,
72+ Eventually(Equals(True)))
73
74 def test_equals_dont_change_numbers(self):
75 """ Test that typing a number and pressing "=" won't change the number
76@@ -164,11 +167,11 @@
77 screen = self.simple_page.get_screen()
78 self._click_buttons("9")
79
80- x, y, h, w = screen.globalRect
81- tx = x + (h / 2)
82- ty = y + (w / 2)
83+ x, y, w, h = screen.globalRect
84+ tx = x + (w / 2)
85+ ty = y + (h / 2)
86
87- self.pointing_device.drag(tx, ty + w, tx, ty - w)
88+ self.pointing_device.drag(tx, ty + h, tx, ty - h)
89
90 self._assert_result("")
91
92@@ -235,9 +238,9 @@
93 def test_divide_by_zero(self):
94 self._calculate("4/0")
95 result_box = self.simple_page.get_formula_label().numbers
96-
97- self.assertThat(lambda: type(result_box) is not IntType,
98- Eventually(Equals(True)))
99+
100+ self.assertThat(
101+ lambda: type(result_box) is not IntType, Eventually(Equals(True)))
102
103 def test_tear_off(self):
104 """Test tear off adds calculation to history"""
105@@ -247,7 +250,8 @@
106 self._tear_off("9+5")
107
108 # Check if has been saved
109- self.assertThat(lambda: num_calc_sections_old,
110+ self.assertThat(
111+ lambda: num_calc_sections_old,
112 Eventually(NotEquals(quick_list_view.count)))
113
114 def test_swipe_delete_calculation_right_left(self):
115@@ -260,7 +264,8 @@
116 # Delete the calculation
117 self._delete_last_calculation()
118 # Check if has been deleted
119- self.assertThat(lambda: num_calc_sections_old,
120+ self.assertThat(
121+ lambda: num_calc_sections_old,
122 Eventually(Equals(quick_list_view.count)))
123
124 def test_click_history(self):
125@@ -275,10 +280,11 @@
126 self._calculate("+5")
127 self._assert_result("25")
128
129- @unittest.skip("We are doing things wrong on so many levels, we are trying \
130- to click the close button with magic numbers which we cannot rely on, also \
131- on touch devices there is no such thing as close button, skipping this \
132- test for now till we find a better solution")
133+ @unittest.skip("We are doing things wrong on so many levels, we are \
134+ trying to click the close button with magic numbers which we \
135+ cannot rely on, also on touch devices there is no such thing as \
136+ close button, skipping this test for now till we find a better \
137+ solution. bug 1207593")
138 def test_save_calculation_between_reload(self):
139 # Do the calc
140 self._tear_off("44-2")

Subscribers

People subscribed via source and target branches