Merge lp:~unity-team/unity/phablet.test_Panel-searchIndicator into lp:unity/phablet
- phablet.test_Panel-searchIndicator
- Merge into phablet
Proposed by
Andrea Cimitan
Status: | Superseded |
---|---|
Proposed branch: | lp:~unity-team/unity/phablet.test_Panel-searchIndicator |
Merge into: | lp:unity/phablet |
Diff against target: |
2052 lines (+770/-698) 32 files modified
Panel/SearchIndicator.qml (+1/-0) tests/qmluitests/CMakeLists.txt (+5/-14) tests/qmluitests/Components/CMakeLists.txt (+7/-0) tests/qmluitests/Components/RevealingRectangle.qml (+1/-1) tests/qmluitests/Components/tst_DraggingArea.qml (+80/-80) tests/qmluitests/Components/tst_FilterGrid.qml (+82/-85) tests/qmluitests/Components/tst_ResponsiveGridView.qml (+74/-73) tests/qmluitests/Components/tst_Revealer.qml (+30/-29) tests/qmluitests/Components/tst_Showable.qml (+72/-71) tests/qmluitests/Components/tst_Stage.qml (+143/-142) tests/qmluitests/Components/tst_Tile.qml (+4/-3) tests/qmluitests/Dash/CMakeLists.txt (+1/-0) tests/qmluitests/Dash/tst_DashPreview.qml (+3/-2) tests/qmluitests/Greeter/CMakeLists.txt (+1/-0) tests/qmluitests/Greeter/tst_Greeter.qml (+7/-5) tests/qmluitests/Hud/CMakeLists.txt (+3/-0) tests/qmluitests/Hud/qml/HudClient/CMakeLists.txt (+2/-2) tests/qmluitests/Hud/qml/HudClient/fake_hud_plugin.cpp (+2/-2) tests/qmluitests/Hud/tst_Hud.qml (+6/-6) tests/qmluitests/Launcher/CMakeLists.txt (+1/-0) tests/qmluitests/Launcher/tst_Launcher.qml (+32/-34) tests/qmluitests/Panel/CMakeLists.txt (+2/-0) tests/qmluitests/Panel/tst_IndicatorRow.qml (+23/-23) tests/qmluitests/Panel/tst_SearchIndicator.qml (+63/-0) tests/unittests/CMakeLists.txt (+1/-6) tests/unittests/Components/CMakeLists.txt (+6/-0) tests/unittests/Components/tst_AnimationControllerWithSignals.qml (+96/-97) tests/unittests/Components/tst_Carousel.qml (+1/-1) tests/unittests/Components/tst_CrossFadeImage.qml (+18/-19) tests/unittests/Components/tst_MathLocal.qml (+1/-1) tests/unittests/Components/tst_RatingStars.qml (+1/-1) tests/unittests/Components/tst_TimeLocal.qml (+1/-1) |
To merge this branch: | bzr merge lp:~unity-team/unity/phablet.test_Panel-searchIndicator |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Unity Team | Pending | ||
Review via email: mp+157679@code.launchpad.net |
Commit message
Add test for SearchIndicator under qmluitests/Panel
Description of the change
Add test for SearchIndicator under qmluitests/Panel
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Needs Fixing
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Panel/SearchIndicator.qml' |
2 | --- Panel/SearchIndicator.qml 2013-03-26 15:45:37 +0000 |
3 | +++ Panel/SearchIndicator.qml 2013-04-09 10:00:31 +0000 |
4 | @@ -43,6 +43,7 @@ |
5 | |
6 | Item { |
7 | id: container |
8 | + objectName: "container" |
9 | |
10 | width: parent.width |
11 | height: parent.height |
12 | |
13 | === modified file 'tests/qmluitests/CMakeLists.txt' |
14 | --- tests/qmluitests/CMakeLists.txt 2013-04-08 11:52:36 +0000 |
15 | +++ tests/qmluitests/CMakeLists.txt 2013-04-09 10:00:31 +0000 |
16 | @@ -1,19 +1,10 @@ |
17 | -add_subdirectory(qml) |
18 | - |
19 | add_custom_target(qmluitests) |
20 | |
21 | set(qmltest_DEFAULT_TARGETS qmluitests alltests) |
22 | set(qmltest_DEFAULT_NO_ADD_TEST TRUE) |
23 | |
24 | -add_qml_test(DashPreview) |
25 | -add_qml_test(DraggingArea) |
26 | -add_qml_test(FilterGrid IMPORT_PATH ${CMAKE_BINARY_DIR}/plugins) |
27 | -add_qml_test(Greeter) |
28 | -add_qml_test(Hud IMPORT_PATH ${CMAKE_CURRENT_BINARY_DIR}/qml) |
29 | -add_qml_test(IndicatorRow IMPORT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/qml) |
30 | -add_qml_test(Launcher) |
31 | -add_qml_test(ResponsiveGridView) |
32 | -add_qml_test(Revealer) |
33 | -add_qml_test(Showable) |
34 | -add_qml_test(Stage) |
35 | -add_qml_test(Tile) |
36 | +add_subdirectory(Components) |
37 | +add_subdirectory(Dash) |
38 | +add_subdirectory(Greeter) |
39 | +add_subdirectory(Hud) |
40 | +add_subdirectory(Panel) |
41 | |
42 | === added directory 'tests/qmluitests/Components' |
43 | === added file 'tests/qmluitests/Components/CMakeLists.txt' |
44 | --- tests/qmluitests/Components/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
45 | +++ tests/qmluitests/Components/CMakeLists.txt 2013-04-09 10:00:31 +0000 |
46 | @@ -0,0 +1,7 @@ |
47 | +add_qml_test(DraggingArea) |
48 | +add_qml_test(FilterGrid IMPORT_PATH ${CMAKE_BINARY_DIR}/plugins) |
49 | +add_qml_test(ResponsiveGridView) |
50 | +add_qml_test(Revealer) |
51 | +add_qml_test(Showable) |
52 | +add_qml_test(Stage) |
53 | +add_qml_test(Tile) |
54 | |
55 | === renamed file 'tests/qmluitests/RevealingRectangle.qml' => 'tests/qmluitests/Components/RevealingRectangle.qml' |
56 | --- tests/qmluitests/RevealingRectangle.qml 2013-03-19 12:06:15 +0000 |
57 | +++ tests/qmluitests/Components/RevealingRectangle.qml 2013-04-09 10:00:31 +0000 |
58 | @@ -16,7 +16,7 @@ |
59 | |
60 | import QtQuick 2.0 |
61 | import Ubuntu.Components 0.1 |
62 | -import "../../Components" |
63 | +import "../../../Components" |
64 | |
65 | Item { |
66 | id: revealingRectangle |
67 | |
68 | === renamed file 'tests/qmluitests/tst_DraggingArea.qml' => 'tests/qmluitests/Components/tst_DraggingArea.qml' |
69 | --- tests/qmluitests/tst_DraggingArea.qml 2013-03-15 15:34:06 +0000 |
70 | +++ tests/qmluitests/Components/tst_DraggingArea.qml 2013-04-09 10:00:31 +0000 |
71 | @@ -16,7 +16,7 @@ |
72 | |
73 | import QtQuick 2.0 |
74 | import QtTest 1.0 |
75 | -import "../../Components" |
76 | +import "../../../Components" |
77 | |
78 | /* |
79 | There will be a green rectangle in the center of the |
80 | @@ -35,6 +35,85 @@ |
81 | property int dragStartCount: 0 |
82 | property int dragEndCount: 0 |
83 | |
84 | + TestCase { |
85 | + name: "DraggingAreaTest" |
86 | + when: windowShown |
87 | + |
88 | + function test_horizontalDrag() { |
89 | + draggingArea.orientation = Qt.Horizontal; |
90 | + |
91 | + dragStartCount = 0 |
92 | + dragEndCount = 0 |
93 | + |
94 | + compare(draggingArea.dragging, false); |
95 | + |
96 | + // (item, x, y, button, modifiers, delay) |
97 | + mousePress(draggingArea, |
98 | + 25, 25, |
99 | + Qt.LeftButton, Qt.NoModifier, 0); |
100 | + |
101 | + compare(draggingArea.dragging, false); |
102 | + compare(dragStartCount, 0); |
103 | + compare(dragEndCount, 0); |
104 | + |
105 | + // (item, x, y, delay, button) |
106 | + mouseMove(draggingArea, |
107 | + -100, 25, |
108 | + 0, Qt.LeftButton); |
109 | + |
110 | + compare(draggingArea.dragging, true); |
111 | + compare(draggingArea.dragValue, -125); |
112 | + compare(dragStartCount, 1); |
113 | + compare(dragEndCount, 0); |
114 | + |
115 | + // (item, x, y, button, modifiers, delay) |
116 | + mouseRelease(draggingArea, |
117 | + -100, 25, |
118 | + Qt.LeftButton, Qt.NoModifier, 0); |
119 | + |
120 | + compare(draggingArea.dragging, false); |
121 | + compare(dragStartCount, 1); |
122 | + compare(dragEndCount, 1); |
123 | + } |
124 | + |
125 | + function test_verticalDrag() { |
126 | + draggingArea.orientation = Qt.Vertical; |
127 | + |
128 | + dragStartCount = 0 |
129 | + dragEndCount = 0 |
130 | + |
131 | + compare(draggingArea.dragging, false); |
132 | + |
133 | + // (item, x, y, button, modifiers, delay) |
134 | + mousePress(draggingArea, |
135 | + 25, 25, |
136 | + Qt.LeftButton, Qt.NoModifier, 0); |
137 | + |
138 | + compare(draggingArea.dragging, false); |
139 | + compare(dragStartCount, 0); |
140 | + compare(dragEndCount, 0); |
141 | + |
142 | + // (item, x, y, delay, button) |
143 | + mouseMove(draggingArea, |
144 | + 25, 125, |
145 | + 0, Qt.LeftButton); |
146 | + |
147 | + compare(draggingArea.dragging, true); |
148 | + compare(draggingArea.dragValue, 100); |
149 | + compare(dragStartCount, 1); |
150 | + compare(dragEndCount, 0); |
151 | + |
152 | + // (item, x, y, button, modifiers, delay) |
153 | + mouseRelease(draggingArea, |
154 | + 25, 125, |
155 | + Qt.LeftButton, Qt.NoModifier, 0); |
156 | + |
157 | + compare(draggingArea.dragging, false); |
158 | + compare(dragStartCount, 1); |
159 | + compare(dragEndCount, 1); |
160 | + } |
161 | + } |
162 | + |
163 | Column { |
164 | anchors.left: parent.left |
165 | anchors.top: parent.top |
166 | @@ -102,83 +181,4 @@ |
167 | onDragEnd : { ++root.dragEndCount } |
168 | } |
169 | } |
170 | - |
171 | - TestCase { |
172 | - name: "DraggingArea" |
173 | - when: windowShown |
174 | - |
175 | - function test_horizontalDrag() { |
176 | - draggingArea.orientation = Qt.Horizontal; |
177 | - |
178 | - dragStartCount = 0 |
179 | - dragEndCount = 0 |
180 | - |
181 | - compare(draggingArea.dragging, false); |
182 | - |
183 | - // (item, x, y, button, modifiers, delay) |
184 | - mousePress(draggingArea, |
185 | - 25, 25, |
186 | - Qt.LeftButton, Qt.NoModifier, 0); |
187 | - |
188 | - compare(draggingArea.dragging, false); |
189 | - compare(dragStartCount, 0); |
190 | - compare(dragEndCount, 0); |
191 | - |
192 | - // (item, x, y, delay, button) |
193 | - mouseMove(draggingArea, |
194 | - -100, 25, |
195 | - 0, Qt.LeftButton); |
196 | - |
197 | - compare(draggingArea.dragging, true); |
198 | - compare(draggingArea.dragValue, -125); |
199 | - compare(dragStartCount, 1); |
200 | - compare(dragEndCount, 0); |
201 | - |
202 | - // (item, x, y, button, modifiers, delay) |
203 | - mouseRelease(draggingArea, |
204 | - -100, 25, |
205 | - Qt.LeftButton, Qt.NoModifier, 0); |
206 | - |
207 | - compare(draggingArea.dragging, false); |
208 | - compare(dragStartCount, 1); |
209 | - compare(dragEndCount, 1); |
210 | - } |
211 | - |
212 | - function test_verticalDrag() { |
213 | - draggingArea.orientation = Qt.Vertical; |
214 | - |
215 | - dragStartCount = 0 |
216 | - dragEndCount = 0 |
217 | - |
218 | - compare(draggingArea.dragging, false); |
219 | - |
220 | - // (item, x, y, button, modifiers, delay) |
221 | - mousePress(draggingArea, |
222 | - 25, 25, |
223 | - Qt.LeftButton, Qt.NoModifier, 0); |
224 | - |
225 | - compare(draggingArea.dragging, false); |
226 | - compare(dragStartCount, 0); |
227 | - compare(dragEndCount, 0); |
228 | - |
229 | - // (item, x, y, delay, button) |
230 | - mouseMove(draggingArea, |
231 | - 25, 125, |
232 | - 0, Qt.LeftButton); |
233 | - |
234 | - compare(draggingArea.dragging, true); |
235 | - compare(draggingArea.dragValue, 100); |
236 | - compare(dragStartCount, 1); |
237 | - compare(dragEndCount, 0); |
238 | - |
239 | - // (item, x, y, button, modifiers, delay) |
240 | - mouseRelease(draggingArea, |
241 | - 25, 125, |
242 | - Qt.LeftButton, Qt.NoModifier, 0); |
243 | - |
244 | - compare(draggingArea.dragging, false); |
245 | - compare(dragStartCount, 1); |
246 | - compare(dragEndCount, 1); |
247 | - } |
248 | - } |
249 | } |
250 | |
251 | === renamed file 'tests/qmluitests/tst_FilterGrid.qml' => 'tests/qmluitests/Components/tst_FilterGrid.qml' |
252 | --- tests/qmluitests/tst_FilterGrid.qml 2013-03-18 15:49:03 +0000 |
253 | +++ tests/qmluitests/Components/tst_FilterGrid.qml 2013-04-09 10:00:31 +0000 |
254 | @@ -16,7 +16,7 @@ |
255 | |
256 | import QtQuick 2.0 |
257 | import QtTest 1.0 |
258 | -import "../../Components" |
259 | +import "../../../Components" |
260 | import Ubuntu.Components.ListItems 0.1 as ListItem |
261 | import Ubuntu.Components 0.1 |
262 | |
263 | @@ -30,6 +30,87 @@ |
264 | height: units.gu(50) |
265 | color: "white" |
266 | |
267 | + TestCase { |
268 | + name: "FilterGridTest" |
269 | + when: windowShown |
270 | + |
271 | + function test_turningFilterOffShowsAllElements() { |
272 | + compare(countVisibleDelegates(), 6) |
273 | + |
274 | + filterCheckBox.checked = false |
275 | + |
276 | + // wait for animations to complete |
277 | + tryCompare(filterGrid.__expansionAnimation, "running", false) |
278 | + compare(countVisibleDelegates(), 12) |
279 | + |
280 | + // back to initial state |
281 | + filterCheckBox.checked = true |
282 | + // wait for animations to complete |
283 | + tryCompare(filterGrid.__expansionAnimation, "running", false) |
284 | + } |
285 | + |
286 | + function test_collapsedRowCount() { |
287 | + for (var i = 0; i < 4; ++i) { |
288 | + collapsedRowCountSelector.selectedIndex = i |
289 | + // wait for animations to complete |
290 | + tryCompare(filterGrid.__expansionAnimation, "running", false) |
291 | + // We have 3 elements per row. |
292 | + // row count == index + 1 |
293 | + compare(countVisibleDelegates(), 3*(i+1)) |
294 | + } |
295 | + |
296 | + // back to initial state |
297 | + collapsedRowCountSelector.selectedIndex = 1 |
298 | + // wait for animations to complete |
299 | + tryCompare(filterGrid.__expansionAnimation, "running", false) |
300 | + } |
301 | + |
302 | + // Checks that the filter toggle button, the one that says "View All (xy)", |
303 | + // shows up only when it's possible for the grid to be expanded. |
304 | + function test_filterToggleButton() { |
305 | + var filterToggleButton = filterGrid.__filterToggleButton |
306 | + |
307 | + for (var i = 0; i < 4; ++i) { |
308 | + collapsedRowCountSelector.selectedIndex = i |
309 | + // wait for animations to complete |
310 | + tryCompare(filterGrid.__expansionAnimation, "running", false) |
311 | + // row count == index + 1 |
312 | + // The total number of rows is 4. |
313 | + |
314 | + expandableCheckBox.checked = false |
315 | + compare(filterToggleButton.visible, false) |
316 | + expandableCheckBox.checked = true |
317 | + |
318 | + if ((i+1) < 4) |
319 | + compare(filterToggleButton.visible, true) |
320 | + else |
321 | + compare(filterToggleButton.visible, false) |
322 | + } |
323 | + |
324 | + // back to initial state |
325 | + collapsedRowCountSelector.selectedIndex = 1 |
326 | + expandableCheckBox.checked = true |
327 | + // wait for animations to complete |
328 | + tryCompare(filterGrid.__expansionAnimation, "running", false) |
329 | + } |
330 | + |
331 | + function countVisibleDelegates() { |
332 | + return __countVisibleDelegates(filterGrid.visibleChildren, 0) |
333 | + } |
334 | + |
335 | + function __countVisibleDelegates(objList, total) { |
336 | + for (var i = 0; i < objList.length; ++i) { |
337 | + var child = objList[i]; |
338 | + if (child.isGridDelegate !== undefined) { |
339 | + ++total; |
340 | + } else { |
341 | + total = __countVisibleDelegates(child.visibleChildren, total) |
342 | + } |
343 | + } |
344 | + return total |
345 | + } |
346 | + } |
347 | + |
348 | Column { |
349 | id: controls |
350 | width: units.gu(30) |
351 | @@ -114,89 +195,5 @@ |
352 | } |
353 | } |
354 | } |
355 | - |
356 | - TestCase { |
357 | - name: "FilterGrid" |
358 | - when: windowShown |
359 | - |
360 | - function test_turningFilterOffShowsAllElements() { |
361 | - compare(countVisibleDelegates(), 6) |
362 | - |
363 | - filterCheckBox.checked = false |
364 | - |
365 | - // wait for animations to complete |
366 | - tryCompare(filterGrid.__expansionAnimation, "running", false) |
367 | - compare(countVisibleDelegates(), 12) |
368 | - |
369 | - // back to initial state |
370 | - filterCheckBox.checked = true |
371 | - // wait for animations to complete |
372 | - tryCompare(filterGrid.__expansionAnimation, "running", false) |
373 | - } |
374 | - |
375 | - function test_collapsedRowCount() { |
376 | - |
377 | - for (var i = 0; i < 4; ++i) { |
378 | - collapsedRowCountSelector.selectedIndex = i |
379 | - // wait for animations to complete |
380 | - tryCompare(filterGrid.__expansionAnimation, "running", false) |
381 | - // We have 3 elements per row. |
382 | - // row count == index + 1 |
383 | - compare(countVisibleDelegates(), 3*(i+1)) |
384 | - } |
385 | - |
386 | - // back to initial state |
387 | - collapsedRowCountSelector.selectedIndex = 1 |
388 | - // wait for animations to complete |
389 | - tryCompare(filterGrid.__expansionAnimation, "running", false) |
390 | - } |
391 | - |
392 | - // Checks that the filter toggle button, the one that says "View All (xy)", |
393 | - // shows up only when it's possible for the grid to be expanded. |
394 | - function test_filterToggleButton() { |
395 | - |
396 | - var filterToggleButton = filterGrid.__filterToggleButton |
397 | - |
398 | - for (var i = 0; i < 4; ++i) { |
399 | - collapsedRowCountSelector.selectedIndex = i |
400 | - // wait for animations to complete |
401 | - tryCompare(filterGrid.__expansionAnimation, "running", false) |
402 | - // row count == index + 1 |
403 | - // The total number of rows is 4. |
404 | - |
405 | - expandableCheckBox.checked = false |
406 | - compare(filterToggleButton.visible, false) |
407 | - expandableCheckBox.checked = true |
408 | - |
409 | - if ((i+1) < 4) |
410 | - compare(filterToggleButton.visible, true) |
411 | - else |
412 | - compare(filterToggleButton.visible, false) |
413 | - } |
414 | - |
415 | - // back to initial state |
416 | - collapsedRowCountSelector.selectedIndex = 1 |
417 | - expandableCheckBox.checked = true |
418 | - // wait for animations to complete |
419 | - tryCompare(filterGrid.__expansionAnimation, "running", false) |
420 | - } |
421 | - |
422 | - function countVisibleDelegates() { |
423 | - return __countVisibleDelegates(filterGrid.visibleChildren, 0) |
424 | - } |
425 | - |
426 | - function __countVisibleDelegates(objList, total) { |
427 | - for (var i = 0; i < objList.length; ++i) { |
428 | - var child = objList[i]; |
429 | - if (child.isGridDelegate !== undefined) { |
430 | - ++total; |
431 | - } else { |
432 | - total = __countVisibleDelegates(child.visibleChildren, total) |
433 | - } |
434 | - } |
435 | - return total |
436 | - } |
437 | - |
438 | - } |
439 | } |
440 | |
441 | |
442 | === renamed file 'tests/qmluitests/tst_ResponsiveGridView.qml' => 'tests/qmluitests/Components/tst_ResponsiveGridView.qml' |
443 | --- tests/qmluitests/tst_ResponsiveGridView.qml 2013-03-20 10:59:28 +0000 |
444 | +++ tests/qmluitests/Components/tst_ResponsiveGridView.qml 2013-04-09 10:00:31 +0000 |
445 | @@ -16,7 +16,8 @@ |
446 | |
447 | import QtQuick 2.0 |
448 | import QtTest 1.0 |
449 | -import "../../Components" |
450 | +import ".." |
451 | +import "../../../Components" |
452 | import Ubuntu.Components.ListItems 0.1 as ListItem |
453 | import Ubuntu.Components 0.1 |
454 | |
455 | @@ -24,6 +25,78 @@ |
456 | width: gridRect.width + controls.width |
457 | height: units.gu(80) |
458 | |
459 | + UnityTestCase { |
460 | + name: "ResponsiveGridViewTest" |
461 | + when: windowShown |
462 | + |
463 | + function test_maximumNumberOfColumns_data() { |
464 | + var data = new Array() |
465 | + |
466 | + data.push({selectedIndex: 0, maxColumnCount:2, columnCount: 2}) |
467 | + data.push({selectedIndex: 1, maxColumnCount:4, columnCount: 4}) |
468 | + data.push({selectedIndex: 2, maxColumnCount:8, columnCount: 8}) |
469 | + data.push({selectedIndex: 4, maxColumnCount:1000, columnCount: 13}) |
470 | + |
471 | + return data |
472 | + } |
473 | + |
474 | + /* Change ResponsiveGridView's maximumNumberOfColumns property and check |
475 | + that the resulting number of columns matches expectations */ |
476 | + function test_maximumNumberOfColumns(data) { |
477 | + minHSpacingSelector.selectedIndex = 0 |
478 | + |
479 | + // sanity checks |
480 | + compare(maxColumnsSelector.values[data.selectedIndex], data.maxColumnCount) |
481 | + compare(minHSpacingSelector.values[0], 0) |
482 | + |
483 | + maxColumnsSelector.selectedIndex = data.selectedIndex |
484 | + tryCompareFunction(countGridDelegatesOnFirstRow, data.columnCount); |
485 | + compare(grid.columns, data.columnCount) |
486 | + } |
487 | + |
488 | + function test_minimumHorizontalSpacing_data() { |
489 | + var data = new Array() |
490 | + |
491 | + data.push({selectedIndex: 0, minHSpacing:0, columnCount: 13}) |
492 | + data.push({selectedIndex: 1, minHSpacing:units.gu(2), columnCount: 9}) |
493 | + data.push({selectedIndex: 2, minHSpacing:units.gu(8), columnCount: 5}) |
494 | + data.push({selectedIndex: 3, minHSpacing:units.gu(25), columnCount: 2}) |
495 | + |
496 | + return data |
497 | + } |
498 | + |
499 | + /* Change ResponsiveGridView's minimumHorizontalSpacing property and check |
500 | + that the resulting number of columns matches expectations */ |
501 | + function test_minimumHorizontalSpacing(data) { |
502 | + maxColumnsSelector.selectedIndex = 4 |
503 | + |
504 | + // sanity checks |
505 | + compare(maxColumnsSelector.values[4], 1000) |
506 | + compare(minHSpacingSelector.values[data.selectedIndex], data.minHSpacing) |
507 | + |
508 | + minHSpacingSelector.selectedIndex = data.selectedIndex |
509 | + tryCompareFunction(countGridDelegatesOnFirstRow, data.columnCount); |
510 | + compare(grid.columns, data.columnCount) |
511 | + } |
512 | + |
513 | + |
514 | + function countGridDelegatesOnFirstRow() { |
515 | + return __countGridDelegatesOnFirstRow(grid.visibleChildren, 0) |
516 | + } |
517 | + |
518 | + function __countGridDelegatesOnFirstRow(objList, total) { |
519 | + for (var i = 0; i < objList.length; ++i) { |
520 | + var child = objList[i]; |
521 | + if (child.isGridDelegate !== undefined && child.y === 0) { |
522 | + ++total; |
523 | + } else { |
524 | + total = __countGridDelegatesOnFirstRow(child.visibleChildren, total) |
525 | + } |
526 | + } |
527 | + return total |
528 | + } |
529 | + } |
530 | + |
531 | Column { |
532 | id: controls |
533 | width: units.gu(40) |
534 | @@ -116,76 +189,4 @@ |
535 | } |
536 | } |
537 | } |
538 | - |
539 | - UnityTestCase { |
540 | - name: "ResponsiveGridView" |
541 | - when: windowShown |
542 | - |
543 | - function test_maximumNumberOfColumns_data() { |
544 | - var data = new Array() |
545 | - |
546 | - data.push({selectedIndex: 0, maxColumnCount:2, columnCount: 2}) |
547 | - data.push({selectedIndex: 1, maxColumnCount:4, columnCount: 4}) |
548 | - data.push({selectedIndex: 2, maxColumnCount:8, columnCount: 8}) |
549 | - data.push({selectedIndex: 4, maxColumnCount:1000, columnCount: 13}) |
550 | - |
551 | - return data |
552 | - } |
553 | - |
554 | - /* Change ResponsiveGridView's maximumNumberOfColumns property and check |
555 | - that the resulting number of columns matches expectations */ |
556 | - function test_maximumNumberOfColumns(data) { |
557 | - minHSpacingSelector.selectedIndex = 0 |
558 | - |
559 | - // sanity checks |
560 | - compare(maxColumnsSelector.values[data.selectedIndex], data.maxColumnCount) |
561 | - compare(minHSpacingSelector.values[0], 0) |
562 | - |
563 | - maxColumnsSelector.selectedIndex = data.selectedIndex |
564 | - tryCompareFunction(countGridDelegatesOnFirstRow, data.columnCount); |
565 | - compare(grid.columns, data.columnCount) |
566 | - } |
567 | - |
568 | - function test_minimumHorizontalSpacing_data() { |
569 | - var data = new Array() |
570 | - |
571 | - data.push({selectedIndex: 0, minHSpacing:0, columnCount: 13}) |
572 | - data.push({selectedIndex: 1, minHSpacing:units.gu(2), columnCount: 9}) |
573 | - data.push({selectedIndex: 2, minHSpacing:units.gu(8), columnCount: 5}) |
574 | - data.push({selectedIndex: 3, minHSpacing:units.gu(25), columnCount: 2}) |
575 | - |
576 | - return data |
577 | - } |
578 | - |
579 | - /* Change ResponsiveGridView's minimumHorizontalSpacing property and check |
580 | - that the resulting number of columns matches expectations */ |
581 | - function test_minimumHorizontalSpacing(data) { |
582 | - maxColumnsSelector.selectedIndex = 4 |
583 | - |
584 | - // sanity checks |
585 | - compare(maxColumnsSelector.values[4], 1000) |
586 | - compare(minHSpacingSelector.values[data.selectedIndex], data.minHSpacing) |
587 | - |
588 | - minHSpacingSelector.selectedIndex = data.selectedIndex |
589 | - tryCompareFunction(countGridDelegatesOnFirstRow, data.columnCount); |
590 | - compare(grid.columns, data.columnCount) |
591 | - } |
592 | - |
593 | - |
594 | - function countGridDelegatesOnFirstRow() { |
595 | - return __countGridDelegatesOnFirstRow(grid.visibleChildren, 0) |
596 | - } |
597 | - |
598 | - function __countGridDelegatesOnFirstRow(objList, total) { |
599 | - for (var i = 0; i < objList.length; ++i) { |
600 | - var child = objList[i]; |
601 | - if (child.isGridDelegate !== undefined && child.y === 0) { |
602 | - ++total; |
603 | - } else { |
604 | - total = __countGridDelegatesOnFirstRow(child.visibleChildren, total) |
605 | - } |
606 | - } |
607 | - return total |
608 | - } |
609 | - } |
610 | } |
611 | |
612 | === renamed file 'tests/qmluitests/tst_Revealer.qml' => 'tests/qmluitests/Components/tst_Revealer.qml' |
613 | --- tests/qmluitests/tst_Revealer.qml 2013-03-19 12:19:11 +0000 |
614 | +++ tests/qmluitests/Components/tst_Revealer.qml 2013-04-09 10:00:31 +0000 |
615 | @@ -16,6 +16,7 @@ |
616 | |
617 | import QtQuick 2.0 |
618 | import QtTest 1.0 |
619 | +import ".." |
620 | |
621 | /* |
622 | There's a revealer on each window edge. If you press and hold any edge you |
623 | @@ -31,36 +32,8 @@ |
624 | width: units.gu(75) |
625 | height: units.gu(50) |
626 | |
627 | - RevealingRectangle { |
628 | - id: topRevealingRectangle |
629 | - anchors.fill: parent |
630 | - orientation: Qt.Vertical |
631 | - direction: Qt.LeftToRight |
632 | - } |
633 | - |
634 | - RevealingRectangle { |
635 | - id: bottomRevealingRectangle |
636 | - anchors.fill: parent |
637 | - orientation: Qt.Vertical |
638 | - direction: Qt.RightToLeft |
639 | - } |
640 | - |
641 | - RevealingRectangle { |
642 | - id: leftRevealingRectangle |
643 | - anchors.fill: parent |
644 | - orientation: Qt.Horizontal |
645 | - direction: Qt.LeftToRight |
646 | - } |
647 | - |
648 | - RevealingRectangle { |
649 | - id: rightRevealingRectangle |
650 | - anchors.fill: parent |
651 | - orientation: Qt.Horizontal |
652 | - direction: Qt.RightToLeft |
653 | - } |
654 | - |
655 | UnityTestCase { |
656 | - name: "Revealer" |
657 | + name: "RevealerTest" |
658 | when: windowShown |
659 | |
660 | /* |
661 | @@ -258,5 +231,33 @@ |
662 | tryCompare(showable, "y", -showable.height) |
663 | } |
664 | } |
665 | + |
666 | + RevealingRectangle { |
667 | + id: topRevealingRectangle |
668 | + anchors.fill: parent |
669 | + orientation: Qt.Vertical |
670 | + direction: Qt.LeftToRight |
671 | + } |
672 | + |
673 | + RevealingRectangle { |
674 | + id: bottomRevealingRectangle |
675 | + anchors.fill: parent |
676 | + orientation: Qt.Vertical |
677 | + direction: Qt.RightToLeft |
678 | + } |
679 | + |
680 | + RevealingRectangle { |
681 | + id: leftRevealingRectangle |
682 | + anchors.fill: parent |
683 | + orientation: Qt.Horizontal |
684 | + direction: Qt.LeftToRight |
685 | + } |
686 | + |
687 | + RevealingRectangle { |
688 | + id: rightRevealingRectangle |
689 | + anchors.fill: parent |
690 | + orientation: Qt.Horizontal |
691 | + direction: Qt.RightToLeft |
692 | + } |
693 | } |
694 | |
695 | |
696 | === renamed file 'tests/qmluitests/tst_Showable.qml' => 'tests/qmluitests/Components/tst_Showable.qml' |
697 | --- tests/qmluitests/tst_Showable.qml 2013-04-02 10:45:33 +0000 |
698 | +++ tests/qmluitests/Components/tst_Showable.qml 2013-04-09 10:00:31 +0000 |
699 | @@ -17,7 +17,8 @@ |
700 | import QtQuick 2.0 |
701 | import QtTest 1.0 |
702 | import Ubuntu.Components 0.1 |
703 | -import "../../Components" |
704 | +import ".." |
705 | +import "../../../Components" |
706 | |
707 | /* |
708 | There will be 3 stacked rectangles, red, green & blue. Initially they |
709 | @@ -31,77 +32,8 @@ |
710 | width: units.gu(40) |
711 | height: units.gu(60) |
712 | |
713 | - Showable { |
714 | - id: show1 |
715 | - anchors.left: parent.left |
716 | - anchors.top: parent.top |
717 | - anchors.right: parent.right |
718 | - height: units.gu(20) |
719 | - |
720 | - opacity: 0.2 |
721 | - shown: false |
722 | - hides: [show2, show3] |
723 | - showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic } |
724 | - hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic } |
725 | - |
726 | - Rectangle { |
727 | - anchors.fill: parent |
728 | - color: "red" |
729 | - } |
730 | - MouseArea { |
731 | - anchors.fill: parent |
732 | - onClicked: { parent.show() } |
733 | - } |
734 | - } |
735 | - |
736 | - Showable { |
737 | - id: show2 |
738 | - anchors.left: parent.left |
739 | - anchors.top: show1.bottom |
740 | - anchors.right: parent.right |
741 | - height: units.gu(20) |
742 | - |
743 | - opacity: 0.2 |
744 | - shown: false |
745 | - hides: [show1, show3] |
746 | - showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic } |
747 | - hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic } |
748 | - |
749 | - Rectangle { |
750 | - anchors.fill: parent |
751 | - color: "green" |
752 | - } |
753 | - MouseArea { |
754 | - anchors.fill: parent |
755 | - onClicked: { parent.show() } |
756 | - } |
757 | - } |
758 | - |
759 | - Showable { |
760 | - id: show3 |
761 | - anchors.left: parent.left |
762 | - anchors.top: show2.bottom |
763 | - anchors.right: parent.right |
764 | - anchors.bottom: parent.bottom |
765 | - |
766 | - opacity: 0.1 |
767 | - shown: false |
768 | - hides: [show1, show2] |
769 | - showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic } |
770 | - hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic } |
771 | - |
772 | - Rectangle { |
773 | - anchors.fill: parent |
774 | - color: "blue" |
775 | - } |
776 | - MouseArea { |
777 | - anchors.fill: parent |
778 | - onClicked: { parent.show() } |
779 | - } |
780 | - } |
781 | - |
782 | UnityTestCase { |
783 | - name: "Showable" |
784 | + name: "ShowableTest" |
785 | when: windowShown |
786 | |
787 | function init_test() { |
788 | @@ -155,4 +87,73 @@ |
789 | compare(show1.shown, true, "Showable should automatically show when created changes to true if attempted to show before."); |
790 | } |
791 | } |
792 | + |
793 | + Showable { |
794 | + id: show1 |
795 | + anchors.left: parent.left |
796 | + anchors.top: parent.top |
797 | + anchors.right: parent.right |
798 | + height: units.gu(20) |
799 | + |
800 | + opacity: 0.2 |
801 | + shown: false |
802 | + hides: [show2, show3] |
803 | + showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic } |
804 | + hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic } |
805 | + |
806 | + Rectangle { |
807 | + anchors.fill: parent |
808 | + color: "red" |
809 | + } |
810 | + MouseArea { |
811 | + anchors.fill: parent |
812 | + onClicked: { parent.show() } |
813 | + } |
814 | + } |
815 | + |
816 | + Showable { |
817 | + id: show2 |
818 | + anchors.left: parent.left |
819 | + anchors.top: show1.bottom |
820 | + anchors.right: parent.right |
821 | + height: units.gu(20) |
822 | + |
823 | + opacity: 0.2 |
824 | + shown: false |
825 | + hides: [show1, show3] |
826 | + showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic } |
827 | + hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic } |
828 | + |
829 | + Rectangle { |
830 | + anchors.fill: parent |
831 | + color: "green" |
832 | + } |
833 | + MouseArea { |
834 | + anchors.fill: parent |
835 | + onClicked: { parent.show() } |
836 | + } |
837 | + } |
838 | + |
839 | + Showable { |
840 | + id: show3 |
841 | + anchors.left: parent.left |
842 | + anchors.top: show2.bottom |
843 | + anchors.right: parent.right |
844 | + anchors.bottom: parent.bottom |
845 | + |
846 | + opacity: 0.1 |
847 | + shown: false |
848 | + hides: [show1, show2] |
849 | + showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic } |
850 | + hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic } |
851 | + |
852 | + Rectangle { |
853 | + anchors.fill: parent |
854 | + color: "blue" |
855 | + } |
856 | + MouseArea { |
857 | + anchors.fill: parent |
858 | + onClicked: { parent.show() } |
859 | + } |
860 | + } |
861 | } |
862 | |
863 | === renamed directory 'tests/qmluitests/tst_Stage' => 'tests/qmluitests/Components/tst_Stage' |
864 | === renamed file 'tests/qmluitests/tst_Stage.qml' => 'tests/qmluitests/Components/tst_Stage.qml' |
865 | --- tests/qmluitests/tst_Stage.qml 2013-04-02 21:33:33 +0000 |
866 | +++ tests/qmluitests/Components/tst_Stage.qml 2013-04-09 10:00:31 +0000 |
867 | @@ -16,9 +16,10 @@ |
868 | |
869 | import QtQuick 2.0 |
870 | import QtTest 1.0 |
871 | -import "../../Components" |
872 | +import ".." |
873 | +import "../../../Components" |
874 | import Ubuntu.Components 0.1 |
875 | -import "../../Applications/applications.js" as ApplicationsModel |
876 | +import "../../../Applications/applications.js" as ApplicationsModel |
877 | import "tst_Stage" |
878 | |
879 | Rectangle { |
880 | @@ -27,6 +28,146 @@ |
881 | width: units.gu(70) |
882 | height: stageRect.height |
883 | |
884 | + UnityTestCase { |
885 | + name: "StageTest" |
886 | + when: windowShown |
887 | + |
888 | + /* If you press Stage's right edge it should show the hint that it's possible to |
889 | + switch to the next running application. This means (graphically) sliding the |
890 | + next application window from Stage's right edge for a small part of its width */ |
891 | + function test_pressingRightEdgeShowsHint() { |
892 | + |
893 | + // it shoulnd't be showing anything at first |
894 | + compare(stage.usingScreenshots, false) |
895 | + |
896 | + redControl.checked = true |
897 | + |
898 | + tryCompare(stage, "usingScreenshots", true) // wait for the animation to start |
899 | + wait(600) |
900 | + tryCompare(stage, "usingScreenshots", false) // and then for it to end |
901 | + compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red") |
902 | + compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red") |
903 | + |
904 | + greenControl.checked = true |
905 | + |
906 | + tryCompare(stage, "usingScreenshots", true) // wait for the animation to start |
907 | + wait(600) |
908 | + tryCompare(stage, "usingScreenshots", false) // and then for it to end |
909 | + compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "green") |
910 | + compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "green") |
911 | + |
912 | + var draggingAreaCenterX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2) |
913 | + var draggingAreaCenterY = stage.height / 2 |
914 | + mousePress(stage, draggingAreaCenterX, draggingAreaCenterY) |
915 | + |
916 | + // wait for the animation to start |
917 | + tryCompare(stage, "usingScreenshots", true) |
918 | + |
919 | + // "red" should be the new/next application being shown |
920 | + compare(newAppScreenshot.application.desktopFile, "red") |
921 | + tryCompareFunction(isShowingABitOfNewApp, true); |
922 | + |
923 | + // "green" should be the current application being shown |
924 | + compare(oldAppScreenshot.application.desktopFile, "green") |
925 | + tryCompareFunction(isCurrentAppFadingOut, true); |
926 | + |
927 | + mouseRelease(stage, draggingAreaCenterX, draggingAreaCenterY) |
928 | + } |
929 | + |
930 | + function isShowingABitOfNewApp() { |
931 | + // it should come from the right and take less than half of the screen |
932 | + // but at least 15% of it |
933 | + return newAppScreenshot.x > stage.width/2 |
934 | + && newAppScreenshot.x < stage.width*(85/100) |
935 | + && newAppScreenshot.y === 0 |
936 | + && newAppScreenshot.visible |
937 | + } |
938 | + |
939 | + function isCurrentAppFadingOut() { |
940 | + // it should get a bit translucent and smaller |
941 | + return oldAppScreenshot.opacity < 0.98 |
942 | + && oldAppScreenshot.opacity >= 0.1 |
943 | + && oldAppScreenshot.scale < 0.98 |
944 | + && oldAppScreenshot.scale >= 0.1 |
945 | + && oldAppScreenshot.visible |
946 | + } |
947 | + |
948 | + function init() { |
949 | + redControl.checked = false; |
950 | + greenControl.checked = false; |
951 | + blueControl.checked = false; |
952 | + // give some room for animations to start |
953 | + wait(50) |
954 | + // wait until animations end, if any |
955 | + tryCompare(stage, "usingScreenshots", false) |
956 | + } |
957 | + |
958 | + /* If you flick from the right edge of the stage leftwards it should cause an |
959 | + application switch. */ |
960 | + function test_dragFromRightEdgeToSwitchApplication() { |
961 | + // it shoulnd't be showing anything at first |
962 | + compare(stage.usingScreenshots, false) |
963 | + |
964 | + redControl.checked = true |
965 | + |
966 | + tryCompare(stage, "usingScreenshots", true) // wait for the animation to start |
967 | + tryCompare(stage, "usingScreenshots", false) // and then for it to end |
968 | + compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red") |
969 | + compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red") |
970 | + |
971 | + greenControl.checked = true |
972 | + |
973 | + tryCompare(stage, "usingScreenshots", true) // wait for the animation to start |
974 | + tryCompare(stage, "usingScreenshots", false) // and then for it to end |
975 | + compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "green") |
976 | + compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "green") |
977 | + |
978 | + var mouseX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2) |
979 | + var mouseY = stage.height / 2 |
980 | + mouseFlick(stage, mouseX, mouseY, |
981 | + mouseX - units.gu(5), mouseY) |
982 | + |
983 | + // wait until animations end, if any |
984 | + tryCompare(stage, "usingScreenshots", false) |
985 | + |
986 | + // "red" should be the new topmost, focused, application |
987 | + compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red") |
988 | + compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red") |
989 | + } |
990 | + |
991 | + /* When an application is launched, it needs a background before it's drawn on screen |
992 | + so that the user does not see the previous running app while the new one is launching. |
993 | + When switching between applications, backgrounds are unnecessary, 'cause the |
994 | + applications are in front of them. */ |
995 | + function test_background() { |
996 | + // it shoulnd't be showing anything at first |
997 | + compare(stage.usingScreenshots, false) |
998 | + |
999 | + redControl.checked = true |
1000 | + tryCompare(stage, "usingScreenshots", true) // wait for the animation to start |
1001 | + |
1002 | + compare(newAppScreenshot.withBackground, true, "starting app screenshot does not have background enabled") |
1003 | + |
1004 | + tryCompare(stage, "usingScreenshots", false) // wait for the animation to finish |
1005 | + |
1006 | + greenControl.checked = true |
1007 | + tryCompare(stage, "usingScreenshots", true) // wait for the animation to start |
1008 | + tryCompare(stage, "usingScreenshots", false) // and finish |
1009 | + |
1010 | + var draggingAreaCenterX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2) |
1011 | + var draggingAreaCenterY = stage.height / 2 |
1012 | + mousePress(stage, draggingAreaCenterX, draggingAreaCenterY) |
1013 | + |
1014 | + // wait for the animation to start |
1015 | + tryCompare(stage, "usingScreenshots", true) |
1016 | + |
1017 | + compare(newAppScreenshot.withBackground, false, "switched app does have background enabled") |
1018 | + |
1019 | + tryCompareFunction(isShowingABitOfNewApp, true); // wait for the hint animation to finish |
1020 | + mouseRelease(stage, draggingAreaCenterX, draggingAreaCenterY) |
1021 | + } |
1022 | + } |
1023 | + |
1024 | // Even though we replace the ApplicationScreenshot instances in Stage |
1025 | // with our own fake ones, ApplicationScreenshot.qml still gives out a warning |
1026 | // if shell.importUbuntuApplicationAvailable is missing. |
1027 | @@ -190,144 +331,4 @@ |
1028 | AppControl {id: blueControl; desktopFile:"blue"} |
1029 | } |
1030 | } |
1031 | - |
1032 | - UnityTestCase { |
1033 | - name: "Stage" |
1034 | - when: windowShown |
1035 | - |
1036 | - /* If you press Stage's right edge it should show the hint that it's possible to |
1037 | - switch to the next running application. This means (graphically) sliding the |
1038 | - next application window from Stage's right edge for a small part of its width */ |
1039 | - function test_pressingRightEdgeShowsHint() { |
1040 | - |
1041 | - // it shoulnd't be showing anything at first |
1042 | - compare(stage.usingScreenshots, false) |
1043 | - |
1044 | - redControl.checked = true |
1045 | - |
1046 | - tryCompare(stage, "usingScreenshots", true) // wait for the animation to start |
1047 | - wait(600) |
1048 | - tryCompare(stage, "usingScreenshots", false) // and then for it to end |
1049 | - compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red") |
1050 | - compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red") |
1051 | - |
1052 | - greenControl.checked = true |
1053 | - |
1054 | - tryCompare(stage, "usingScreenshots", true) // wait for the animation to start |
1055 | - wait(600) |
1056 | - tryCompare(stage, "usingScreenshots", false) // and then for it to end |
1057 | - compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "green") |
1058 | - compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "green") |
1059 | - |
1060 | - var draggingAreaCenterX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2) |
1061 | - var draggingAreaCenterY = stage.height / 2 |
1062 | - mousePress(stage, draggingAreaCenterX, draggingAreaCenterY) |
1063 | - |
1064 | - // wait for the animation to start |
1065 | - tryCompare(stage, "usingScreenshots", true) |
1066 | - |
1067 | - // "red" should be the new/next application being shown |
1068 | - compare(newAppScreenshot.application.desktopFile, "red") |
1069 | - tryCompareFunction(isShowingABitOfNewApp, true); |
1070 | - |
1071 | - // "green" should be the current application being shown |
1072 | - compare(oldAppScreenshot.application.desktopFile, "green") |
1073 | - tryCompareFunction(isCurrentAppFadingOut, true); |
1074 | - |
1075 | - mouseRelease(stage, draggingAreaCenterX, draggingAreaCenterY) |
1076 | - } |
1077 | - |
1078 | - function isShowingABitOfNewApp() { |
1079 | - // it should come from the right and take less than half of the screen |
1080 | - // but at least 15% of it |
1081 | - return newAppScreenshot.x > stage.width/2 |
1082 | - && newAppScreenshot.x < stage.width*(85/100) |
1083 | - && newAppScreenshot.y === 0 |
1084 | - && newAppScreenshot.visible |
1085 | - } |
1086 | - |
1087 | - function isCurrentAppFadingOut() { |
1088 | - // it should get a bit translucent and smaller |
1089 | - return oldAppScreenshot.opacity < 0.98 |
1090 | - && oldAppScreenshot.opacity >= 0.1 |
1091 | - && oldAppScreenshot.scale < 0.98 |
1092 | - && oldAppScreenshot.scale >= 0.1 |
1093 | - && oldAppScreenshot.visible |
1094 | - } |
1095 | - |
1096 | - function init() { |
1097 | - redControl.checked = false; |
1098 | - greenControl.checked = false; |
1099 | - blueControl.checked = false; |
1100 | - // give some room for animations to start |
1101 | - wait(50) |
1102 | - // wait until animations end, if any |
1103 | - tryCompare(stage, "usingScreenshots", false) |
1104 | - } |
1105 | - |
1106 | - /* If you flick from the right edge of the stage leftwards it should cause an |
1107 | - application switch. */ |
1108 | - function test_dragFromRightEdgeToSwitchApplication() { |
1109 | - // it shoulnd't be showing anything at first |
1110 | - compare(stage.usingScreenshots, false) |
1111 | - |
1112 | - redControl.checked = true |
1113 | - |
1114 | - tryCompare(stage, "usingScreenshots", true) // wait for the animation to start |
1115 | - tryCompare(stage, "usingScreenshots", false) // and then for it to end |
1116 | - compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red") |
1117 | - compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red") |
1118 | - |
1119 | - greenControl.checked = true |
1120 | - |
1121 | - tryCompare(stage, "usingScreenshots", true) // wait for the animation to start |
1122 | - tryCompare(stage, "usingScreenshots", false) // and then for it to end |
1123 | - compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "green") |
1124 | - compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "green") |
1125 | - |
1126 | - var mouseX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2) |
1127 | - var mouseY = stage.height / 2 |
1128 | - mouseFlick(stage, mouseX, mouseY, |
1129 | - mouseX - units.gu(5), mouseY) |
1130 | - |
1131 | - // wait until animations end, if any |
1132 | - tryCompare(stage, "usingScreenshots", false) |
1133 | - |
1134 | - // "red" should be the new topmost, focused, application |
1135 | - compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red") |
1136 | - compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red") |
1137 | - } |
1138 | - |
1139 | - /* When an application is launched, it needs a background before it's drawn on screen |
1140 | - so that the user does not see the previous running app while the new one is launching. |
1141 | - When switching between applications, backgrounds are unnecessary, 'cause the |
1142 | - applications are in front of them. */ |
1143 | - function test_background() { |
1144 | - // it shoulnd't be showing anything at first |
1145 | - compare(stage.usingScreenshots, false) |
1146 | - |
1147 | - redControl.checked = true |
1148 | - tryCompare(stage, "usingScreenshots", true) // wait for the animation to start |
1149 | - |
1150 | - compare(newAppScreenshot.withBackground, true, "starting app screenshot does not have background enabled") |
1151 | - |
1152 | - tryCompare(stage, "usingScreenshots", false) // wait for the animation to finish |
1153 | - |
1154 | - greenControl.checked = true |
1155 | - tryCompare(stage, "usingScreenshots", true) // wait for the animation to start |
1156 | - tryCompare(stage, "usingScreenshots", false) // and finish |
1157 | - |
1158 | - var draggingAreaCenterX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2) |
1159 | - var draggingAreaCenterY = stage.height / 2 |
1160 | - mousePress(stage, draggingAreaCenterX, draggingAreaCenterY) |
1161 | - |
1162 | - // wait for the animation to start |
1163 | - tryCompare(stage, "usingScreenshots", true) |
1164 | - |
1165 | - compare(newAppScreenshot.withBackground, false, "switched app does have background enabled") |
1166 | - |
1167 | - tryCompareFunction(isShowingABitOfNewApp, true); // wait for the hint animation to finish |
1168 | - mouseRelease(stage, draggingAreaCenterX, draggingAreaCenterY) |
1169 | - } |
1170 | - } |
1171 | } |
1172 | |
1173 | === renamed file 'tests/qmluitests/tst_Tile.qml' => 'tests/qmluitests/Components/tst_Tile.qml' |
1174 | --- tests/qmluitests/tst_Tile.qml 2013-04-08 11:52:36 +0000 |
1175 | +++ tests/qmluitests/Components/tst_Tile.qml 2013-04-09 10:00:31 +0000 |
1176 | @@ -16,7 +16,8 @@ |
1177 | |
1178 | import QtQuick 2.0 |
1179 | import QtTest 1.0 |
1180 | -import "../../Components" |
1181 | +import ".." |
1182 | +import "../../../Components" |
1183 | import Ubuntu.Components 0.1 |
1184 | |
1185 | Item { |
1186 | @@ -57,11 +58,11 @@ |
1187 | mouseRelease(label, 1, 1) |
1188 | } |
1189 | } |
1190 | - |
1191 | + |
1192 | Tile { |
1193 | id: tile |
1194 | anchors.fill: parent |
1195 | - source: "../../graphics/clock@18.png" |
1196 | + source: "../../../graphics/clock@18.png" |
1197 | text: "Testing rocks, debugging sucks!" |
1198 | imageWidth: width |
1199 | imageHeight: width |
1200 | |
1201 | === added directory 'tests/qmluitests/Dash' |
1202 | === added file 'tests/qmluitests/Dash/CMakeLists.txt' |
1203 | --- tests/qmluitests/Dash/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1204 | +++ tests/qmluitests/Dash/CMakeLists.txt 2013-04-09 10:00:31 +0000 |
1205 | @@ -0,0 +1,1 @@ |
1206 | +add_qml_test(DashPreview) |
1207 | |
1208 | === renamed file 'tests/qmluitests/tst_DashPreview.qml' => 'tests/qmluitests/Dash/tst_DashPreview.qml' |
1209 | --- tests/qmluitests/tst_DashPreview.qml 2013-03-26 14:25:34 +0000 |
1210 | +++ tests/qmluitests/Dash/tst_DashPreview.qml 2013-04-09 10:00:31 +0000 |
1211 | @@ -16,7 +16,8 @@ |
1212 | |
1213 | import QtQuick 2.0 |
1214 | import QtTest 1.0 |
1215 | -import "../../Dash" |
1216 | +import ".." |
1217 | +import "../../../Dash" |
1218 | import Ubuntu.Components 0.1 |
1219 | |
1220 | Item { |
1221 | @@ -109,7 +110,7 @@ |
1222 | } |
1223 | |
1224 | } |
1225 | - |
1226 | + |
1227 | DashPreview { |
1228 | id: preview |
1229 | anchors.fill: parent |
1230 | |
1231 | === added directory 'tests/qmluitests/Greeter' |
1232 | === added file 'tests/qmluitests/Greeter/CMakeLists.txt' |
1233 | --- tests/qmluitests/Greeter/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1234 | +++ tests/qmluitests/Greeter/CMakeLists.txt 2013-04-09 10:00:31 +0000 |
1235 | @@ -0,0 +1,1 @@ |
1236 | +add_qml_test(Greeter) |
1237 | |
1238 | === renamed file 'tests/qmluitests/tst_Greeter.qml' => 'tests/qmluitests/Greeter/tst_Greeter.qml' |
1239 | --- tests/qmluitests/tst_Greeter.qml 2013-04-05 17:07:17 +0000 |
1240 | +++ tests/qmluitests/Greeter/tst_Greeter.qml 2013-04-09 10:00:31 +0000 |
1241 | @@ -16,16 +16,18 @@ |
1242 | |
1243 | import QtQuick 2.0 |
1244 | import QtTest 1.0 |
1245 | -import "../../Greeter" |
1246 | +import ".." |
1247 | +import "../../../Greeter" |
1248 | import Ubuntu.Components 0.1 |
1249 | |
1250 | Item { |
1251 | width: units.gu(120) |
1252 | height: units.gu(80) |
1253 | + |
1254 | UnityTestCase { |
1255 | name: "GreeterTest" |
1256 | when: windowShown |
1257 | - |
1258 | + |
1259 | function test_cycle_data() { |
1260 | tryCompare(findChild(greeter, "userList"), "count", 5) |
1261 | var data = new Array() |
1262 | @@ -35,7 +37,7 @@ |
1263 | data[greeter.model.count] = {tag: greeter.model.get(0).name, username: "username0", uid: 0 } |
1264 | return data |
1265 | } |
1266 | - |
1267 | + |
1268 | function test_cycle(data) { |
1269 | tryCompare(findChild(greeter, "userList"), "count", 5) |
1270 | selectionSpy.clear(); |
1271 | @@ -46,7 +48,7 @@ |
1272 | tryCompare(greeter, "locked", greeter.model.get(data.uid).password !== undefined) |
1273 | tryCompare(selectionSpy, "count", 1) |
1274 | } |
1275 | - |
1276 | + |
1277 | function test_unlock_password() { |
1278 | unlockSpy.clear() |
1279 | // First one is Lolas account right now. Replace with password protected user from lightdm |
1280 | @@ -93,7 +95,7 @@ |
1281 | compare(unlockSpy.count, 1) |
1282 | } |
1283 | } |
1284 | - |
1285 | + |
1286 | Greeter { |
1287 | id: greeter |
1288 | anchors.fill: parent |
1289 | |
1290 | === added directory 'tests/qmluitests/Hud' |
1291 | === added file 'tests/qmluitests/Hud/CMakeLists.txt' |
1292 | --- tests/qmluitests/Hud/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1293 | +++ tests/qmluitests/Hud/CMakeLists.txt 2013-04-09 10:00:31 +0000 |
1294 | @@ -0,0 +1,3 @@ |
1295 | +add_subdirectory(qml) |
1296 | + |
1297 | +add_qml_test(Hud IMPORT_PATH ${CMAKE_CURRENT_BINARY_DIR}/qml) |
1298 | |
1299 | === added directory 'tests/qmluitests/Hud/qml' |
1300 | === renamed file 'tests/qmluitests/qml/CMakeLists.txt' => 'tests/qmluitests/Hud/qml/CMakeLists.txt' |
1301 | === renamed directory 'tests/qmluitests/qml/HudClient' => 'tests/qmluitests/Hud/qml/HudClient' |
1302 | === modified file 'tests/qmluitests/Hud/qml/HudClient/CMakeLists.txt' |
1303 | --- tests/qmluitests/qml/HudClient/CMakeLists.txt 2013-03-15 16:49:45 +0000 |
1304 | +++ tests/qmluitests/Hud/qml/HudClient/CMakeLists.txt 2013-04-09 10:00:31 +0000 |
1305 | @@ -25,8 +25,8 @@ |
1306 | add_definitions(-DQT_NO_KEYWORDS) |
1307 | |
1308 | set(HudQML_SOURCES |
1309 | - ../../../../plugins/HudClient/hudclient.cpp |
1310 | - ../../../../plugins/HudClient/volumepeakdetector.cpp |
1311 | + ../../../../../plugins/HudClient/hudclient.cpp |
1312 | + ../../../../../plugins/HudClient/volumepeakdetector.cpp |
1313 | fake_hud_plugin.cpp |
1314 | fake_libhud_client.cpp |
1315 | libhud_client_stub.cpp |
1316 | |
1317 | === modified file 'tests/qmluitests/Hud/qml/HudClient/fake_hud_plugin.cpp' |
1318 | --- tests/qmluitests/qml/HudClient/fake_hud_plugin.cpp 2013-03-15 16:57:11 +0000 |
1319 | +++ tests/qmluitests/Hud/qml/HudClient/fake_hud_plugin.cpp 2013-04-09 10:00:31 +0000 |
1320 | @@ -16,8 +16,8 @@ |
1321 | |
1322 | #include "fake_hud_plugin.h" |
1323 | |
1324 | -#include "../../../../plugins/HudClient/hudclient.h" |
1325 | -#include "../../../../plugins/HudClient/volumepeakdetector.h" |
1326 | +#include "../../../../../plugins/HudClient/hudclient.h" |
1327 | +#include "../../../../../plugins/HudClient/volumepeakdetector.h" |
1328 | #include "libhud_client_stub.h" |
1329 | |
1330 | #include <deelistmodel.h> |
1331 | |
1332 | === renamed file 'tests/qmluitests/tst_Hud.qml' => 'tests/qmluitests/Hud/tst_Hud.qml' |
1333 | --- tests/qmluitests/tst_Hud.qml 2013-04-02 08:20:21 +0000 |
1334 | +++ tests/qmluitests/Hud/tst_Hud.qml 2013-04-09 10:00:31 +0000 |
1335 | @@ -16,10 +16,10 @@ |
1336 | |
1337 | import QtQuick 2.0 |
1338 | import QtTest 1.0 |
1339 | +import ".." |
1340 | +import "../../../Hud" |
1341 | import HudClient 0.1 |
1342 | |
1343 | -import "../../Hud" |
1344 | - |
1345 | Hud { |
1346 | id: hud |
1347 | height: units.gu(80) |
1348 | @@ -33,10 +33,6 @@ |
1349 | } |
1350 | } |
1351 | |
1352 | - HudClientStub { |
1353 | - id: hudClientStub |
1354 | - } |
1355 | - |
1356 | UnityTestCase { |
1357 | name: "HudTest" |
1358 | when: windowShown |
1359 | @@ -281,4 +277,8 @@ |
1360 | compare(hudClientStub.lastParametrizedCommandCommited, true, "Confirming does commit") |
1361 | } |
1362 | } |
1363 | + |
1364 | + HudClientStub { |
1365 | + id: hudClientStub |
1366 | + } |
1367 | } |
1368 | |
1369 | === added directory 'tests/qmluitests/Launcher' |
1370 | === added file 'tests/qmluitests/Launcher/CMakeLists.txt' |
1371 | --- tests/qmluitests/Launcher/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1372 | +++ tests/qmluitests/Launcher/CMakeLists.txt 2013-04-09 10:00:31 +0000 |
1373 | @@ -0,0 +1,1 @@ |
1374 | +add_qml_test(Launcher) |
1375 | |
1376 | === renamed file 'tests/qmluitests/tst_Launcher.qml' => 'tests/qmluitests/Launcher/tst_Launcher.qml' |
1377 | --- tests/qmluitests/tst_Launcher.qml 2013-03-28 11:03:01 +0000 |
1378 | +++ tests/qmluitests/Launcher/tst_Launcher.qml 2013-04-09 10:00:31 +0000 |
1379 | @@ -16,8 +16,9 @@ |
1380 | |
1381 | import QtQuick 2.0 |
1382 | import QtTest 1.0 |
1383 | -import "../../Launcher" |
1384 | -import "../../Applications/applications.js" as ApplicationsModel |
1385 | +import ".." |
1386 | +import "../../../Launcher" |
1387 | +import "../../../Applications/applications.js" as ApplicationsModel |
1388 | |
1389 | /* Nothing is shown at first. If you drag from left edge you will bring up the |
1390 | launcher. */ |
1391 | @@ -26,38 +27,9 @@ |
1392 | width: units.gu(50) |
1393 | height: units.gu(81) |
1394 | |
1395 | - Launcher { |
1396 | - id: launcher |
1397 | - x: 0 |
1398 | - y: 0 |
1399 | - width: units.gu(40) |
1400 | - height: units.gu(71) |
1401 | - |
1402 | - favourites: ["/usr/share/applications/phone-app.desktop", |
1403 | - "/usr/share/applications/camera-app.desktop", |
1404 | - "/usr/share/applications/gallery-app.desktop"] |
1405 | - |
1406 | - shortcutsWidth: units.gu(9) |
1407 | - shortcutsThreshold: units.gu(2) |
1408 | - iconPath: "graphics/applicationIcons" |
1409 | - __dateTime: testCase.fakeDateTime |
1410 | - |
1411 | - property string latestApplicationSelected |
1412 | - |
1413 | - onLauncherApplicationSelected: { |
1414 | - latestApplicationSelected = name |
1415 | - } |
1416 | - |
1417 | - property int dashItemSelected_count: 0 |
1418 | - onDashItemSelected: { |
1419 | - dashItemSelected_count++; |
1420 | - } |
1421 | - |
1422 | - } |
1423 | - |
1424 | UnityTestCase { |
1425 | id: testCase |
1426 | - name: "Launcher" |
1427 | + name: "LauncherTest" |
1428 | when: windowShown |
1429 | |
1430 | // Drag from the left edge of the screen rightwards and check that the launcher |
1431 | @@ -197,7 +169,6 @@ |
1432 | false, /* but do not release yet */ |
1433 | launcher.maxFlickSpeedToLaunchApp*2 /* speed */ ) |
1434 | |
1435 | - |
1436 | // wait until it gets fully extended |
1437 | tryCompare(shortcuts, "x", 0) |
1438 | |
1439 | @@ -243,6 +214,33 @@ |
1440 | var shortcuts = findChild(launcher, "shortcuts") |
1441 | tryCompare(shortcuts, "x", -shortcuts.width, 1000) |
1442 | } |
1443 | - |
1444 | + } |
1445 | + |
1446 | + Launcher { |
1447 | + id: launcher |
1448 | + x: 0 |
1449 | + y: 0 |
1450 | + width: units.gu(40) |
1451 | + height: units.gu(71) |
1452 | + |
1453 | + favourites: ["/usr/share/applications/phone-app.desktop", |
1454 | + "/usr/share/applications/camera-app.desktop", |
1455 | + "/usr/share/applications/gallery-app.desktop"] |
1456 | + |
1457 | + shortcutsWidth: units.gu(9) |
1458 | + shortcutsThreshold: units.gu(2) |
1459 | + iconPath: "graphics/applicationIcons" |
1460 | + __dateTime: testCase.fakeDateTime |
1461 | + |
1462 | + property string latestApplicationSelected |
1463 | + |
1464 | + onLauncherApplicationSelected: { |
1465 | + latestApplicationSelected = name |
1466 | + } |
1467 | + |
1468 | + property int dashItemSelected_count: 0 |
1469 | + onDashItemSelected: { |
1470 | + dashItemSelected_count++; |
1471 | + } |
1472 | } |
1473 | } |
1474 | |
1475 | === added directory 'tests/qmluitests/Panel' |
1476 | === added file 'tests/qmluitests/Panel/CMakeLists.txt' |
1477 | --- tests/qmluitests/Panel/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1478 | +++ tests/qmluitests/Panel/CMakeLists.txt 2013-04-09 10:00:31 +0000 |
1479 | @@ -0,0 +1,2 @@ |
1480 | +add_qml_test(IndicatorRow IMPORT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/qml) |
1481 | +add_qml_test(SearchIndicator) |
1482 | |
1483 | === renamed directory 'tests/qmluitests/qml' => 'tests/qmluitests/Panel/qml' |
1484 | === renamed file 'tests/qmluitests/tst_IndicatorRow.qml' => 'tests/qmluitests/Panel/tst_IndicatorRow.qml' |
1485 | --- tests/qmluitests/tst_IndicatorRow.qml 2013-04-05 12:44:49 +0000 |
1486 | +++ tests/qmluitests/Panel/tst_IndicatorRow.qml 2013-04-09 10:00:31 +0000 |
1487 | @@ -16,7 +16,8 @@ |
1488 | |
1489 | import QtQuick 2.0 |
1490 | import QtTest 1.0 |
1491 | -import "../../Panel" |
1492 | +import ".." |
1493 | +import "../../../Panel" |
1494 | import Ubuntu.ChewieUI 0.1 as ChewieUI |
1495 | |
1496 | /* |
1497 | @@ -28,24 +29,6 @@ |
1498 | width: units.gu(40) |
1499 | height: units.gu(60) |
1500 | |
1501 | - PanelBackground { |
1502 | - anchors.fill: indicatorRow |
1503 | - } |
1504 | - |
1505 | - IndicatorRow { |
1506 | - id: indicatorRow |
1507 | - anchors { |
1508 | - left: parent.left |
1509 | - right: parent.right |
1510 | - } |
1511 | - |
1512 | - indicatorsModel: indicatorModel |
1513 | - } |
1514 | - |
1515 | - ChewieUI.PluginModel { |
1516 | - id: indicatorModel |
1517 | - } |
1518 | - |
1519 | function init_test() |
1520 | { |
1521 | indicatorRow.overviewActive = false; |
1522 | @@ -54,7 +37,7 @@ |
1523 | } |
1524 | |
1525 | UnityTestCase { |
1526 | - name: "IndicatorRow" |
1527 | + name: "IndicatorRowTest" |
1528 | when: windowShown |
1529 | |
1530 | function test_set_current_item() { |
1531 | @@ -71,7 +54,7 @@ |
1532 | } |
1533 | |
1534 | UnityTestCase { |
1535 | - name: "IndicatorRow_IconPosition" |
1536 | + name: "IndicatorRow_IconPositionTest" |
1537 | when: windowShown |
1538 | |
1539 | function get_indicator_item_at(index) { |
1540 | @@ -93,7 +76,7 @@ |
1541 | } |
1542 | |
1543 | UnityTestCase { |
1544 | - name: "IndicatorRow_Highlight" |
1545 | + name: "IndicatorRow_HighlightTest" |
1546 | when: windowShown |
1547 | |
1548 | function get_indicator_item_at(index) { |
1549 | @@ -167,7 +150,7 @@ |
1550 | } |
1551 | |
1552 | UnityTestCase { |
1553 | - name: "IndicatorRow_Dimmed" |
1554 | + name: "IndicatorRow_DimmedTest" |
1555 | when: windowShown |
1556 | |
1557 | function get_indicator_item_at(index) { |
1558 | @@ -253,4 +236,21 @@ |
1559 | } |
1560 | } |
1561 | |
1562 | + PanelBackground { |
1563 | + anchors.fill: indicatorRow |
1564 | + } |
1565 | + |
1566 | + IndicatorRow { |
1567 | + id: indicatorRow |
1568 | + anchors { |
1569 | + left: parent.left |
1570 | + right: parent.right |
1571 | + } |
1572 | + |
1573 | + indicatorsModel: indicatorModel |
1574 | + } |
1575 | + |
1576 | + ChewieUI.PluginModel { |
1577 | + id: indicatorModel |
1578 | + } |
1579 | } |
1580 | |
1581 | === added file 'tests/qmluitests/Panel/tst_SearchIndicator.qml' |
1582 | --- tests/qmluitests/Panel/tst_SearchIndicator.qml 1970-01-01 00:00:00 +0000 |
1583 | +++ tests/qmluitests/Panel/tst_SearchIndicator.qml 2013-04-09 10:00:31 +0000 |
1584 | @@ -0,0 +1,63 @@ |
1585 | +/* |
1586 | + * Copyright 2013 Canonical Ltd. |
1587 | + * |
1588 | + * This program is free software; you can redistribute it and/or modify |
1589 | + * it under the terms of the GNU General Public License as published by |
1590 | + * the Free Software Foundation; version 3. |
1591 | + * |
1592 | + * This program is distributed in the hope that it will be useful, |
1593 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1594 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1595 | + * GNU General Public License for more details. |
1596 | + * |
1597 | + * You should have received a copy of the GNU General Public License |
1598 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1599 | + */ |
1600 | + |
1601 | +import QtQuick 2.0 |
1602 | +import QtTest 1.0 |
1603 | +import ".." |
1604 | +import "../../../Panel" |
1605 | +import Ubuntu.Components 0.1 |
1606 | + |
1607 | +Item { |
1608 | + width: units.gu(9) |
1609 | + height: units.gu(3) |
1610 | + |
1611 | + UnityTestCase { |
1612 | + name: "SearchIndicatorTest" |
1613 | + when: windowShown |
1614 | + |
1615 | + function test_clickedSignal() { |
1616 | + clickedSpy.clear() |
1617 | + mouseClick(searchIndicator, |
1618 | + searchIndicator.width / 2, searchIndicator.height / 2); |
1619 | + compare(clickedSpy.count, 1) |
1620 | + } |
1621 | + |
1622 | + function test_hideUp() { |
1623 | + var container = findChild(searchIndicator, "container") |
1624 | + searchIndicator.hideUp() |
1625 | + tryCompare(container, "opacity", 0) |
1626 | + tryCompare(container, "y", -container.height) |
1627 | + } |
1628 | + |
1629 | + function test_show() { |
1630 | + var container = findChild(searchIndicator, "container") |
1631 | + searchIndicator.show() |
1632 | + tryCompare(container, "opacity", 1) |
1633 | + tryCompare(container, "y", 0) |
1634 | + } |
1635 | + } |
1636 | + |
1637 | + SignalSpy { |
1638 | + id: clickedSpy |
1639 | + target: searchIndicator |
1640 | + signalName: "clicked" |
1641 | + } |
1642 | + |
1643 | + SearchIndicator { |
1644 | + id: searchIndicator |
1645 | + anchors.fill: parent |
1646 | + } |
1647 | +} |
1648 | |
1649 | === modified file 'tests/unittests/CMakeLists.txt' |
1650 | --- tests/unittests/CMakeLists.txt 2013-03-27 15:48:19 +0000 |
1651 | +++ tests/unittests/CMakeLists.txt 2013-04-09 10:00:31 +0000 |
1652 | @@ -3,9 +3,4 @@ |
1653 | set(qmltest_DEFAULT_TARGETS unittests alltests) |
1654 | set(qmltest_DEFAULT_PROPERTIES PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal") |
1655 | |
1656 | -add_qml_test(AnimationControllerWithSignals) |
1657 | -add_qml_test(Carousel) |
1658 | -add_qml_test(CrossFadeImage) |
1659 | -add_qml_test(MathLocal) |
1660 | -add_qml_test(RatingStars) |
1661 | -add_qml_test(TimeLocal) |
1662 | +add_subdirectory(Components) |
1663 | |
1664 | === added directory 'tests/unittests/Components' |
1665 | === added file 'tests/unittests/Components/CMakeLists.txt' |
1666 | --- tests/unittests/Components/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1667 | +++ tests/unittests/Components/CMakeLists.txt 2013-04-09 10:00:31 +0000 |
1668 | @@ -0,0 +1,6 @@ |
1669 | +add_qml_test(AnimationControllerWithSignals) |
1670 | +add_qml_test(Carousel) |
1671 | +add_qml_test(CrossFadeImage) |
1672 | +add_qml_test(MathLocal) |
1673 | +add_qml_test(RatingStars) |
1674 | +add_qml_test(TimeLocal) |
1675 | |
1676 | === renamed file 'tests/unittests/tst_AnimationControllerWithSignals.qml' => 'tests/unittests/Components/tst_AnimationControllerWithSignals.qml' |
1677 | --- tests/unittests/tst_AnimationControllerWithSignals.qml 2013-03-14 12:32:50 +0000 |
1678 | +++ tests/unittests/Components/tst_AnimationControllerWithSignals.qml 2013-04-09 10:00:31 +0000 |
1679 | @@ -16,14 +16,108 @@ |
1680 | |
1681 | import QtQuick 2.0 |
1682 | import QtTest 1.0 |
1683 | -import "../../Components" |
1684 | +import "../../../Components" |
1685 | |
1686 | TestCase { |
1687 | id: testCase |
1688 | - name: "AnimationControllerWithSignals" |
1689 | + name: "AnimationControllerWithSignalsTest" |
1690 | |
1691 | property real someNumber: 0.0 |
1692 | |
1693 | + function test_completeToEndWithSignal() { |
1694 | + loader.sourceComponent = testSubjectComponent; |
1695 | + var testSubject = loader.item; |
1696 | + |
1697 | + testSubject.animation = someNumberAnimation; |
1698 | + testSubject.progress = 0; |
1699 | + |
1700 | + signalSpy.signalName = "animationCompletedAtEnd"; |
1701 | + signalSpy.target = testSubject; |
1702 | + signalSpy.clear(); |
1703 | + |
1704 | + compare(testSubject.completing, false) |
1705 | + compare(testSubject.completed, true) |
1706 | + |
1707 | + testSubject.completeToEndWithSignal(); |
1708 | + compare(testSubject.completing, true) |
1709 | + compare(testSubject.completed, true) |
1710 | + compare(signalSpy.count, 0); |
1711 | + |
1712 | + testSubject.progress = 0.5; |
1713 | + compare(testSubject.completing, true) |
1714 | + compare(testSubject.completed, false) |
1715 | + compare(signalSpy.count, 0); |
1716 | + |
1717 | + testSubject.progress = 1.0; |
1718 | + compare(testSubject.completing, false) |
1719 | + compare(testSubject.completed, true) |
1720 | + compare(signalSpy.count, 1); |
1721 | + |
1722 | + testSubject.animation = null |
1723 | + loader.sourceComponent = undefined; |
1724 | + } |
1725 | + |
1726 | + function test_completeToBeginningWithSignal() { |
1727 | + loader.sourceComponent = testSubjectComponent; |
1728 | + var testSubject = loader.item; |
1729 | + |
1730 | + testSubject.animation = someNumberAnimation; |
1731 | + testSubject.progress = 1; |
1732 | + |
1733 | + signalSpy.signalName = "animationCompletedAtBeginning"; |
1734 | + signalSpy.target = testSubject; |
1735 | + signalSpy.clear(); |
1736 | + |
1737 | + compare(testSubject.completing, false) |
1738 | + compare(testSubject.completed, true) |
1739 | + |
1740 | + testSubject.completeToBeginningWithSignal(); |
1741 | + compare(testSubject.completing, true) |
1742 | + compare(testSubject.completed, true) |
1743 | + compare(signalSpy.count, 0); |
1744 | + |
1745 | + testSubject.progress = 0.5; |
1746 | + compare(testSubject.completing, true) |
1747 | + compare(testSubject.completed, false) |
1748 | + compare(signalSpy.count, 0); |
1749 | + |
1750 | + testSubject.progress = 0; |
1751 | + compare(testSubject.completing, false) |
1752 | + compare(testSubject.completed, true) |
1753 | + compare(signalSpy.count, 1); |
1754 | + |
1755 | + testSubject.animation = null |
1756 | + loader.sourceComponent = undefined; |
1757 | + } |
1758 | + |
1759 | + function test_settingProgressWithoutCallingCompleteWithSignal() { |
1760 | + loader.sourceComponent = testSubjectComponent; |
1761 | + var testSubject = loader.item; |
1762 | + |
1763 | + testSubject.animation = someNumberAnimation; |
1764 | + testSubject.progress = 0; |
1765 | + |
1766 | + signalSpy.signalName = "animationCompletedAtEnd"; |
1767 | + signalSpy.target = testSubject; |
1768 | + signalSpy.clear(); |
1769 | + |
1770 | + compare(testSubject.completing, false) |
1771 | + compare(testSubject.completed, true) |
1772 | + |
1773 | + testSubject.progress = 0.5; |
1774 | + compare(testSubject.completing, false) |
1775 | + compare(testSubject.completed, false) |
1776 | + compare(signalSpy.count, 0); |
1777 | + |
1778 | + testSubject.progress = 1; |
1779 | + compare(testSubject.completing, false) |
1780 | + compare(testSubject.completed, true) |
1781 | + compare(signalSpy.count, 0); |
1782 | + |
1783 | + testSubject.animation = null |
1784 | + loader.sourceComponent = undefined; |
1785 | + } |
1786 | + |
1787 | NumberAnimation { |
1788 | id: someNumberAnimation |
1789 | target: testCase |
1790 | @@ -45,99 +139,4 @@ |
1791 | SignalSpy { |
1792 | id: signalSpy |
1793 | } |
1794 | - |
1795 | - function test_completeToEndWithSignal() { |
1796 | - loader.sourceComponent = testSubjectComponent; |
1797 | - var testSubject = loader.item; |
1798 | - |
1799 | - testSubject.animation = someNumberAnimation; |
1800 | - testSubject.progress = 0; |
1801 | - |
1802 | - signalSpy.signalName = "animationCompletedAtEnd"; |
1803 | - signalSpy.target = testSubject; |
1804 | - signalSpy.clear(); |
1805 | - |
1806 | - compare(testSubject.completing, false) |
1807 | - compare(testSubject.completed, true) |
1808 | - |
1809 | - testSubject.completeToEndWithSignal(); |
1810 | - compare(testSubject.completing, true) |
1811 | - compare(testSubject.completed, true) |
1812 | - compare(signalSpy.count, 0); |
1813 | - |
1814 | - testSubject.progress = 0.5; |
1815 | - compare(testSubject.completing, true) |
1816 | - compare(testSubject.completed, false) |
1817 | - compare(signalSpy.count, 0); |
1818 | - |
1819 | - testSubject.progress = 1.0; |
1820 | - compare(testSubject.completing, false) |
1821 | - compare(testSubject.completed, true) |
1822 | - compare(signalSpy.count, 1); |
1823 | - |
1824 | - testSubject.animation = null |
1825 | - loader.sourceComponent = undefined; |
1826 | - } |
1827 | - |
1828 | - function test_completeToBeginningWithSignal() { |
1829 | - loader.sourceComponent = testSubjectComponent; |
1830 | - var testSubject = loader.item; |
1831 | - |
1832 | - testSubject.animation = someNumberAnimation; |
1833 | - testSubject.progress = 1; |
1834 | - |
1835 | - signalSpy.signalName = "animationCompletedAtBeginning"; |
1836 | - signalSpy.target = testSubject; |
1837 | - signalSpy.clear(); |
1838 | - |
1839 | - compare(testSubject.completing, false) |
1840 | - compare(testSubject.completed, true) |
1841 | - |
1842 | - testSubject.completeToBeginningWithSignal(); |
1843 | - compare(testSubject.completing, true) |
1844 | - compare(testSubject.completed, true) |
1845 | - compare(signalSpy.count, 0); |
1846 | - |
1847 | - testSubject.progress = 0.5; |
1848 | - compare(testSubject.completing, true) |
1849 | - compare(testSubject.completed, false) |
1850 | - compare(signalSpy.count, 0); |
1851 | - |
1852 | - testSubject.progress = 0; |
1853 | - compare(testSubject.completing, false) |
1854 | - compare(testSubject.completed, true) |
1855 | - compare(signalSpy.count, 1); |
1856 | - |
1857 | - testSubject.animation = null |
1858 | - loader.sourceComponent = undefined; |
1859 | - } |
1860 | - |
1861 | - function test_settingProgressWithoutCallingCompleteWithSignal() { |
1862 | - loader.sourceComponent = testSubjectComponent; |
1863 | - var testSubject = loader.item; |
1864 | - |
1865 | - testSubject.animation = someNumberAnimation; |
1866 | - testSubject.progress = 0; |
1867 | - |
1868 | - signalSpy.signalName = "animationCompletedAtEnd"; |
1869 | - signalSpy.target = testSubject; |
1870 | - signalSpy.clear(); |
1871 | - |
1872 | - compare(testSubject.completing, false) |
1873 | - compare(testSubject.completed, true) |
1874 | - |
1875 | - testSubject.progress = 0.5; |
1876 | - compare(testSubject.completing, false) |
1877 | - compare(testSubject.completed, false) |
1878 | - compare(signalSpy.count, 0); |
1879 | - |
1880 | - testSubject.progress = 1; |
1881 | - compare(testSubject.completing, false) |
1882 | - compare(testSubject.completed, true) |
1883 | - compare(signalSpy.count, 0); |
1884 | - |
1885 | - testSubject.animation = null |
1886 | - loader.sourceComponent = undefined; |
1887 | - } |
1888 | } |
1889 | - |
1890 | |
1891 | === renamed file 'tests/unittests/tst_Carousel.qml' => 'tests/unittests/Components/tst_Carousel.qml' |
1892 | --- tests/unittests/tst_Carousel.qml 2013-03-28 09:50:26 +0000 |
1893 | +++ tests/unittests/Components/tst_Carousel.qml 2013-04-09 10:00:31 +0000 |
1894 | @@ -16,7 +16,7 @@ |
1895 | |
1896 | import QtQuick 2.0 |
1897 | import QtTest 1.0 |
1898 | -import "../../Components/carousel.js" as Carousel |
1899 | +import "../../../Components/carousel.js" as Carousel |
1900 | |
1901 | TestCase { |
1902 | name: "CarouselTest" |
1903 | |
1904 | === renamed file 'tests/unittests/tst_CrossFadeImage.qml' => 'tests/unittests/Components/tst_CrossFadeImage.qml' |
1905 | --- tests/unittests/tst_CrossFadeImage.qml 2013-03-13 22:58:26 +0000 |
1906 | +++ tests/unittests/Components/tst_CrossFadeImage.qml 2013-04-09 10:00:31 +0000 |
1907 | @@ -16,7 +16,7 @@ |
1908 | |
1909 | import QtQuick 2.0 |
1910 | import QtTest 1.0 |
1911 | -import "../../Components" |
1912 | +import "../../../Components" |
1913 | |
1914 | TestCase { |
1915 | name: "CrossFadeImageTest" |
1916 | @@ -33,11 +33,11 @@ |
1917 | fadeInFirst = argFadeInFirst |
1918 | compare(status, Image.Null, "Could not reset CrossFadeImage") |
1919 | } |
1920 | - |
1921 | + |
1922 | function loadImage(url) { |
1923 | console.log("Loading image...") |
1924 | source = url |
1925 | - |
1926 | + |
1927 | signalSpy.signalName = "statusChanged" |
1928 | signalSpy.wait() |
1929 | |
1930 | @@ -45,7 +45,7 @@ |
1931 | signalSpy.clear() |
1932 | signalSpy.wait() |
1933 | } |
1934 | - |
1935 | + |
1936 | if (status == Image.Loading) { |
1937 | signalSpy.clear() |
1938 | signalSpy.wait() |
1939 | @@ -54,7 +54,7 @@ |
1940 | compare(status, Image.Ready, "Image not ready") |
1941 | console.log("Image loaded.") |
1942 | } |
1943 | - |
1944 | + |
1945 | function waitForAnimation() { |
1946 | signalSpy.signalName = "runningChanged" |
1947 | |
1948 | @@ -63,7 +63,7 @@ |
1949 | signalSpy.wait() |
1950 | compare(running, true, "Animation did not start") |
1951 | } |
1952 | - |
1953 | + |
1954 | signalSpy.clear() |
1955 | console.log("Waiting for animation to finish...") |
1956 | signalSpy.wait() |
1957 | @@ -74,31 +74,31 @@ |
1958 | compare(running, false, "Animation is running after testcase") |
1959 | compare(crossFadeImage.__nextImage.source, "", "nextimage source is not reset") |
1960 | } |
1961 | - |
1962 | + |
1963 | function test_fadeFirst() { |
1964 | initTestFunction(true, true) |
1965 | |
1966 | - loadImage("../../graphics/phone_background.jpg") |
1967 | + loadImage("../../../graphics/phone_background.jpg") |
1968 | |
1969 | waitForAnimation() |
1970 | - |
1971 | + |
1972 | cleanupTest() |
1973 | } |
1974 | |
1975 | function test_no_fadeFirst() { |
1976 | initTestFunction(true, false) |
1977 | - |
1978 | - loadImage("../../graphics/phone_background.jpg") |
1979 | - |
1980 | + |
1981 | + loadImage("../../../graphics/phone_background.jpg") |
1982 | + |
1983 | cleanupTest() |
1984 | } |
1985 | - |
1986 | + |
1987 | function test_crossFade() { |
1988 | initTestFunction(true, false) |
1989 | |
1990 | - loadImage("../../graphics/phone_background.jpg") |
1991 | - |
1992 | - loadImage("../../graphics/tablet_background.jpg") |
1993 | + loadImage("../../../graphics/phone_background.jpg") |
1994 | + |
1995 | + loadImage("../../../graphics/tablet_background.jpg") |
1996 | |
1997 | // Due to the internal implementation, __currentImage and __nextImage are swapped before the animation starts |
1998 | // Make sure z order reflects that too. |
1999 | @@ -107,12 +107,11 @@ |
2000 | compare(crossFadeImage.__nextImage.opacity > 0.5, true) |
2001 | |
2002 | waitForAnimation() |
2003 | - |
2004 | + |
2005 | compare(crossFadeImage.__currentImage.opacity > 0.5, true) |
2006 | compare(crossFadeImage.__nextImage.opacity < 0.5, true) |
2007 | - |
2008 | + |
2009 | cleanupTest() |
2010 | - |
2011 | } |
2012 | |
2013 | CrossFadeImage { |
2014 | |
2015 | === renamed file 'tests/unittests/tst_MathLocal.qml' => 'tests/unittests/Components/tst_MathLocal.qml' |
2016 | --- tests/unittests/tst_MathLocal.qml 2013-02-27 20:06:20 +0000 |
2017 | +++ tests/unittests/Components/tst_MathLocal.qml 2013-04-09 10:00:31 +0000 |
2018 | @@ -16,7 +16,7 @@ |
2019 | |
2020 | import QtQuick 2.0 |
2021 | import QtTest 1.0 |
2022 | -import "../../Components/Math.js" as MathLocal |
2023 | +import "../../../Components/Math.js" as MathLocal |
2024 | |
2025 | TestCase { |
2026 | name: "MathLocalTest" |
2027 | |
2028 | === renamed file 'tests/unittests/tst_RatingStars.qml' => 'tests/unittests/Components/tst_RatingStars.qml' |
2029 | --- tests/unittests/tst_RatingStars.qml 2013-02-27 20:06:20 +0000 |
2030 | +++ tests/unittests/Components/tst_RatingStars.qml 2013-04-09 10:00:31 +0000 |
2031 | @@ -16,7 +16,7 @@ |
2032 | |
2033 | import QtQuick 2.0 |
2034 | import QtTest 1.0 |
2035 | -import "../../Components" |
2036 | +import "../../../Components" |
2037 | |
2038 | TestCase { |
2039 | name: "RatingStarsTest" |
2040 | |
2041 | === renamed file 'tests/unittests/tst_TimeLocal.qml' => 'tests/unittests/Components/tst_TimeLocal.qml' |
2042 | --- tests/unittests/tst_TimeLocal.qml 2013-03-11 13:07:33 +0000 |
2043 | +++ tests/unittests/Components/tst_TimeLocal.qml 2013-04-09 10:00:31 +0000 |
2044 | @@ -16,7 +16,7 @@ |
2045 | |
2046 | import QtQuick 2.0 |
2047 | import QtTest 1.0 |
2048 | -import "../../Components/Time.js" as TimeLocal |
2049 | +import "../../../Components/Time.js" as TimeLocal |
2050 | |
2051 | TestCase { |
2052 | name: "TimeLocalTest" |
FAILED: Continuous integration, rev:554 jenkins. qa.ubuntu. com/job/ unity-phablet- ci/328/ s-jenkins: 8080/job/ unity-phablet- qmluitests/ 60/console jenkins. qa.ubuntu. com/job/ unity-phablet- quantal- armhf-ci/ 329/console jenkins. qa.ubuntu. com/job/ unity-phablet- quantal- i386-ci/ 328/console jenkins. qa.ubuntu. com/job/ unity-phablet- raring- armhf-ci/ 204/console jenkins. qa.ubuntu. com/job/ unity-phablet- raring- i386-ci/ 204/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ unity-phablet- ci/328/ rebuild
http://