Merge lp:~unity-team/unity/phablet.test_responsiveflowview into lp:unity/phablet

Proposed by Andrea Cimitan
Status: Superseded
Proposed branch: lp:~unity-team/unity/phablet.test_responsiveflowview
Merge into: lp:unity/phablet
Diff against target: 2201 lines (+915/-698)
32 files modified
Components/ResponsiveFlowView.qml (+18/-0)
tests/qmluitests/CMakeLists.txt (+5/-14)
tests/qmluitests/Components/CMakeLists.txt (+8/-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_ResponsiveFlowView.qml (+191/-0)
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 (+1/-0)
tests/qmluitests/Panel/tst_IndicatorRow.qml (+23/-23)
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_responsiveflowview
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Albert Astals Cid (community) Needs Fixing
Review via email: mp+157343@code.launchpad.net

This proposal has been superseded by a proposal from 2013-04-09.

Commit message

Adds tests for ResponsiveFlowView, adapting from ResponsiveGridView

Description of the change

Adds tests for ResponsiveFlowView, adapting from ResponsiveGridView

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Change ResponsiveGridView -> Change ResponsiveFlowView

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

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

Subscribers

People subscribed via source and target branches

to all changes: