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
=== modified file 'tests/autopilot/ubuntu_terminal_app/emulators.py'
--- tests/autopilot/ubuntu_terminal_app/emulators.py 2014-03-05 16:10:04 +0000
+++ tests/autopilot/ubuntu_terminal_app/emulators.py 2014-05-20 15:04:24 +0000
@@ -21,6 +21,7 @@
2121
2222
23class MainView(toolkit_emulators.MainView):23class MainView(toolkit_emulators.MainView):
24
24 """Terminal MainView Autopilot emulator."""25 """Terminal MainView Autopilot emulator."""
2526
26 def get_main_view(self):27 def get_main_view(self):
@@ -53,7 +54,8 @@
5354
54 def get_panel_actions_popover(self):55 def get_panel_actions_popover(self):
55 """Return the ActionSelectionPopover emulator of the popup action."""56 """Return the ActionSelectionPopover emulator of the popup action."""
56 return self.wait_select_single(ActionSelectionPopover, objectName='panelpopover')57 return self.wait_select_single(ActionSelectionPopover,
58 objectName='panelpopover')
5759
58 def drag_horizontal_slider(self, slider, pos):60 def drag_horizontal_slider(self, slider, pos):
59 """Drag slider until value is set"""61 """Drag slider until value is set"""
@@ -72,27 +74,30 @@
7274
73 x, y, w, h = slRect.globalRect75 x, y, w, h = slRect.globalRect
74 # calculate the approximate slide step width76 # calculate the approximate slide step width
75 # we take half of the theoretical step value just to make sure we don't miss any values77 # we take half of the theoretical step value just to make
78 # sure we don't miss any values
76 step = w / ((slideMax - slideMin) * 2)79 step = w / ((slideMax - slideMin) * 2)
77 sx = x + step80 sx = x + step
78 sy = y + h / 281 sy = y + h / 2
79 loop = 182 loop = 1
8083
81 #set the slider to minimum value and loop84 # set the slider to minimum value and loop
82 self.pointing_device.move(sx, sy)85 self.pointing_device.move(sx, sy)
83 self.pointing_device.click()86 self.pointing_device.click()
8487
85 #drag through the slider until the pos matches our desired value88 # drag through the slider until the pos matches our desired value
86 #in case of bad sliding, loop will also timeout89 # in case of bad sliding, loop will also timeout
87 while round(slItem.value) != pos and slItem.value<slideMax and loop<=(slideMax*2):90 while round(slItem.value) != pos and slItem.value < slideMax \
88 valuePos = int(sx + step)91 and loop <= (slideMax * 2):
89 self.pointing_device.drag(sx, sy, valuePos, sy)92 valuePos = int(sx + step)
90 sx = valuePos93 self.pointing_device.drag(sx, sy, valuePos, sy)
91 sleep(0.3)94 sx = valuePos
92 loop = loop + 195 sleep(0.3)
96 loop = loop + 1
9397
9498
95class ActionSelectionPopover(toolkit_emulators.UbuntuUIToolkitEmulatorBase):99class ActionSelectionPopover(toolkit_emulators.UbuntuUIToolkitEmulatorBase):
100
96 """ActionSelectionPopover Autopilot emulator."""101 """ActionSelectionPopover Autopilot emulator."""
97 # TODO Move this to the ubuntu-ui-toolkit. Reported on102 # TODO Move this to the ubuntu-ui-toolkit. Reported on
98 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1205205103 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1205205
99104
=== modified file 'tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py'
--- tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py 2014-02-27 17:17:02 +0000
+++ tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py 2014-05-20 15:04:24 +0000
@@ -19,6 +19,7 @@
19import unittest19import unittest
20import random20import random
2121
22
22class TestMainWindow(TerminalTestCase, DbMan):23class TestMainWindow(TerminalTestCase, DbMan):
2324
24 def setUp(self):25 def setUp(self):
@@ -36,12 +37,13 @@
36 toolbar.click_button("PanelsButton")37 toolbar.click_button("PanelsButton")
37 panel_popover = self.main_view.get_panel_actions_popover()38 panel_popover = self.main_view.get_panel_actions_popover()
3839
39 #we have to poll the complex action because we can't check the animation for the header40 # we have to poll the complex action because
40 while panel_popover == None and timeout < 10:41 # we can't check the animation for the header
42 while panel_popover is None and timeout < 10:
41 toolbar.click_button("PanelsButton")43 toolbar.click_button("PanelsButton")
42 panel_popover = self.main_view.get_panel_actions_popover()44 panel_popover = self.main_view.get_panel_actions_popover()
43 sleep(1)45 sleep(1)
44 timeout+=146 timeout += 1
45 panel_popover.click_button("Hide extra panel")47 panel_popover.click_button("Hide extra panel")
4648
47 def click_item_selector_item(self, selector, value):49 def click_item_selector_item(self, selector, value):
@@ -50,14 +52,21 @@
50 # ListItem.ItemSelector {52 # ListItem.ItemSelector {
51 # objectName:53 # objectName:
52 # model:54 # model:
53 self.assertThat(lambda: self.main_view.select_single("ItemSelector", objectName=selector), Eventually(Not(Is(None))))55 self.assertThat(lambda: self.main_view.select_single("ItemSelector",
54 item_selector = self.main_view.select_single("ItemSelector", objectName=selector)56 objectName=selector), Eventually(Not(Is(None))))
55 #we need to regrab object as for some reason it can sometimes change and our ordering will be off down below57 item_selector = self.main_view.select_single("ItemSelector",
56 self.assertThat(lambda: self.main_view.select_single("ItemSelector", objectName=selector), Eventually(Not(Is(None))))58 objectName=selector)
57 item_selector = self.main_view.select_single("ItemSelector", objectName=selector)59 # we need to regrab object as for some reason it can sometimes
58 self.assertThat(lambda: item_selector.select_many("QQuickColumn"), Eventually(Not(Is(None))))60 # change and our ordering will be off down below
61 self.assertThat(lambda: self.main_view.select_single("ItemSelector",
62 objectName=selector), Eventually(Not(Is(None))))
63 item_selector = self.main_view.select_single("ItemSelector",
64 objectName=selector)
65 self.assertThat(lambda: item_selector.select_many("QQuickColumn"),
66 Eventually(Not(Is(None))))
59 rows = item_selector.select_many("QQuickColumn")67 rows = item_selector.select_many("QQuickColumn")
60 self.assertThat(lambda: rows[0].select_single("QQuickListView", objectName="listView"), Eventually(Not(Is(None))))68 self.assertThat(lambda: rows[0].select_single("QQuickListView",
69 objectName="listView"), Eventually(Not(Is(None))))
61 items = rows[0].select_single("QQuickListView", objectName="listView")70 items = rows[0].select_single("QQuickListView", objectName="listView")
62 self.pointing_device.click_object(items)71 self.pointing_device.click_object(items)
63 for ritem in items:72 for ritem in items:
@@ -114,8 +123,8 @@
114 on long tap"""123 on long tap"""
115 kterm = self.main_view.get_terminal_page()124 kterm = self.main_view.get_terminal_page()
116 x, y, w, h = kterm.globalRect125 x, y, w, h = kterm.globalRect
117 tap_x = (x + w ) / 2126 tap_x = (x + w) / 2
118 tap_y = (y + h ) / 3127 tap_y = (y + h) / 3
119128
120 #tap in the top third of the screen, to avoid OSK129 #tap in the top third of the screen, to avoid OSK
121 self.pointing_device.move(tap_x, tap_y)130 self.pointing_device.move(tap_x, tap_y)
@@ -146,44 +155,42 @@
146 #are these string translatable?155 #are these string translatable?
147 #if so, we need to do this another way156 #if so, we need to do this another way
148 schemeList = ("DarkPastels",157 schemeList = ("DarkPastels",
149 "Linux",158 "Linux",
150 "BlackOnRandomLight",159 "BlackOnRandomLight",
151 "BlackOnWhite",160 "BlackOnWhite",
152 "BlackOnLightYellow",161 "BlackOnLightYellow",
153 "GreenOnBlack",162 "GreenOnBlack",
154 "WhiteOnBlack",163 "WhiteOnBlack")
155 )
156164
157 for scheme in schemeList:165 for scheme in schemeList:
158 self.click_item_selector_item("liSchemes",scheme)166 self.click_item_selector_item("liSchemes", scheme)
159 # This assert uses KTerminalDisplay property (old rev)167 # This assert uses KTerminalDisplay property (old rev)
160 self.assertThat(kterm.colorScheme, Eventually(Equals(scheme)))168 self.assertThat(kterm.colorScheme, Eventually(Equals(scheme)))
161 # This assert uses localstorage (new rev)169 # This assert uses localstorage (new rev)
162 colorScheme = self.get_color_scheme_from_storage170 colorScheme = self.get_color_scheme_from_storage
163 self.assertThat(colorScheme, Eventually(Equals(scheme)))171 self.assertThat(colorScheme, Eventually(Equals(scheme)))
164172
165
166 def test_font_size_changes(self):173 def test_font_size_changes(self):
167 """Make sure that font size is set correctly"""174 """Make sure that font size is set correctly"""
168 toolbar = self.main_view.open_toolbar()175 toolbar = self.main_view.open_toolbar()
169 toolbar.click_button("SettingsButton")176 toolbar.click_button("SettingsButton")
170177
171 # change font size to max178 # change font size to max
172 self.main_view.drag_horizontal_slider("slFont",32)179 self.main_view.drag_horizontal_slider("slFont", 32)
173 sleep(1)180 sleep(1)
174 font_size = self.get_font_size_from_storage()181 font_size = self.get_font_size_from_storage()
175 self.assertThat(font_size, Equals(32))182 self.assertThat(font_size, Equals(32))
176183
177 ## change font size to min184 ## change font size to min
178 self.main_view.drag_horizontal_slider("slFont",8)185 self.main_view.drag_horizontal_slider("slFont", 8)
179 sleep(1)186 sleep(1)
180 font_size = self.get_font_size_from_storage()187 font_size = self.get_font_size_from_storage()
181 self.assertThat(font_size, Equals(8))188 self.assertThat(font_size, Equals(8))
182189
183 ## change font size to random sizes190 ## change font size to random sizes
184 for loop in range(1,3):191 for loop in range(1, 3):
185 randSize = random.randrange(8,32,1)192 randSize = random.randrange(8, 32, 1)
186 self.main_view.drag_horizontal_slider("slFont",randSize)193 self.main_view.drag_horizontal_slider("slFont", randSize)
187 sleep(1)194 sleep(1)
188 font_size = self.get_font_size_from_storage()195 font_size = self.get_font_size_from_storage()
189 self.assertThat(font_size, Equals(randSize))196 self.assertThat(font_size, Equals(randSize))

Subscribers

People subscribed via source and target branches