Merge lp:~nick-dedekind/unity/phablet-test-panel into lp:unity/phablet
- phablet-test-panel
- Merge into phablet
Status: | Merged |
---|---|
Approved by: | Albert Astals Cid |
Approved revision: | no longer in the source branch. |
Merged at revision: | 587 |
Proposed branch: | lp:~nick-dedekind/unity/phablet-test-panel |
Merge into: | lp:unity/phablet |
Diff against target: |
346 lines (+273/-7) 5 files modified
Panel/Indicators.qml (+1/-0) Panel/Panel.qml (+6/-6) tests/qmluitests/Panel/CMakeLists.txt (+1/-0) tests/qmluitests/Panel/qml/CMakeLists.txt (+0/-1) tests/qmluitests/Panel/tst_Panel.qml (+265/-0) |
To merge this branch: | bzr merge lp:~nick-dedekind/unity/phablet-test-panel |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Albert Astals Cid (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+157927@code.launchpad.net |
Commit message
Added panel tests.
Description of the change
Added panel tests.
Nick Dedekind (nick-dedekind) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:560
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: 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:560
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:561
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:561
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
MichaĆ Sawicz (saviq) wrote : | # |
Please merge trunk.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:562
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
Looks good :-)
Preview Diff
1 | === modified file 'Panel/Indicators.qml' |
2 | --- Panel/Indicators.qml 2013-04-10 23:56:47 +0000 |
3 | +++ Panel/Indicators.qml 2013-04-12 08:44:26 +0000 |
4 | @@ -143,6 +143,7 @@ |
5 | |
6 | MenuContent { |
7 | id: menuContent |
8 | + objectName: "menuContent" |
9 | |
10 | anchors { |
11 | left: parent.left |
12 | |
13 | === modified file 'Panel/Panel.qml' |
14 | --- Panel/Panel.qml 2013-04-08 15:39:57 +0000 |
15 | +++ Panel/Panel.qml 2013-04-12 08:44:26 +0000 |
16 | @@ -41,6 +41,10 @@ |
17 | height: __panelMinusSeparatorLineHeight |
18 | y: 0 |
19 | onYChanged: indicatorsMenu.y = y; |
20 | + |
21 | + Behavior on y { |
22 | + NumberAnimation { duration: 200 } |
23 | + } |
24 | } |
25 | |
26 | PanelSeparatorLine { |
27 | @@ -134,6 +138,7 @@ |
28 | |
29 | Revealer { |
30 | id: indicatorRevealer |
31 | + objectName: "indicatorRevealer" |
32 | |
33 | width: root.indicatorsMenuWidth |
34 | anchors { |
35 | @@ -166,6 +171,7 @@ |
36 | |
37 | SearchIndicator { |
38 | id: search |
39 | + objectName: "search" |
40 | |
41 | width: units.gu(13) |
42 | height: __panelMinusSeparatorLineHeight |
43 | @@ -191,10 +197,4 @@ |
44 | PropertyChanges { target: indicatorRevealer; openedValue: indicatorsMenu.openedHeight } |
45 | } |
46 | ] |
47 | - |
48 | - transitions: [ |
49 | - Transition { |
50 | - NumberAnimation { target: panelBackground; property: "y"; duration: 200 } |
51 | - } |
52 | - ] |
53 | } |
54 | |
55 | === modified file 'tests/qmluitests/Panel/CMakeLists.txt' |
56 | --- tests/qmluitests/Panel/CMakeLists.txt 2013-04-09 13:58:53 +0000 |
57 | +++ tests/qmluitests/Panel/CMakeLists.txt 2013-04-12 08:44:26 +0000 |
58 | @@ -2,4 +2,5 @@ |
59 | |
60 | add_qml_test(IndicatorRow IMPORT_PATH ${CMAKE_CURRENT_BINARY_DIR}/qml) |
61 | add_qml_test(Indicators IMPORT_PATH ${CMAKE_CURRENT_BINARY_DIR}/qml) |
62 | +add_qml_test(Panel IMPORT_PATH ${CMAKE_CURRENT_BINARY_DIR}/qml) |
63 | add_qml_test(SearchIndicator) |
64 | |
65 | === added file 'tests/qmluitests/Panel/qml/CMakeLists.txt' |
66 | --- tests/qmluitests/Panel/qml/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
67 | +++ tests/qmluitests/Panel/qml/CMakeLists.txt 2013-04-12 08:44:26 +0000 |
68 | @@ -0,0 +1,2 @@ |
69 | +add_subdirectory(Ubuntu) |
70 | + |
71 | |
72 | === removed file 'tests/qmluitests/Panel/qml/CMakeLists.txt' |
73 | --- tests/qmluitests/Panel/qml/CMakeLists.txt 2013-04-09 13:58:53 +0000 |
74 | +++ tests/qmluitests/Panel/qml/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
75 | @@ -1,1 +0,0 @@ |
76 | -add_subdirectory(Ubuntu) |
77 | |
78 | === added file 'tests/qmluitests/Panel/tst_Panel.qml' |
79 | --- tests/qmluitests/Panel/tst_Panel.qml 1970-01-01 00:00:00 +0000 |
80 | +++ tests/qmluitests/Panel/tst_Panel.qml 2013-04-12 08:44:26 +0000 |
81 | @@ -0,0 +1,265 @@ |
82 | +/* |
83 | + * Copyright 2013 Canonical Ltd. |
84 | + * |
85 | + * This program is free software; you can redistribute it and/or modify |
86 | + * it under the terms of the GNU General Public License as published by |
87 | + * the Free Software Foundation; version 3. |
88 | + * |
89 | + * This program is distributed in the hope that it will be useful, |
90 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
91 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
92 | + * GNU General Public License for more details. |
93 | + * |
94 | + * You should have received a copy of the GNU General Public License |
95 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
96 | + */ |
97 | + |
98 | +import QtQuick 2.0 |
99 | +import QtTest 1.0 |
100 | +import ".." |
101 | +import "../../../Panel" |
102 | +import Ubuntu.ChewieUI 0.1 as ChewieUI |
103 | + |
104 | +/* |
105 | + This tests the Panel component using a fake model to stage data in the indicators |
106 | + A view will show with indicators at the top, as does in the shell. This can be controlled |
107 | + as in the shell. |
108 | +*/ |
109 | +Item { |
110 | + id: shell |
111 | + width: units.gu(40) |
112 | + height: units.gu(80) |
113 | + |
114 | + property bool search_clicked: false |
115 | + |
116 | + Connections { |
117 | + target: panel |
118 | + onSearchClicked: search_clicked = true |
119 | + } |
120 | + |
121 | + Panel { |
122 | + id: panel |
123 | + anchors.fill: parent |
124 | + } |
125 | + |
126 | + UnityTestCase { |
127 | + name: "Panel" |
128 | + when: windowShown |
129 | + |
130 | + function get_window_data() { |
131 | + return [ |
132 | + {tag: "pinned", fullscreenFlag: false }, |
133 | + {tag: "fullscreen", fullscreenFlag: true } |
134 | + ]} |
135 | + |
136 | + |
137 | + function init() { |
138 | + search_clicked = false; |
139 | + panel.indicators.hide(); |
140 | + tryCompare(panel.indicators.hideAnimation, "running", false); |
141 | + tryCompare(panel.indicators, "state", "initial"); |
142 | + } |
143 | + |
144 | + function get_indicator_item(index) { |
145 | + var row_repeater = findChild(panel.indicators, "rowRepeater"); |
146 | + verify(row_repeater != undefined) |
147 | + return row_repeater.itemAt(index); |
148 | + } |
149 | + |
150 | + function get_indicator_item_position(index) { |
151 | + |
152 | + var indicator_row = findChild(panel.indicators, "indicatorRow"); |
153 | + verify(indicator_row != undefined) |
154 | + |
155 | + var indicator_item = get_indicator_item(index); |
156 | + verify(indicator_item != undefined); |
157 | + |
158 | + return panel.mapFromItem(indicator_item, indicator_item.width/2, indicator_item.height/2); |
159 | + } |
160 | + |
161 | + function test_hint_data() { return get_window_data() } |
162 | + |
163 | + // Pressing on the indicator panel should activate the indicator hints |
164 | + // and expose a portion of the conent. |
165 | + function test_hint(data) { |
166 | + panel.fullscreenMode = data.fullscreenFlag; |
167 | + |
168 | + var indicator_item_coord = get_indicator_item_position(0); |
169 | + var indicator_revealer = findChild(panel, "indicatorRevealer"); |
170 | + verify(indicator_revealer != undefined) |
171 | + |
172 | + mousePress(panel, |
173 | + indicator_item_coord.x, panel.panelHeight/2, |
174 | + Qt.LeftButton, Qt.NoModifier , 0); |
175 | + |
176 | + if (!panel.fullscreenMode) |
177 | + { |
178 | + compare(indicator_revealer.hintingAnimation.running, true, "Indicator revealer hint animation should be running after mouse press on indicator panel in pinned mode"); |
179 | + tryCompare(indicator_revealer.hintingAnimation, "running", false); |
180 | + tryCompare(panel.indicators, "partiallyOpened", true); |
181 | + } |
182 | + else |
183 | + { |
184 | + // nothing should happen |
185 | + compare(indicator_revealer.hintingAnimation.running, false, "Indicator revealer hint animation should not be running after mouse press on indicator panel in fullscreen mode"); |
186 | + compare(panel.indicators.partiallyOpened, false, "Indicator should not be partially opened when panel is pressed in fullscreenmode"); |
187 | + compare(panel.indicators.fullyOpened, false, "Indicator should not be partially opened when panel is pressed in fullscreenmode"); |
188 | + } |
189 | + |
190 | + mouseRelease(panel, |
191 | + indicator_item_coord.x, panel.panelHeight/2, |
192 | + Qt.LeftButton, Qt.NoModifier , 0); |
193 | + } |
194 | + |
195 | + function test_show_click_data() { return get_window_data() } |
196 | + |
197 | + // Clicking the indicator panel should fully open the inidicators |
198 | + function test_show_click(data) { |
199 | + panel.fullscreenMode = data.fullscreenFlag; |
200 | + |
201 | + var indicator_item_coord = get_indicator_item_position(0); |
202 | + |
203 | + mouseClick(panel, |
204 | + indicator_item_coord.x, panel.panelHeight/2, |
205 | + Qt.LeftButton, Qt.NoModifier , 0); |
206 | + |
207 | + if (!panel.fullscreenMode) |
208 | + { |
209 | + compare(panel.indicators.showAnimation.running, true, "Show animation should run after panel is clicked in pinned mode."); |
210 | + tryCompare(panel.indicators, "fullyOpened", true); |
211 | + |
212 | + // click will activate device overview. |
213 | + compare(findChild(panel.indicators, "indicatorRow").overviewActive, true, "Overview indicator should be avtive when indicators clicked.") |
214 | + } |
215 | + else |
216 | + { |
217 | + compare(panel.indicators.showAnimation.running, false, "Indicators should not open when panel is clicked in pinned mode."); |
218 | + } |
219 | + } |
220 | + |
221 | + function test_show_press_release_data() { return get_window_data() } |
222 | + |
223 | + // Pressing and releasing on the indicator panel will fully open the indicators |
224 | + function test_show_press_release(data) { |
225 | + panel.fullscreenMode = data.fullscreenFlag; |
226 | + |
227 | + var indicator_item_coord = get_indicator_item_position(0); |
228 | + |
229 | + mousePress(panel, |
230 | + indicator_item_coord.x, panel.panelHeight/2, |
231 | + Qt.LeftButton, Qt.NoModifier , 0); |
232 | + |
233 | + mouseRelease(panel, |
234 | + indicator_item_coord.x, panel.panelHeight/2, |
235 | + Qt.LeftButton, Qt.NoModifier , 0); |
236 | + |
237 | + if (!panel.fullscreenMode) |
238 | + { |
239 | + compare(panel.indicators.showAnimation.running, true, "Show animation should run after panel is clicked in pinned mode."); |
240 | + tryCompare(panel.indicators, "fullyOpened", true); |
241 | + } |
242 | + else |
243 | + { |
244 | + // nothing should happen. |
245 | + compare(panel.indicators.showAnimation.running, false, "Indicators should not open when panel is clicked in pinned mode."); |
246 | + } |
247 | + } |
248 | + |
249 | + function test_drag_show_data() { return get_window_data() } |
250 | + |
251 | + // Dragging from a indicator item in the panel will gradually expose the |
252 | + // indicators, first by running the hint animation, then after dragging down will |
253 | + // expose more of the panel, binding it to the selected indicator and opening it's menu. |
254 | + function test_drag_show(data) { |
255 | + panel.fullscreenMode = data.fullscreenFlag; |
256 | + |
257 | + var indicator_revealer = findChild(panel, "indicatorRevealer"); |
258 | + verify(indicator_revealer != undefined) |
259 | + |
260 | + var indicator_row = findChild(panel.indicators, "indicatorRow"); |
261 | + verify(indicator_row != undefined) |
262 | + |
263 | + var row_repeater = findChild(panel.indicators, "rowRepeater"); |
264 | + verify(indicator_row != undefined) |
265 | + |
266 | + var menu_content = findChild(panel.indicators, "menuContent"); |
267 | + verify(indicator_row != undefined) |
268 | + |
269 | + // do this for each indicator item |
270 | + for (var i = 0; i < row_repeater.count; i++) { |
271 | + |
272 | + var indicator_item = get_indicator_item(i); |
273 | + verify(indicator_item != undefined) |
274 | + |
275 | + var indicator_item_coord = get_indicator_item_position(i); |
276 | + |
277 | + // 1) Press on the panel |
278 | + mousePress(panel, |
279 | + indicator_item_coord.x, panel.panelHeight/2, |
280 | + Qt.LeftButton, Qt.NoModifier , 0); |
281 | + |
282 | + if (!panel.fullscreenMode) |
283 | + { |
284 | + // hint animation should be run, and panel will end in partiallyOpened state. |
285 | + compare(indicator_revealer.hintingAnimation.running, true, "Indicator revealer hint animation should be running after mouse press on indicator panel"); |
286 | + tryCompare(indicator_revealer.hintingAnimation, "running", false); |
287 | + tryCompare(panel.indicators, "partiallyOpened", true); |
288 | + } |
289 | + |
290 | + // 2) Drag the mouse down |
291 | + var old_progress = panel.indicators.progress |
292 | + mouseMove(panel, |
293 | + indicator_item_coord.x, old_progress + (panel.height - old_progress)/2, |
294 | + 0, Qt.LeftButton); |
295 | + |
296 | + // progress should increase. |
297 | + var progress_increases = panel.indicators.progress > old_progress; |
298 | + compare(progress_increases, true, "Progress has not increased on dragging indicator."); |
299 | + |
300 | + mouseMove(panel, |
301 | + indicator_item_coord.x, shell.y + shell.height, |
302 | + 0, Qt.LeftButton); |
303 | + |
304 | + tryCompare(panel.indicators, "fullyOpened", true); |
305 | + |
306 | + mouseRelease(panel, |
307 | + indicator_item_coord.x, indicator_item_coord.y + panel.height/2, |
308 | + Qt.LeftButton, Qt.NoModifier , 0); |
309 | + |
310 | + compare(indicator_row.currentItem, indicator_item, "Incorrect item activated at position " + i); |
311 | + compare(menu_content.__shown, true, "Menu conetent should be enabled for item at position " + i); |
312 | + |
313 | + // init for next indicator_item |
314 | + init(); |
315 | + } |
316 | + } |
317 | + |
318 | + function test_search_click_when_enabled() { |
319 | + panel.fullscreenMode = false; |
320 | + panel.searchEnabled = true; |
321 | + |
322 | + var search_indicator = findChild(panel, "search"); |
323 | + verify(search_indicator != undefined); |
324 | + |
325 | + mouseClick(search_indicator, |
326 | + 1, 1, |
327 | + Qt.LeftButton, Qt.NoModifier , 0); |
328 | + |
329 | + compare(search_clicked, true, "Clicking search indicator while it was enabled did not emit searchClicked signal") |
330 | + } |
331 | + |
332 | + function test_search_click_when_disabled() { |
333 | + panel.fullscreenMode = false; |
334 | + panel.searchEnabled = false |
335 | + |
336 | + var search_indicator = findChild(panel, "search"); |
337 | + verify(search_indicator != undefined); |
338 | + |
339 | + mouseClick(search_indicator, |
340 | + 1, 1, |
341 | + Qt.LeftButton, Qt.NoModifier , 0); |
342 | + |
343 | + compare(search_clicked, false, "Clicking search indicator while it was enabled emitted searchClicked signal") |
344 | + } |
345 | + } |
346 | +} |
36 +
37 + Behavior on y {
38 + NumberAnimation { duration: 200 }
39 + }
----------
63 -
64 - transitions: [
65 - Transition {
66 - NumberAnimation { target: panelBackground; property: "y"; duration: 200 }
67 - }
68 - ]
The state transition was introducing some odd behaviour issues when changing between fullscreen/pinned mode in the indicators. The transisition was causing the indicatorReveal er.openValue to switch between fullscreen/pinned multiple times when the state changed, and only be assigned to the new value after the transition was complete. This caused issues when changing to fullscreen and opening the indicators quickly.
So, I had the choice of either changing to use a Behaviour, or every time the openValue changes, we need to check if the show animation is running, and reset the "to" value, then restart the animation.
I chose the neater option.