Merge lp:~popey/ubuntu-terminal-app/fix-1317198 into lp:ubuntu-terminal-app

Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 68
Merged at revision: 68
Proposed branch: lp:~popey/ubuntu-terminal-app/fix-1317198
Merge into: lp:ubuntu-terminal-app
Diff against target: 188 lines (+49/-37)
2 files modified
tests/autopilot/ubuntu_terminal_app/emulators.py (+16/-11)
tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py (+33/-26)
To merge this branch: bzr merge lp:~popey/ubuntu-terminal-app/fix-1317198
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Terminal Developers Pending
Review via email: mp+220284@code.launchpad.net

Commit message

Fixup pep8 and pyflakes errors.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
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_terminal_app/emulators.py'
2--- tests/autopilot/ubuntu_terminal_app/emulators.py 2014-03-05 16:10:04 +0000
3+++ tests/autopilot/ubuntu_terminal_app/emulators.py 2014-05-20 15:04:24 +0000
4@@ -21,6 +21,7 @@
5
6
7 class MainView(toolkit_emulators.MainView):
8+
9 """Terminal MainView Autopilot emulator."""
10
11 def get_main_view(self):
12@@ -53,7 +54,8 @@
13
14 def get_panel_actions_popover(self):
15 """Return the ActionSelectionPopover emulator of the popup action."""
16- return self.wait_select_single(ActionSelectionPopover, objectName='panelpopover')
17+ return self.wait_select_single(ActionSelectionPopover,
18+ objectName='panelpopover')
19
20 def drag_horizontal_slider(self, slider, pos):
21 """Drag slider until value is set"""
22@@ -72,27 +74,30 @@
23
24 x, y, w, h = slRect.globalRect
25 # calculate the approximate slide step width
26- # we take half of the theoretical step value just to make sure we don't miss any values
27+ # we take half of the theoretical step value just to make
28+ # sure we don't miss any values
29 step = w / ((slideMax - slideMin) * 2)
30 sx = x + step
31 sy = y + h / 2
32 loop = 1
33
34- #set the slider to minimum value and loop
35+ # set the slider to minimum value and loop
36 self.pointing_device.move(sx, sy)
37 self.pointing_device.click()
38
39- #drag through the slider until the pos matches our desired value
40- #in case of bad sliding, loop will also timeout
41- while round(slItem.value) != pos and slItem.value<slideMax and loop<=(slideMax*2):
42- valuePos = int(sx + step)
43- self.pointing_device.drag(sx, sy, valuePos, sy)
44- sx = valuePos
45- sleep(0.3)
46- loop = loop + 1
47+ # drag through the slider until the pos matches our desired value
48+ # in case of bad sliding, loop will also timeout
49+ while round(slItem.value) != pos and slItem.value < slideMax \
50+ and loop <= (slideMax * 2):
51+ valuePos = int(sx + step)
52+ self.pointing_device.drag(sx, sy, valuePos, sy)
53+ sx = valuePos
54+ sleep(0.3)
55+ loop = loop + 1
56
57
58 class ActionSelectionPopover(toolkit_emulators.UbuntuUIToolkitEmulatorBase):
59+
60 """ActionSelectionPopover Autopilot emulator."""
61 # TODO Move this to the ubuntu-ui-toolkit. Reported on
62 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1205205
63
64=== modified file 'tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py'
65--- tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py 2014-02-27 17:17:02 +0000
66+++ tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py 2014-05-20 15:04:24 +0000
67@@ -19,6 +19,7 @@
68 import unittest
69 import random
70
71+
72 class TestMainWindow(TerminalTestCase, DbMan):
73
74 def setUp(self):
75@@ -36,12 +37,13 @@
76 toolbar.click_button("PanelsButton")
77 panel_popover = self.main_view.get_panel_actions_popover()
78
79- #we have to poll the complex action because we can't check the animation for the header
80- while panel_popover == None and timeout < 10:
81+ # we have to poll the complex action because
82+ # we can't check the animation for the header
83+ while panel_popover is None and timeout < 10:
84 toolbar.click_button("PanelsButton")
85 panel_popover = self.main_view.get_panel_actions_popover()
86 sleep(1)
87- timeout+=1
88+ timeout += 1
89 panel_popover.click_button("Hide extra panel")
90
91 def click_item_selector_item(self, selector, value):
92@@ -50,14 +52,21 @@
93 # ListItem.ItemSelector {
94 # objectName:
95 # model:
96- self.assertThat(lambda: self.main_view.select_single("ItemSelector", objectName=selector), Eventually(Not(Is(None))))
97- item_selector = self.main_view.select_single("ItemSelector", objectName=selector)
98- #we need to regrab object as for some reason it can sometimes change and our ordering will be off down below
99- self.assertThat(lambda: self.main_view.select_single("ItemSelector", objectName=selector), Eventually(Not(Is(None))))
100- item_selector = self.main_view.select_single("ItemSelector", objectName=selector)
101- self.assertThat(lambda: item_selector.select_many("QQuickColumn"), Eventually(Not(Is(None))))
102+ self.assertThat(lambda: self.main_view.select_single("ItemSelector",
103+ objectName=selector), Eventually(Not(Is(None))))
104+ item_selector = self.main_view.select_single("ItemSelector",
105+ objectName=selector)
106+ # we need to regrab object as for some reason it can sometimes
107+ # change and our ordering will be off down below
108+ self.assertThat(lambda: self.main_view.select_single("ItemSelector",
109+ objectName=selector), Eventually(Not(Is(None))))
110+ item_selector = self.main_view.select_single("ItemSelector",
111+ objectName=selector)
112+ self.assertThat(lambda: item_selector.select_many("QQuickColumn"),
113+ Eventually(Not(Is(None))))
114 rows = item_selector.select_many("QQuickColumn")
115- self.assertThat(lambda: rows[0].select_single("QQuickListView", objectName="listView"), Eventually(Not(Is(None))))
116+ self.assertThat(lambda: rows[0].select_single("QQuickListView",
117+ objectName="listView"), Eventually(Not(Is(None))))
118 items = rows[0].select_single("QQuickListView", objectName="listView")
119 self.pointing_device.click_object(items)
120 for ritem in items:
121@@ -114,8 +123,8 @@
122 on long tap"""
123 kterm = self.main_view.get_terminal_page()
124 x, y, w, h = kterm.globalRect
125- tap_x = (x + w ) / 2
126- tap_y = (y + h ) / 3
127+ tap_x = (x + w) / 2
128+ tap_y = (y + h) / 3
129
130 #tap in the top third of the screen, to avoid OSK
131 self.pointing_device.move(tap_x, tap_y)
132@@ -146,44 +155,42 @@
133 #are these string translatable?
134 #if so, we need to do this another way
135 schemeList = ("DarkPastels",
136- "Linux",
137- "BlackOnRandomLight",
138- "BlackOnWhite",
139- "BlackOnLightYellow",
140- "GreenOnBlack",
141- "WhiteOnBlack",
142- )
143+ "Linux",
144+ "BlackOnRandomLight",
145+ "BlackOnWhite",
146+ "BlackOnLightYellow",
147+ "GreenOnBlack",
148+ "WhiteOnBlack")
149
150 for scheme in schemeList:
151- self.click_item_selector_item("liSchemes",scheme)
152+ self.click_item_selector_item("liSchemes", scheme)
153 # This assert uses KTerminalDisplay property (old rev)
154 self.assertThat(kterm.colorScheme, Eventually(Equals(scheme)))
155 # This assert uses localstorage (new rev)
156 colorScheme = self.get_color_scheme_from_storage
157 self.assertThat(colorScheme, Eventually(Equals(scheme)))
158
159-
160 def test_font_size_changes(self):
161 """Make sure that font size is set correctly"""
162 toolbar = self.main_view.open_toolbar()
163 toolbar.click_button("SettingsButton")
164
165 # change font size to max
166- self.main_view.drag_horizontal_slider("slFont",32)
167+ self.main_view.drag_horizontal_slider("slFont", 32)
168 sleep(1)
169 font_size = self.get_font_size_from_storage()
170 self.assertThat(font_size, Equals(32))
171
172 ## change font size to min
173- self.main_view.drag_horizontal_slider("slFont",8)
174+ self.main_view.drag_horizontal_slider("slFont", 8)
175 sleep(1)
176 font_size = self.get_font_size_from_storage()
177 self.assertThat(font_size, Equals(8))
178
179 ## change font size to random sizes
180- for loop in range(1,3):
181- randSize = random.randrange(8,32,1)
182- self.main_view.drag_horizontal_slider("slFont",randSize)
183+ for loop in range(1, 3):
184+ randSize = random.randrange(8, 32, 1)
185+ self.main_view.drag_horizontal_slider("slFont", randSize)
186 sleep(1)
187 font_size = self.get_font_size_from_storage()
188 self.assertThat(font_size, Equals(randSize))

Subscribers

People subscribed via source and target branches