Merge lp:~cimi/unity8/unity8.hud-2_hint-reveal-commit into lp:unity8
- unity8.hud-2_hint-reveal-commit
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Michał Sawicz |
Approved revision: | 333 |
Merged at revision: | 383 |
Proposed branch: | lp:~cimi/unity8/unity8.hud-2_hint-reveal-commit |
Merge into: | lp:unity8 |
Diff against target: |
524 lines (+189/-43) 9 files modified
Bottombar/Bottombar.qml (+81/-16) Shell.qml (+2/-0) plugins/Unity/bottombarvisibilitycommunicatorshell.cpp (+15/-1) plugins/Unity/bottombarvisibilitycommunicatorshell.h (+6/-0) tests/autopilot/unity8/shell/__init__.py (+14/-0) tests/autopilot/unity8/shell/emulators/dash.py (+15/-6) tests/autopilot/unity8/shell/emulators/hud.py (+8/-9) tests/autopilot/unity8/shell/emulators/main_window.py (+3/-0) tests/autopilot/unity8/shell/tests/test_hud.py (+45/-11) |
To merge this branch: | bzr merge lp:~cimi/unity8/unity8.hud-2_hint-reveal-commit |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Michael Zanetti (community) | Approve | ||
Michał Sawicz | Needs Fixing | ||
Review via email: mp+187488@code.launchpad.net |
Commit message
Add behaviours to the hud reveal.
Description of the change
Add some extra behaviours for the hud button, following design guidelines.
Requires a branch for ubuntu-ui-toolkit to function properly with the toolbar (not required to run, though)
PS Jenkins bot (ps-jenkins) wrote : | # |
Michał Sawicz (saviq) wrote : | # |
tests/autopilot
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:324
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:325
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:326
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:325
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
Michael Zanetti (mzanetti) wrote : | # |
Is position really a double? Seems like a pixel value to me.
===
243 bool forceHidden() const;
244 + double position() const;
245 void setForceHidden(bool forceHidden);
246 + void setPosition(double position);
Usually we group them like this:
243 bool forceHidden() const;
245 void setForceHidden(bool forceHidden);
244 + double position() const;
246 + void setPosition(double position);
===
Can you move the _drag() method to some common place? maybe the __init__.py or something like that. I don't think copying that all over the place is a good idea.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:327
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:330
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:331
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:332
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:333
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'Bottombar/Bottombar.qml' |
2 | --- Bottombar/Bottombar.qml 2013-09-12 04:51:31 +0000 |
3 | +++ Bottombar/Bottombar.qml 2013-10-02 09:27:24 +0000 |
4 | @@ -34,15 +34,32 @@ |
5 | |
6 | state: "hidden" |
7 | |
8 | + function hide() { |
9 | + dismissTimer.stop() |
10 | + bottombar.state = "hidden" |
11 | + } |
12 | + |
13 | + onApplicationIsOnForegroundChanged: { |
14 | + if (!applicationIsOnForeground) { |
15 | + hide() |
16 | + } |
17 | + } |
18 | + |
19 | onStateChanged: { |
20 | if (state == "hidden") { |
21 | dismissTimer.stop() |
22 | + bottomBarVisibilityCommunicatorShell.forceHidden = false |
23 | } else { |
24 | dismissTimer.restart() |
25 | } |
26 | } |
27 | |
28 | onPreventHidingChanged: { |
29 | + if (!preventHiding) { |
30 | + if (state == "hint" || state == "reveal") |
31 | + hide() |
32 | + } |
33 | + |
34 | if (dismissTimer.running) { |
35 | dismissTimer.restart(); |
36 | } |
37 | @@ -50,7 +67,7 @@ |
38 | |
39 | Timer { |
40 | id: dismissTimer |
41 | - interval: 5000 |
42 | + interval: 1000 |
43 | onTriggered: { |
44 | if (!bottombar.preventHiding) { |
45 | bottombar.state = "hidden" |
46 | @@ -103,24 +120,29 @@ |
47 | |
48 | EdgeDragArea { |
49 | id: dragArea |
50 | + objectName: "hudDragArea" |
51 | width: parent.width |
52 | height: distanceThreshold |
53 | anchors.bottom: parent.bottom |
54 | |
55 | - distanceThreshold: units.gu(1) |
56 | + distanceThreshold: units.gu(8) |
57 | enabled: !theHud.shown && bottombar.enabled && applicationIsOnForeground |
58 | direction: Direction.Upwards |
59 | + maxSilenceTime: 2000 |
60 | |
61 | property int previousStatus: -1 |
62 | property real touchStartX: -1 |
63 | |
64 | + readonly property real distanceFromThreshold: (-distance) - distanceThreshold // distance is negative |
65 | + readonly property real revealDistance: units.gu(2) |
66 | + readonly property real commitDistance: units.gu(6) |
67 | + readonly property real commitProgress: MathLocal.clamp(distanceFromThreshold / commitDistance, 0, 1) |
68 | + |
69 | onStatusChanged: { |
70 | if (status === DirectionalDragArea.WaitingForTouch) { |
71 | if (previousStatus == DirectionalDragArea.Recognized) { |
72 | if (hudButton.mouseOver) { |
73 | hudButton.clicked() |
74 | - } else { |
75 | - bottombar.state = "hidden" |
76 | } |
77 | } |
78 | } else if (status === DirectionalDragArea.Undecided) { |
79 | @@ -128,35 +150,78 @@ |
80 | touchStartX = touchX |
81 | } |
82 | } else if (status === DirectionalDragArea.Recognized) { |
83 | - bottombar.state = "shown" |
84 | + bottombar.state = "hint" |
85 | } |
86 | previousStatus = status |
87 | } |
88 | + |
89 | + onDistanceChanged: { |
90 | + if (status === DirectionalDragArea.Recognized) { |
91 | + if (distanceFromThreshold > commitDistance) |
92 | + bottombar.state = "shown" |
93 | + else if (distanceFromThreshold > revealDistance) |
94 | + bottombar.state = "reveal" |
95 | + } |
96 | + } |
97 | + } |
98 | + |
99 | + Item { |
100 | + id: dismissArea |
101 | + anchors { |
102 | + top: parent.top |
103 | + left: parent.left |
104 | + right: parent.right |
105 | + } |
106 | + height: parent.height - bottomBarVisibilityCommunicatorShell.position |
107 | + |
108 | + MouseArea { |
109 | + anchors.fill: parent |
110 | + enabled: bottombar.state == "shown" |
111 | + onPressed: { |
112 | + bottomBarVisibilityCommunicatorShell.forceHidden = true |
113 | + bottombar.state = "hidden" |
114 | + } |
115 | + } |
116 | + |
117 | + InputFilterArea { |
118 | + anchors.fill: parent |
119 | + blockInput: (hudButton.opacity == 1) |
120 | + } |
121 | } |
122 | |
123 | MouseArea { |
124 | - anchors.fill: parent |
125 | - enabled: bottombar.state == "shown" |
126 | + anchors { |
127 | + top: dismissArea.bottom |
128 | + left: parent.left |
129 | + right: parent.right |
130 | + bottom: parent.bottom |
131 | + } |
132 | + enabled: bottombar.state == "shown" && bottomBarVisibilityCommunicatorShell.position > 0 |
133 | onPressed: { |
134 | bottombar.state = "hidden" |
135 | } |
136 | } |
137 | |
138 | - InputFilterArea { |
139 | - anchors.fill: parent |
140 | - blockInput: (hudButton.opacity == 1) |
141 | - } |
142 | - |
143 | states: [ |
144 | State { |
145 | name: "hidden" |
146 | - PropertyChanges { target: hudButton; opacity: 0} |
147 | - PropertyChanges { target: hudButton; bottomMargin: units.gu(-1)} |
148 | + PropertyChanges { target: hudButton; opacity: 0 } |
149 | + PropertyChanges { target: hudButton; bottomMargin: units.gu(-2) } |
150 | + }, |
151 | + State { |
152 | + name: "hint" |
153 | + extend: "hidden" |
154 | + PropertyChanges { target: hudButton; opacity: 0.5 } |
155 | + }, |
156 | + State { |
157 | + name: "reveal" |
158 | + extend: "hint" |
159 | + PropertyChanges { target: hudButton; bottomMargin: units.gu(-2) + units.gu(2) * dragArea.commitProgress } |
160 | }, |
161 | State { |
162 | name: "shown" |
163 | - PropertyChanges { target: hudButton; opacity: 1} |
164 | - PropertyChanges { target: hudButton; bottomMargin: units.gu(0)} |
165 | + PropertyChanges { target: hudButton; opacity: 1 } |
166 | + PropertyChanges { target: hudButton; bottomMargin: units.gu(0) } |
167 | } |
168 | ] |
169 | } |
170 | |
171 | === modified file 'Shell.qml' |
172 | --- Shell.qml 2013-09-30 15:47:18 +0000 |
173 | +++ Shell.qml 2013-10-02 09:27:24 +0000 |
174 | @@ -623,6 +623,7 @@ |
175 | } |
176 | |
177 | Bottombar { |
178 | + id: bottombar |
179 | theHud: hud |
180 | anchors.fill: parent |
181 | enabled: hud.available |
182 | @@ -663,6 +664,7 @@ |
183 | if (shown) { |
184 | panel.indicators.hide() |
185 | hud.hide() |
186 | + bottombar.hide() |
187 | } |
188 | } |
189 | } |
190 | |
191 | === modified file 'plugins/Unity/bottombarvisibilitycommunicatorshell.cpp' |
192 | --- plugins/Unity/bottombarvisibilitycommunicatorshell.cpp 2013-06-05 22:03:08 +0000 |
193 | +++ plugins/Unity/bottombarvisibilitycommunicatorshell.cpp 2013-10-02 09:27:24 +0000 |
194 | @@ -17,7 +17,8 @@ |
195 | #include "bottombarvisibilitycommunicatorshell.h" |
196 | |
197 | BottomBarVisibilityCommunicatorShell::BottomBarVisibilityCommunicatorShell() |
198 | - : m_forceHidden(false) |
199 | + : m_forceHidden(false), |
200 | + m_position(0) |
201 | { |
202 | } |
203 | |
204 | @@ -26,6 +27,11 @@ |
205 | return m_forceHidden; |
206 | } |
207 | |
208 | +double BottomBarVisibilityCommunicatorShell::position() const |
209 | +{ |
210 | + return m_position; |
211 | +} |
212 | + |
213 | void BottomBarVisibilityCommunicatorShell::setForceHidden(bool forceHidden) |
214 | { |
215 | if (forceHidden != m_forceHidden) { |
216 | @@ -33,3 +39,11 @@ |
217 | Q_EMIT forceHiddenChanged(forceHidden); |
218 | } |
219 | } |
220 | + |
221 | +void BottomBarVisibilityCommunicatorShell::setPosition(double position) |
222 | +{ |
223 | + if (position != m_position) { |
224 | + m_position = position; |
225 | + Q_EMIT positionChanged(position); |
226 | + } |
227 | +} |
228 | |
229 | === modified file 'plugins/Unity/bottombarvisibilitycommunicatorshell.h' |
230 | --- plugins/Unity/bottombarvisibilitycommunicatorshell.h 2013-06-05 22:03:08 +0000 |
231 | +++ plugins/Unity/bottombarvisibilitycommunicatorshell.h 2013-10-02 09:27:24 +0000 |
232 | @@ -30,6 +30,7 @@ |
233 | { |
234 | Q_OBJECT |
235 | Q_PROPERTY(bool forceHidden READ forceHidden WRITE setForceHidden NOTIFY forceHiddenChanged) |
236 | + Q_PROPERTY(double position READ position WRITE setPosition NOTIFY positionChanged) |
237 | |
238 | Q_CLASSINFO("D-Bus Interface", "com.canonical.Shell.BottomBarVisibilityCommunicator") |
239 | public: |
240 | @@ -41,13 +42,18 @@ |
241 | bool forceHidden() const; |
242 | void setForceHidden(bool forceHidden); |
243 | |
244 | + double position() const; |
245 | + void setPosition(double position); |
246 | + |
247 | Q_SIGNALS: |
248 | void forceHiddenChanged(bool forceHidden); |
249 | + void positionChanged(double position); |
250 | |
251 | private: |
252 | BottomBarVisibilityCommunicatorShell(); |
253 | |
254 | bool m_forceHidden; |
255 | + double m_position; |
256 | }; |
257 | |
258 | #endif |
259 | |
260 | === modified file 'tests/autopilot/unity8/shell/__init__.py' |
261 | --- tests/autopilot/unity8/shell/__init__.py 2013-09-13 18:09:42 +0000 |
262 | +++ tests/autopilot/unity8/shell/__init__.py 2013-10-02 09:27:24 +0000 |
263 | @@ -19,6 +19,7 @@ |
264 | |
265 | """unity shell autopilot tests and emulators - sub level package.""" |
266 | |
267 | +from time import sleep |
268 | from functools import wraps |
269 | import logging |
270 | |
271 | @@ -46,3 +47,16 @@ |
272 | tests_self._qml_mock_enabled = False |
273 | return fn(*args, **kwargs) |
274 | return wrapper |
275 | + |
276 | +class DragMixin(object): |
277 | + def _drag(self, x1, y1, x2, y2): |
278 | + cur_x = x1 |
279 | + cur_y = y1 |
280 | + dx = 1.0 * (x2 - x1) / 100 |
281 | + dy = 1.0 * (y2 - y1) / 100 |
282 | + for i in range(0, 100): |
283 | + self.touch._finger_move(int(cur_x), int(cur_y)) |
284 | + sleep(0.002) |
285 | + cur_x += dx |
286 | + cur_y += dy |
287 | + self.touch._finger_move(int(x2), int(y2)) |
288 | |
289 | === modified file 'tests/autopilot/unity8/shell/emulators/dash.py' |
290 | --- tests/autopilot/unity8/shell/emulators/dash.py 2013-08-11 22:16:33 +0000 |
291 | +++ tests/autopilot/unity8/shell/emulators/dash.py 2013-10-02 09:27:24 +0000 |
292 | @@ -18,17 +18,22 @@ |
293 | # |
294 | |
295 | from unity8.shell.emulators import UnityEmulatorBase |
296 | - |
297 | +from time import sleep |
298 | |
299 | class Dash(UnityEmulatorBase): |
300 | |
301 | """An emulator that understands the Dash.""" |
302 | |
303 | def get_home_applications_grid(self): |
304 | - return self.get_scope('home').select_single( |
305 | - "GenericFilterGrid", |
306 | - objectName="applications.scope" |
307 | - ) |
308 | + for i in range(1,10): |
309 | + get_grid = self.get_scope('home').select_single( |
310 | + "GenericFilterGrid", |
311 | + objectName="applications.scope" |
312 | + ) |
313 | + if get_grid != None: |
314 | + break |
315 | + sleep(1) |
316 | + return get_grid |
317 | |
318 | def get_application_icon(self, text): |
319 | """Returns a 'Tile' icon that has the text 'text' from the application |
320 | @@ -40,7 +45,11 @@ |
321 | |
322 | """ |
323 | app_grid = self.get_home_applications_grid() |
324 | - resp_grid = app_grid.select_single('ResponsiveGridView') |
325 | + for i in range(1,10): |
326 | + resp_grid = app_grid.select_single('ResponsiveGridView') |
327 | + if resp_grid != None: |
328 | + break |
329 | + sleep(1) |
330 | return resp_grid.select_single('Tile', text=text) |
331 | |
332 | def get_scope(self, scope_name='home'): |
333 | |
334 | === modified file 'tests/autopilot/unity8/shell/emulators/hud.py' |
335 | --- tests/autopilot/unity8/shell/emulators/hud.py 2013-08-01 16:50:45 +0000 |
336 | +++ tests/autopilot/unity8/shell/emulators/hud.py 2013-10-02 09:27:24 +0000 |
337 | @@ -21,36 +21,35 @@ |
338 | |
339 | from unity8 import get_grid_size |
340 | from unity8.shell.emulators import UnityEmulatorBase |
341 | +from unity8.shell import DragMixin |
342 | from autopilot.input import Touch |
343 | |
344 | - |
345 | SwipeCoords = namedtuple('SwipeCoords', 'start_x end_x start_y end_y') |
346 | |
347 | - |
348 | -class Hud(UnityEmulatorBase): |
349 | +class Hud(UnityEmulatorBase, DragMixin): |
350 | |
351 | """An emulator that understands the Hud.""" |
352 | |
353 | def show(self): |
354 | """Swipes open the Hud.""" |
355 | - touch = Touch.create() |
356 | + self.touch = Touch.create() |
357 | |
358 | window = self.get_root_instance().select_single('QQuickView') |
359 | hud_show_button = window.select_single("HudButton") |
360 | |
361 | swipe_coords = self.get_button_swipe_coords(window, hud_show_button) |
362 | |
363 | - touch.press(swipe_coords.start_x, swipe_coords.start_y) |
364 | - touch._finger_move(swipe_coords.end_x, swipe_coords.end_y) |
365 | + self.touch.press(swipe_coords.start_x, swipe_coords.start_y) |
366 | + self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y) |
367 | try: |
368 | hud_show_button.opacity.wait_for(1.0) |
369 | - touch.release() |
370 | + self.touch.release() |
371 | self.shown.wait_for(True) |
372 | except AssertionError: |
373 | raise |
374 | finally: |
375 | - if touch._touch_finger is not None: |
376 | - touch.release() |
377 | + if self.touch._touch_finger is not None: |
378 | + self.touch.release() |
379 | |
380 | def dismiss(self): |
381 | """Closes the open Hud.""" |
382 | |
383 | === modified file 'tests/autopilot/unity8/shell/emulators/main_window.py' |
384 | --- tests/autopilot/unity8/shell/emulators/main_window.py 2013-07-30 13:16:50 +0000 |
385 | +++ tests/autopilot/unity8/shell/emulators/main_window.py 2013-10-02 09:27:24 +0000 |
386 | @@ -58,6 +58,9 @@ |
387 | def get_hud_show_button(self): |
388 | return self.app.select_single("HudButton") |
389 | |
390 | + def get_hud_edge_drag_area(self): |
391 | + return self.app.select_single(objectName="hudDragArea") |
392 | + |
393 | def get_dash(self): |
394 | return self.app.select_single(Dash) |
395 | |
396 | |
397 | === modified file 'tests/autopilot/unity8/shell/tests/test_hud.py' |
398 | --- tests/autopilot/unity8/shell/tests/test_hud.py 2013-09-05 16:31:52 +0000 |
399 | +++ tests/autopilot/unity8/shell/tests/test_hud.py 2013-10-02 09:27:24 +0000 |
400 | @@ -19,29 +19,30 @@ |
401 | |
402 | from __future__ import absolute_import |
403 | |
404 | -from unity8.shell import with_lightdm_mock |
405 | +from unity8.shell import with_lightdm_mock, DragMixin |
406 | from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios |
407 | |
408 | from testtools.matchers import Equals |
409 | from autopilot.matchers import Eventually |
410 | |
411 | - |
412 | -class TestHud(UnityTestCase): |
413 | +class TestHud(UnityTestCase, DragMixin): |
414 | |
415 | """Tests the Shell HUD.""" |
416 | |
417 | scenarios = _get_device_emulation_scenarios() |
418 | |
419 | def test_show_hud_button_appears(self): |
420 | - """Swiping up while an app is active must show the 'show hud' button. |
421 | + """Swiping up while an app is active must show the 'show hud' button, following some behaviours. |
422 | The button must disappear not opening the HUD when releasing the |
423 | - mouse again somewhere on the screen except on the button itself. |
424 | + mouse again somewhere on the screen except on the button itself following a timeout. |
425 | + The button must disappear when touching somewhere on the screen except the button itself. |
426 | |
427 | """ |
428 | self.launch_unity() |
429 | self.main_window.get_greeter().swipe() |
430 | window = self.main_window.get_qml_view() |
431 | hud_show_button = self.main_window.get_hud_show_button() |
432 | + edge_drag_area = self.main_window.get_hud_edge_drag_area() |
433 | hud = self.main_window.get_hud() |
434 | |
435 | self._launch_test_app_from_app_screen() |
436 | @@ -50,16 +51,33 @@ |
437 | window, |
438 | hud_show_button |
439 | ) |
440 | + initialBottomMargin = int(hud_show_button.bottomMargin) |
441 | + |
442 | self.touch.press(swipe_coords.start_x, swipe_coords.start_y) |
443 | self.addCleanup(self._maybe_release_finger) |
444 | - self.touch._finger_move(swipe_coords.end_x, swipe_coords.end_y + hud_show_button.height); |
445 | + self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5) |
446 | + self.assertThat(hud_show_button.opacity, Eventually(Equals(0.5))) |
447 | + self.assertThat(hud_show_button.bottomMargin, Eventually(Equals(initialBottomMargin))) |
448 | + self._drag(swipe_coords.start_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5, swipe_coords.end_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - int(edge_drag_area.commitDistance) - 5) |
449 | self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) |
450 | + self.assertThat(hud_show_button.bottomMargin, Eventually(Equals(0.0))) |
451 | self.touch.release(); |
452 | - self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0))) |
453 | - self.assertThat(hud.shown, Equals(False)) |
454 | + self.assertThat(hud.shown, Equals(False)) |
455 | + self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0))) |
456 | + |
457 | + self.touch.press(swipe_coords.start_x, swipe_coords.start_y) |
458 | + self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y - int(hud_show_button.height)) |
459 | + self.assertThat(hud.shown, Equals(False)) |
460 | + self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) |
461 | + self.touch.release() |
462 | + self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) |
463 | + self.touch.tap(swipe_coords.end_x, swipe_coords.end_y - int(hud_show_button.height)) |
464 | + self.assertThat(hud.shown, Equals(False)) |
465 | + self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0))) |
466 | |
467 | def test_show_hud_appears(self): |
468 | """Releasing the touch on the 'show hud' button must display the hud. |
469 | + Test that the hud button stays on screen and tapping it opens the hud. |
470 | |
471 | """ |
472 | self.launch_unity() |
473 | @@ -74,14 +92,28 @@ |
474 | window, |
475 | hud_show_button |
476 | ) |
477 | + |
478 | self.touch.press(swipe_coords.start_x, swipe_coords.start_y) |
479 | self.addCleanup(self._maybe_release_finger) |
480 | - self.touch._finger_move(swipe_coords.end_x, swipe_coords.end_y) |
481 | + self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y) |
482 | + self.assertThat(hud.shown, Eventually(Equals(False))) |
483 | + self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) |
484 | + self.touch.release() |
485 | + self.assertThat(hud.shown, Eventually(Equals(True))) |
486 | + self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0))) |
487 | + x, y = hud.get_close_button_coords() |
488 | + self.touch.tap(x, y) |
489 | + self.assertThat(hud.shown, Eventually(Equals(False))) |
490 | |
491 | - self.assertThat(hud.shown, Eventually(Equals(False))) |
492 | + self.touch.press(swipe_coords.start_x, swipe_coords.start_y) |
493 | + self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y - int(hud_show_button.height)) |
494 | + self.assertThat(hud.shown, Equals(False)) |
495 | self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) |
496 | self.touch.release() |
497 | + self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) |
498 | + self.touch.tap(swipe_coords.end_x, swipe_coords.end_y) |
499 | self.assertThat(hud.shown, Eventually(Equals(True))) |
500 | + self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0))) |
501 | |
502 | def test_hide_hud_click(self): |
503 | """Tapping the close button of the Hud must dismiss it.""" |
504 | @@ -90,6 +122,7 @@ |
505 | hud = self.main_window.get_hud() |
506 | |
507 | self._launch_test_app_from_app_screen() |
508 | + |
509 | hud.show() |
510 | |
511 | x, y = hud.get_close_button_coords() |
512 | @@ -103,10 +136,11 @@ |
513 | """ |
514 | self.launch_unity() |
515 | self.main_window.get_greeter().swipe() |
516 | + window = self.main_window.get_qml_view() |
517 | hud = self.main_window.get_hud() |
518 | - window = self.main_window.get_qml_view() |
519 | |
520 | self._launch_test_app_from_app_screen() |
521 | + |
522 | hud.show() |
523 | |
524 | start_x, start_y = hud.get_close_button_coords() |
FAILED: Continuous integration, rev:323 jenkins. qa.ubuntu. com/job/ unity8- ci/1112/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- saucy/3978/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- touch/1582/ console jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- saucy/1858/ console jenkins. qa.ubuntu. com/job/ unity8- saucy-amd64- ci/135/ console jenkins. qa.ubuntu. com/job/ unity8- saucy-armhf- ci/1112/ console jenkins. qa.ubuntu. com/job/ unity8- saucy-i386- ci/1111/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-i386/ 4063/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 1584/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ unity8- ci/1112/ rebuild
http://