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 | 34 | 34 | ||
6 | 35 | state: "hidden" | 35 | state: "hidden" |
7 | 36 | 36 | ||
8 | 37 | function hide() { | ||
9 | 38 | dismissTimer.stop() | ||
10 | 39 | bottombar.state = "hidden" | ||
11 | 40 | } | ||
12 | 41 | |||
13 | 42 | onApplicationIsOnForegroundChanged: { | ||
14 | 43 | if (!applicationIsOnForeground) { | ||
15 | 44 | hide() | ||
16 | 45 | } | ||
17 | 46 | } | ||
18 | 47 | |||
19 | 37 | onStateChanged: { | 48 | onStateChanged: { |
20 | 38 | if (state == "hidden") { | 49 | if (state == "hidden") { |
21 | 39 | dismissTimer.stop() | 50 | dismissTimer.stop() |
22 | 51 | bottomBarVisibilityCommunicatorShell.forceHidden = false | ||
23 | 40 | } else { | 52 | } else { |
24 | 41 | dismissTimer.restart() | 53 | dismissTimer.restart() |
25 | 42 | } | 54 | } |
26 | 43 | } | 55 | } |
27 | 44 | 56 | ||
28 | 45 | onPreventHidingChanged: { | 57 | onPreventHidingChanged: { |
29 | 58 | if (!preventHiding) { | ||
30 | 59 | if (state == "hint" || state == "reveal") | ||
31 | 60 | hide() | ||
32 | 61 | } | ||
33 | 62 | |||
34 | 46 | if (dismissTimer.running) { | 63 | if (dismissTimer.running) { |
35 | 47 | dismissTimer.restart(); | 64 | dismissTimer.restart(); |
36 | 48 | } | 65 | } |
37 | @@ -50,7 +67,7 @@ | |||
38 | 50 | 67 | ||
39 | 51 | Timer { | 68 | Timer { |
40 | 52 | id: dismissTimer | 69 | id: dismissTimer |
42 | 53 | interval: 5000 | 70 | interval: 1000 |
43 | 54 | onTriggered: { | 71 | onTriggered: { |
44 | 55 | if (!bottombar.preventHiding) { | 72 | if (!bottombar.preventHiding) { |
45 | 56 | bottombar.state = "hidden" | 73 | bottombar.state = "hidden" |
46 | @@ -103,24 +120,29 @@ | |||
47 | 103 | 120 | ||
48 | 104 | EdgeDragArea { | 121 | EdgeDragArea { |
49 | 105 | id: dragArea | 122 | id: dragArea |
50 | 123 | objectName: "hudDragArea" | ||
51 | 106 | width: parent.width | 124 | width: parent.width |
52 | 107 | height: distanceThreshold | 125 | height: distanceThreshold |
53 | 108 | anchors.bottom: parent.bottom | 126 | anchors.bottom: parent.bottom |
54 | 109 | 127 | ||
56 | 110 | distanceThreshold: units.gu(1) | 128 | distanceThreshold: units.gu(8) |
57 | 111 | enabled: !theHud.shown && bottombar.enabled && applicationIsOnForeground | 129 | enabled: !theHud.shown && bottombar.enabled && applicationIsOnForeground |
58 | 112 | direction: Direction.Upwards | 130 | direction: Direction.Upwards |
59 | 131 | maxSilenceTime: 2000 | ||
60 | 113 | 132 | ||
61 | 114 | property int previousStatus: -1 | 133 | property int previousStatus: -1 |
62 | 115 | property real touchStartX: -1 | 134 | property real touchStartX: -1 |
63 | 116 | 135 | ||
64 | 136 | readonly property real distanceFromThreshold: (-distance) - distanceThreshold // distance is negative | ||
65 | 137 | readonly property real revealDistance: units.gu(2) | ||
66 | 138 | readonly property real commitDistance: units.gu(6) | ||
67 | 139 | readonly property real commitProgress: MathLocal.clamp(distanceFromThreshold / commitDistance, 0, 1) | ||
68 | 140 | |||
69 | 117 | onStatusChanged: { | 141 | onStatusChanged: { |
70 | 118 | if (status === DirectionalDragArea.WaitingForTouch) { | 142 | if (status === DirectionalDragArea.WaitingForTouch) { |
71 | 119 | if (previousStatus == DirectionalDragArea.Recognized) { | 143 | if (previousStatus == DirectionalDragArea.Recognized) { |
72 | 120 | if (hudButton.mouseOver) { | 144 | if (hudButton.mouseOver) { |
73 | 121 | hudButton.clicked() | 145 | hudButton.clicked() |
74 | 122 | } else { | ||
75 | 123 | bottombar.state = "hidden" | ||
76 | 124 | } | 146 | } |
77 | 125 | } | 147 | } |
78 | 126 | } else if (status === DirectionalDragArea.Undecided) { | 148 | } else if (status === DirectionalDragArea.Undecided) { |
79 | @@ -128,35 +150,78 @@ | |||
80 | 128 | touchStartX = touchX | 150 | touchStartX = touchX |
81 | 129 | } | 151 | } |
82 | 130 | } else if (status === DirectionalDragArea.Recognized) { | 152 | } else if (status === DirectionalDragArea.Recognized) { |
84 | 131 | bottombar.state = "shown" | 153 | bottombar.state = "hint" |
85 | 132 | } | 154 | } |
86 | 133 | previousStatus = status | 155 | previousStatus = status |
87 | 134 | } | 156 | } |
88 | 157 | |||
89 | 158 | onDistanceChanged: { | ||
90 | 159 | if (status === DirectionalDragArea.Recognized) { | ||
91 | 160 | if (distanceFromThreshold > commitDistance) | ||
92 | 161 | bottombar.state = "shown" | ||
93 | 162 | else if (distanceFromThreshold > revealDistance) | ||
94 | 163 | bottombar.state = "reveal" | ||
95 | 164 | } | ||
96 | 165 | } | ||
97 | 166 | } | ||
98 | 167 | |||
99 | 168 | Item { | ||
100 | 169 | id: dismissArea | ||
101 | 170 | anchors { | ||
102 | 171 | top: parent.top | ||
103 | 172 | left: parent.left | ||
104 | 173 | right: parent.right | ||
105 | 174 | } | ||
106 | 175 | height: parent.height - bottomBarVisibilityCommunicatorShell.position | ||
107 | 176 | |||
108 | 177 | MouseArea { | ||
109 | 178 | anchors.fill: parent | ||
110 | 179 | enabled: bottombar.state == "shown" | ||
111 | 180 | onPressed: { | ||
112 | 181 | bottomBarVisibilityCommunicatorShell.forceHidden = true | ||
113 | 182 | bottombar.state = "hidden" | ||
114 | 183 | } | ||
115 | 184 | } | ||
116 | 185 | |||
117 | 186 | InputFilterArea { | ||
118 | 187 | anchors.fill: parent | ||
119 | 188 | blockInput: (hudButton.opacity == 1) | ||
120 | 189 | } | ||
121 | 135 | } | 190 | } |
122 | 136 | 191 | ||
123 | 137 | MouseArea { | 192 | MouseArea { |
126 | 138 | anchors.fill: parent | 193 | anchors { |
127 | 139 | enabled: bottombar.state == "shown" | 194 | top: dismissArea.bottom |
128 | 195 | left: parent.left | ||
129 | 196 | right: parent.right | ||
130 | 197 | bottom: parent.bottom | ||
131 | 198 | } | ||
132 | 199 | enabled: bottombar.state == "shown" && bottomBarVisibilityCommunicatorShell.position > 0 | ||
133 | 140 | onPressed: { | 200 | onPressed: { |
134 | 141 | bottombar.state = "hidden" | 201 | bottombar.state = "hidden" |
135 | 142 | } | 202 | } |
136 | 143 | } | 203 | } |
137 | 144 | 204 | ||
138 | 145 | InputFilterArea { | ||
139 | 146 | anchors.fill: parent | ||
140 | 147 | blockInput: (hudButton.opacity == 1) | ||
141 | 148 | } | ||
142 | 149 | |||
143 | 150 | states: [ | 205 | states: [ |
144 | 151 | State { | 206 | State { |
145 | 152 | name: "hidden" | 207 | name: "hidden" |
148 | 153 | PropertyChanges { target: hudButton; opacity: 0} | 208 | PropertyChanges { target: hudButton; opacity: 0 } |
149 | 154 | PropertyChanges { target: hudButton; bottomMargin: units.gu(-1)} | 209 | PropertyChanges { target: hudButton; bottomMargin: units.gu(-2) } |
150 | 210 | }, | ||
151 | 211 | State { | ||
152 | 212 | name: "hint" | ||
153 | 213 | extend: "hidden" | ||
154 | 214 | PropertyChanges { target: hudButton; opacity: 0.5 } | ||
155 | 215 | }, | ||
156 | 216 | State { | ||
157 | 217 | name: "reveal" | ||
158 | 218 | extend: "hint" | ||
159 | 219 | PropertyChanges { target: hudButton; bottomMargin: units.gu(-2) + units.gu(2) * dragArea.commitProgress } | ||
160 | 155 | }, | 220 | }, |
161 | 156 | State { | 221 | State { |
162 | 157 | name: "shown" | 222 | name: "shown" |
165 | 158 | PropertyChanges { target: hudButton; opacity: 1} | 223 | PropertyChanges { target: hudButton; opacity: 1 } |
166 | 159 | PropertyChanges { target: hudButton; bottomMargin: units.gu(0)} | 224 | PropertyChanges { target: hudButton; bottomMargin: units.gu(0) } |
167 | 160 | } | 225 | } |
168 | 161 | ] | 226 | ] |
169 | 162 | } | 227 | } |
170 | 163 | 228 | ||
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 | 623 | } | 623 | } |
176 | 624 | 624 | ||
177 | 625 | Bottombar { | 625 | Bottombar { |
178 | 626 | id: bottombar | ||
179 | 626 | theHud: hud | 627 | theHud: hud |
180 | 627 | anchors.fill: parent | 628 | anchors.fill: parent |
181 | 628 | enabled: hud.available | 629 | enabled: hud.available |
182 | @@ -663,6 +664,7 @@ | |||
183 | 663 | if (shown) { | 664 | if (shown) { |
184 | 664 | panel.indicators.hide() | 665 | panel.indicators.hide() |
185 | 665 | hud.hide() | 666 | hud.hide() |
186 | 667 | bottombar.hide() | ||
187 | 666 | } | 668 | } |
188 | 667 | } | 669 | } |
189 | 668 | } | 670 | } |
190 | 669 | 671 | ||
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 | 17 | #include "bottombarvisibilitycommunicatorshell.h" | 17 | #include "bottombarvisibilitycommunicatorshell.h" |
196 | 18 | 18 | ||
197 | 19 | BottomBarVisibilityCommunicatorShell::BottomBarVisibilityCommunicatorShell() | 19 | BottomBarVisibilityCommunicatorShell::BottomBarVisibilityCommunicatorShell() |
199 | 20 | : m_forceHidden(false) | 20 | : m_forceHidden(false), |
200 | 21 | m_position(0) | ||
201 | 21 | { | 22 | { |
202 | 22 | } | 23 | } |
203 | 23 | 24 | ||
204 | @@ -26,6 +27,11 @@ | |||
205 | 26 | return m_forceHidden; | 27 | return m_forceHidden; |
206 | 27 | } | 28 | } |
207 | 28 | 29 | ||
208 | 30 | double BottomBarVisibilityCommunicatorShell::position() const | ||
209 | 31 | { | ||
210 | 32 | return m_position; | ||
211 | 33 | } | ||
212 | 34 | |||
213 | 29 | void BottomBarVisibilityCommunicatorShell::setForceHidden(bool forceHidden) | 35 | void BottomBarVisibilityCommunicatorShell::setForceHidden(bool forceHidden) |
214 | 30 | { | 36 | { |
215 | 31 | if (forceHidden != m_forceHidden) { | 37 | if (forceHidden != m_forceHidden) { |
216 | @@ -33,3 +39,11 @@ | |||
217 | 33 | Q_EMIT forceHiddenChanged(forceHidden); | 39 | Q_EMIT forceHiddenChanged(forceHidden); |
218 | 34 | } | 40 | } |
219 | 35 | } | 41 | } |
220 | 42 | |||
221 | 43 | void BottomBarVisibilityCommunicatorShell::setPosition(double position) | ||
222 | 44 | { | ||
223 | 45 | if (position != m_position) { | ||
224 | 46 | m_position = position; | ||
225 | 47 | Q_EMIT positionChanged(position); | ||
226 | 48 | } | ||
227 | 49 | } | ||
228 | 36 | 50 | ||
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 | 30 | { | 30 | { |
234 | 31 | Q_OBJECT | 31 | Q_OBJECT |
235 | 32 | Q_PROPERTY(bool forceHidden READ forceHidden WRITE setForceHidden NOTIFY forceHiddenChanged) | 32 | Q_PROPERTY(bool forceHidden READ forceHidden WRITE setForceHidden NOTIFY forceHiddenChanged) |
236 | 33 | Q_PROPERTY(double position READ position WRITE setPosition NOTIFY positionChanged) | ||
237 | 33 | 34 | ||
238 | 34 | Q_CLASSINFO("D-Bus Interface", "com.canonical.Shell.BottomBarVisibilityCommunicator") | 35 | Q_CLASSINFO("D-Bus Interface", "com.canonical.Shell.BottomBarVisibilityCommunicator") |
239 | 35 | public: | 36 | public: |
240 | @@ -41,13 +42,18 @@ | |||
241 | 41 | bool forceHidden() const; | 42 | bool forceHidden() const; |
242 | 42 | void setForceHidden(bool forceHidden); | 43 | void setForceHidden(bool forceHidden); |
243 | 43 | 44 | ||
244 | 45 | double position() const; | ||
245 | 46 | void setPosition(double position); | ||
246 | 47 | |||
247 | 44 | Q_SIGNALS: | 48 | Q_SIGNALS: |
248 | 45 | void forceHiddenChanged(bool forceHidden); | 49 | void forceHiddenChanged(bool forceHidden); |
249 | 50 | void positionChanged(double position); | ||
250 | 46 | 51 | ||
251 | 47 | private: | 52 | private: |
252 | 48 | BottomBarVisibilityCommunicatorShell(); | 53 | BottomBarVisibilityCommunicatorShell(); |
253 | 49 | 54 | ||
254 | 50 | bool m_forceHidden; | 55 | bool m_forceHidden; |
255 | 56 | double m_position; | ||
256 | 51 | }; | 57 | }; |
257 | 52 | 58 | ||
258 | 53 | #endif | 59 | #endif |
259 | 54 | 60 | ||
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 | 19 | 19 | ||
265 | 20 | """unity shell autopilot tests and emulators - sub level package.""" | 20 | """unity shell autopilot tests and emulators - sub level package.""" |
266 | 21 | 21 | ||
267 | 22 | from time import sleep | ||
268 | 22 | from functools import wraps | 23 | from functools import wraps |
269 | 23 | import logging | 24 | import logging |
270 | 24 | 25 | ||
271 | @@ -46,3 +47,16 @@ | |||
272 | 46 | tests_self._qml_mock_enabled = False | 47 | tests_self._qml_mock_enabled = False |
273 | 47 | return fn(*args, **kwargs) | 48 | return fn(*args, **kwargs) |
274 | 48 | return wrapper | 49 | return wrapper |
275 | 50 | |||
276 | 51 | class DragMixin(object): | ||
277 | 52 | def _drag(self, x1, y1, x2, y2): | ||
278 | 53 | cur_x = x1 | ||
279 | 54 | cur_y = y1 | ||
280 | 55 | dx = 1.0 * (x2 - x1) / 100 | ||
281 | 56 | dy = 1.0 * (y2 - y1) / 100 | ||
282 | 57 | for i in range(0, 100): | ||
283 | 58 | self.touch._finger_move(int(cur_x), int(cur_y)) | ||
284 | 59 | sleep(0.002) | ||
285 | 60 | cur_x += dx | ||
286 | 61 | cur_y += dy | ||
287 | 62 | self.touch._finger_move(int(x2), int(y2)) | ||
288 | 49 | 63 | ||
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 | 18 | # | 18 | # |
294 | 19 | 19 | ||
295 | 20 | from unity8.shell.emulators import UnityEmulatorBase | 20 | from unity8.shell.emulators import UnityEmulatorBase |
297 | 21 | 21 | from time import sleep | |
298 | 22 | 22 | ||
299 | 23 | class Dash(UnityEmulatorBase): | 23 | class Dash(UnityEmulatorBase): |
300 | 24 | 24 | ||
301 | 25 | """An emulator that understands the Dash.""" | 25 | """An emulator that understands the Dash.""" |
302 | 26 | 26 | ||
303 | 27 | def get_home_applications_grid(self): | 27 | def get_home_applications_grid(self): |
308 | 28 | return self.get_scope('home').select_single( | 28 | for i in range(1,10): |
309 | 29 | "GenericFilterGrid", | 29 | get_grid = self.get_scope('home').select_single( |
310 | 30 | objectName="applications.scope" | 30 | "GenericFilterGrid", |
311 | 31 | ) | 31 | objectName="applications.scope" |
312 | 32 | ) | ||
313 | 33 | if get_grid != None: | ||
314 | 34 | break | ||
315 | 35 | sleep(1) | ||
316 | 36 | return get_grid | ||
317 | 32 | 37 | ||
318 | 33 | def get_application_icon(self, text): | 38 | def get_application_icon(self, text): |
319 | 34 | """Returns a 'Tile' icon that has the text 'text' from the application | 39 | """Returns a 'Tile' icon that has the text 'text' from the application |
320 | @@ -40,7 +45,11 @@ | |||
321 | 40 | 45 | ||
322 | 41 | """ | 46 | """ |
323 | 42 | app_grid = self.get_home_applications_grid() | 47 | app_grid = self.get_home_applications_grid() |
325 | 43 | resp_grid = app_grid.select_single('ResponsiveGridView') | 48 | for i in range(1,10): |
326 | 49 | resp_grid = app_grid.select_single('ResponsiveGridView') | ||
327 | 50 | if resp_grid != None: | ||
328 | 51 | break | ||
329 | 52 | sleep(1) | ||
330 | 44 | return resp_grid.select_single('Tile', text=text) | 53 | return resp_grid.select_single('Tile', text=text) |
331 | 45 | 54 | ||
332 | 46 | def get_scope(self, scope_name='home'): | 55 | def get_scope(self, scope_name='home'): |
333 | 47 | 56 | ||
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 | 21 | 21 | ||
339 | 22 | from unity8 import get_grid_size | 22 | from unity8 import get_grid_size |
340 | 23 | from unity8.shell.emulators import UnityEmulatorBase | 23 | from unity8.shell.emulators import UnityEmulatorBase |
341 | 24 | from unity8.shell import DragMixin | ||
342 | 24 | from autopilot.input import Touch | 25 | from autopilot.input import Touch |
343 | 25 | 26 | ||
344 | 26 | |||
345 | 27 | SwipeCoords = namedtuple('SwipeCoords', 'start_x end_x start_y end_y') | 27 | SwipeCoords = namedtuple('SwipeCoords', 'start_x end_x start_y end_y') |
346 | 28 | 28 | ||
349 | 29 | 29 | class Hud(UnityEmulatorBase, DragMixin): | |
348 | 30 | class Hud(UnityEmulatorBase): | ||
350 | 31 | 30 | ||
351 | 32 | """An emulator that understands the Hud.""" | 31 | """An emulator that understands the Hud.""" |
352 | 33 | 32 | ||
353 | 34 | def show(self): | 33 | def show(self): |
354 | 35 | """Swipes open the Hud.""" | 34 | """Swipes open the Hud.""" |
356 | 36 | touch = Touch.create() | 35 | self.touch = Touch.create() |
357 | 37 | 36 | ||
358 | 38 | window = self.get_root_instance().select_single('QQuickView') | 37 | window = self.get_root_instance().select_single('QQuickView') |
359 | 39 | hud_show_button = window.select_single("HudButton") | 38 | hud_show_button = window.select_single("HudButton") |
360 | 40 | 39 | ||
361 | 41 | swipe_coords = self.get_button_swipe_coords(window, hud_show_button) | 40 | swipe_coords = self.get_button_swipe_coords(window, hud_show_button) |
362 | 42 | 41 | ||
365 | 43 | touch.press(swipe_coords.start_x, swipe_coords.start_y) | 42 | self.touch.press(swipe_coords.start_x, swipe_coords.start_y) |
366 | 44 | touch._finger_move(swipe_coords.end_x, swipe_coords.end_y) | 43 | self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y) |
367 | 45 | try: | 44 | try: |
368 | 46 | hud_show_button.opacity.wait_for(1.0) | 45 | hud_show_button.opacity.wait_for(1.0) |
370 | 47 | touch.release() | 46 | self.touch.release() |
371 | 48 | self.shown.wait_for(True) | 47 | self.shown.wait_for(True) |
372 | 49 | except AssertionError: | 48 | except AssertionError: |
373 | 50 | raise | 49 | raise |
374 | 51 | finally: | 50 | finally: |
377 | 52 | if touch._touch_finger is not None: | 51 | if self.touch._touch_finger is not None: |
378 | 53 | touch.release() | 52 | self.touch.release() |
379 | 54 | 53 | ||
380 | 55 | def dismiss(self): | 54 | def dismiss(self): |
381 | 56 | """Closes the open Hud.""" | 55 | """Closes the open Hud.""" |
382 | 57 | 56 | ||
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 | 58 | def get_hud_show_button(self): | 58 | def get_hud_show_button(self): |
388 | 59 | return self.app.select_single("HudButton") | 59 | return self.app.select_single("HudButton") |
389 | 60 | 60 | ||
390 | 61 | def get_hud_edge_drag_area(self): | ||
391 | 62 | return self.app.select_single(objectName="hudDragArea") | ||
392 | 63 | |||
393 | 61 | def get_dash(self): | 64 | def get_dash(self): |
394 | 62 | return self.app.select_single(Dash) | 65 | return self.app.select_single(Dash) |
395 | 63 | 66 | ||
396 | 64 | 67 | ||
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 | 19 | 19 | ||
402 | 20 | from __future__ import absolute_import | 20 | from __future__ import absolute_import |
403 | 21 | 21 | ||
405 | 22 | from unity8.shell import with_lightdm_mock | 22 | from unity8.shell import with_lightdm_mock, DragMixin |
406 | 23 | from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios | 23 | from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios |
407 | 24 | 24 | ||
408 | 25 | from testtools.matchers import Equals | 25 | from testtools.matchers import Equals |
409 | 26 | from autopilot.matchers import Eventually | 26 | from autopilot.matchers import Eventually |
410 | 27 | 27 | ||
413 | 28 | 28 | class TestHud(UnityTestCase, DragMixin): | |
412 | 29 | class TestHud(UnityTestCase): | ||
414 | 30 | 29 | ||
415 | 31 | """Tests the Shell HUD.""" | 30 | """Tests the Shell HUD.""" |
416 | 32 | 31 | ||
417 | 33 | scenarios = _get_device_emulation_scenarios() | 32 | scenarios = _get_device_emulation_scenarios() |
418 | 34 | 33 | ||
419 | 35 | def test_show_hud_button_appears(self): | 34 | def test_show_hud_button_appears(self): |
421 | 36 | """Swiping up while an app is active must show the 'show hud' button. | 35 | """Swiping up while an app is active must show the 'show hud' button, following some behaviours. |
422 | 37 | The button must disappear not opening the HUD when releasing the | 36 | The button must disappear not opening the HUD when releasing the |
424 | 38 | mouse again somewhere on the screen except on the button itself. | 37 | mouse again somewhere on the screen except on the button itself following a timeout. |
425 | 38 | The button must disappear when touching somewhere on the screen except the button itself. | ||
426 | 39 | 39 | ||
427 | 40 | """ | 40 | """ |
428 | 41 | self.launch_unity() | 41 | self.launch_unity() |
429 | 42 | self.main_window.get_greeter().swipe() | 42 | self.main_window.get_greeter().swipe() |
430 | 43 | window = self.main_window.get_qml_view() | 43 | window = self.main_window.get_qml_view() |
431 | 44 | hud_show_button = self.main_window.get_hud_show_button() | 44 | hud_show_button = self.main_window.get_hud_show_button() |
432 | 45 | edge_drag_area = self.main_window.get_hud_edge_drag_area() | ||
433 | 45 | hud = self.main_window.get_hud() | 46 | hud = self.main_window.get_hud() |
434 | 46 | 47 | ||
435 | 47 | self._launch_test_app_from_app_screen() | 48 | self._launch_test_app_from_app_screen() |
436 | @@ -50,16 +51,33 @@ | |||
437 | 50 | window, | 51 | window, |
438 | 51 | hud_show_button | 52 | hud_show_button |
439 | 52 | ) | 53 | ) |
440 | 54 | initialBottomMargin = int(hud_show_button.bottomMargin) | ||
441 | 55 | |||
442 | 53 | self.touch.press(swipe_coords.start_x, swipe_coords.start_y) | 56 | self.touch.press(swipe_coords.start_x, swipe_coords.start_y) |
443 | 54 | self.addCleanup(self._maybe_release_finger) | 57 | self.addCleanup(self._maybe_release_finger) |
445 | 55 | self.touch._finger_move(swipe_coords.end_x, swipe_coords.end_y + hud_show_button.height); | 58 | 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 | 59 | self.assertThat(hud_show_button.opacity, Eventually(Equals(0.5))) | ||
447 | 60 | self.assertThat(hud_show_button.bottomMargin, Eventually(Equals(initialBottomMargin))) | ||
448 | 61 | 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 | 56 | self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) | 62 | self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) |
450 | 63 | self.assertThat(hud_show_button.bottomMargin, Eventually(Equals(0.0))) | ||
451 | 57 | self.touch.release(); | 64 | self.touch.release(); |
454 | 58 | self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0))) | 65 | self.assertThat(hud.shown, Equals(False)) |
455 | 59 | self.assertThat(hud.shown, Equals(False)) | 66 | self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0))) |
456 | 67 | |||
457 | 68 | self.touch.press(swipe_coords.start_x, swipe_coords.start_y) | ||
458 | 69 | self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y - int(hud_show_button.height)) | ||
459 | 70 | self.assertThat(hud.shown, Equals(False)) | ||
460 | 71 | self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) | ||
461 | 72 | self.touch.release() | ||
462 | 73 | self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) | ||
463 | 74 | self.touch.tap(swipe_coords.end_x, swipe_coords.end_y - int(hud_show_button.height)) | ||
464 | 75 | self.assertThat(hud.shown, Equals(False)) | ||
465 | 76 | self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0))) | ||
466 | 60 | 77 | ||
467 | 61 | def test_show_hud_appears(self): | 78 | def test_show_hud_appears(self): |
468 | 62 | """Releasing the touch on the 'show hud' button must display the hud. | 79 | """Releasing the touch on the 'show hud' button must display the hud. |
469 | 80 | Test that the hud button stays on screen and tapping it opens the hud. | ||
470 | 63 | 81 | ||
471 | 64 | """ | 82 | """ |
472 | 65 | self.launch_unity() | 83 | self.launch_unity() |
473 | @@ -74,14 +92,28 @@ | |||
474 | 74 | window, | 92 | window, |
475 | 75 | hud_show_button | 93 | hud_show_button |
476 | 76 | ) | 94 | ) |
477 | 95 | |||
478 | 77 | self.touch.press(swipe_coords.start_x, swipe_coords.start_y) | 96 | self.touch.press(swipe_coords.start_x, swipe_coords.start_y) |
479 | 78 | self.addCleanup(self._maybe_release_finger) | 97 | self.addCleanup(self._maybe_release_finger) |
481 | 79 | self.touch._finger_move(swipe_coords.end_x, swipe_coords.end_y) | 98 | self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y) |
482 | 99 | self.assertThat(hud.shown, Eventually(Equals(False))) | ||
483 | 100 | self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) | ||
484 | 101 | self.touch.release() | ||
485 | 102 | self.assertThat(hud.shown, Eventually(Equals(True))) | ||
486 | 103 | self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0))) | ||
487 | 104 | x, y = hud.get_close_button_coords() | ||
488 | 105 | self.touch.tap(x, y) | ||
489 | 106 | self.assertThat(hud.shown, Eventually(Equals(False))) | ||
490 | 80 | 107 | ||
492 | 81 | self.assertThat(hud.shown, Eventually(Equals(False))) | 108 | self.touch.press(swipe_coords.start_x, swipe_coords.start_y) |
493 | 109 | self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y - int(hud_show_button.height)) | ||
494 | 110 | self.assertThat(hud.shown, Equals(False)) | ||
495 | 82 | self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) | 111 | self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) |
496 | 83 | self.touch.release() | 112 | self.touch.release() |
497 | 113 | self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0))) | ||
498 | 114 | self.touch.tap(swipe_coords.end_x, swipe_coords.end_y) | ||
499 | 84 | self.assertThat(hud.shown, Eventually(Equals(True))) | 115 | self.assertThat(hud.shown, Eventually(Equals(True))) |
500 | 116 | self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0))) | ||
501 | 85 | 117 | ||
502 | 86 | def test_hide_hud_click(self): | 118 | def test_hide_hud_click(self): |
503 | 87 | """Tapping the close button of the Hud must dismiss it.""" | 119 | """Tapping the close button of the Hud must dismiss it.""" |
504 | @@ -90,6 +122,7 @@ | |||
505 | 90 | hud = self.main_window.get_hud() | 122 | hud = self.main_window.get_hud() |
506 | 91 | 123 | ||
507 | 92 | self._launch_test_app_from_app_screen() | 124 | self._launch_test_app_from_app_screen() |
508 | 125 | |||
509 | 93 | hud.show() | 126 | hud.show() |
510 | 94 | 127 | ||
511 | 95 | x, y = hud.get_close_button_coords() | 128 | x, y = hud.get_close_button_coords() |
512 | @@ -103,10 +136,11 @@ | |||
513 | 103 | """ | 136 | """ |
514 | 104 | self.launch_unity() | 137 | self.launch_unity() |
515 | 105 | self.main_window.get_greeter().swipe() | 138 | self.main_window.get_greeter().swipe() |
516 | 139 | window = self.main_window.get_qml_view() | ||
517 | 106 | hud = self.main_window.get_hud() | 140 | hud = self.main_window.get_hud() |
518 | 107 | window = self.main_window.get_qml_view() | ||
519 | 108 | 141 | ||
520 | 109 | self._launch_test_app_from_app_screen() | 142 | self._launch_test_app_from_app_screen() |
521 | 143 | |||
522 | 110 | hud.show() | 144 | hud.show() |
523 | 111 | 145 | ||
524 | 112 | start_x, start_y = hud.get_close_button_coords() | 146 | 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://