Merge lp:~unity-team/unity/phablet.test_Panel-searchIndicator into lp:unity/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
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
=== modified file 'Panel/SearchIndicator.qml'
--- Panel/SearchIndicator.qml 2013-03-26 15:45:37 +0000
+++ Panel/SearchIndicator.qml 2013-04-09 10:00:31 +0000
@@ -43,6 +43,7 @@
4343
44 Item {44 Item {
45 id: container45 id: container
46 objectName: "container"
4647
47 width: parent.width48 width: parent.width
48 height: parent.height49 height: parent.height
4950
=== modified file 'tests/qmluitests/CMakeLists.txt'
--- tests/qmluitests/CMakeLists.txt 2013-04-08 11:52:36 +0000
+++ tests/qmluitests/CMakeLists.txt 2013-04-09 10:00:31 +0000
@@ -1,19 +1,10 @@
1add_subdirectory(qml)
2
3add_custom_target(qmluitests)1add_custom_target(qmluitests)
42
5set(qmltest_DEFAULT_TARGETS qmluitests alltests)3set(qmltest_DEFAULT_TARGETS qmluitests alltests)
6set(qmltest_DEFAULT_NO_ADD_TEST TRUE)4set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
75
8add_qml_test(DashPreview)6add_subdirectory(Components)
9add_qml_test(DraggingArea)7add_subdirectory(Dash)
10add_qml_test(FilterGrid IMPORT_PATH ${CMAKE_BINARY_DIR}/plugins)8add_subdirectory(Greeter)
11add_qml_test(Greeter)9add_subdirectory(Hud)
12add_qml_test(Hud IMPORT_PATH ${CMAKE_CURRENT_BINARY_DIR}/qml)10add_subdirectory(Panel)
13add_qml_test(IndicatorRow IMPORT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/qml)
14add_qml_test(Launcher)
15add_qml_test(ResponsiveGridView)
16add_qml_test(Revealer)
17add_qml_test(Showable)
18add_qml_test(Stage)
19add_qml_test(Tile)
2011
=== added directory 'tests/qmluitests/Components'
=== added file 'tests/qmluitests/Components/CMakeLists.txt'
--- tests/qmluitests/Components/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Components/CMakeLists.txt 2013-04-09 10:00:31 +0000
@@ -0,0 +1,7 @@
1add_qml_test(DraggingArea)
2add_qml_test(FilterGrid IMPORT_PATH ${CMAKE_BINARY_DIR}/plugins)
3add_qml_test(ResponsiveGridView)
4add_qml_test(Revealer)
5add_qml_test(Showable)
6add_qml_test(Stage)
7add_qml_test(Tile)
08
=== renamed file 'tests/qmluitests/RevealingRectangle.qml' => 'tests/qmluitests/Components/RevealingRectangle.qml'
--- tests/qmluitests/RevealingRectangle.qml 2013-03-19 12:06:15 +0000
+++ tests/qmluitests/Components/RevealingRectangle.qml 2013-04-09 10:00:31 +0000
@@ -16,7 +16,7 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import Ubuntu.Components 0.118import Ubuntu.Components 0.1
19import "../../Components"19import "../../../Components"
2020
21Item {21Item {
22 id: revealingRectangle22 id: revealingRectangle
2323
=== renamed file 'tests/qmluitests/tst_DraggingArea.qml' => 'tests/qmluitests/Components/tst_DraggingArea.qml'
--- tests/qmluitests/tst_DraggingArea.qml 2013-03-15 15:34:06 +0000
+++ tests/qmluitests/Components/tst_DraggingArea.qml 2013-04-09 10:00:31 +0000
@@ -16,7 +16,7 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Components"19import "../../../Components"
2020
21/*21/*
22 There will be a green rectangle in the center of the22 There will be a green rectangle in the center of the
@@ -35,6 +35,85 @@
35 property int dragStartCount: 035 property int dragStartCount: 0
36 property int dragEndCount: 036 property int dragEndCount: 0
3737
38 TestCase {
39 name: "DraggingAreaTest"
40 when: windowShown
41
42 function test_horizontalDrag() {
43 draggingArea.orientation = Qt.Horizontal;
44
45 dragStartCount = 0
46 dragEndCount = 0
47
48 compare(draggingArea.dragging, false);
49
50 // (item, x, y, button, modifiers, delay)
51 mousePress(draggingArea,
52 25, 25,
53 Qt.LeftButton, Qt.NoModifier, 0);
54
55 compare(draggingArea.dragging, false);
56 compare(dragStartCount, 0);
57 compare(dragEndCount, 0);
58
59 // (item, x, y, delay, button)
60 mouseMove(draggingArea,
61 -100, 25,
62 0, Qt.LeftButton);
63
64 compare(draggingArea.dragging, true);
65 compare(draggingArea.dragValue, -125);
66 compare(dragStartCount, 1);
67 compare(dragEndCount, 0);
68
69 // (item, x, y, button, modifiers, delay)
70 mouseRelease(draggingArea,
71 -100, 25,
72 Qt.LeftButton, Qt.NoModifier, 0);
73
74 compare(draggingArea.dragging, false);
75 compare(dragStartCount, 1);
76 compare(dragEndCount, 1);
77 }
78
79 function test_verticalDrag() {
80 draggingArea.orientation = Qt.Vertical;
81
82 dragStartCount = 0
83 dragEndCount = 0
84
85 compare(draggingArea.dragging, false);
86
87 // (item, x, y, button, modifiers, delay)
88 mousePress(draggingArea,
89 25, 25,
90 Qt.LeftButton, Qt.NoModifier, 0);
91
92 compare(draggingArea.dragging, false);
93 compare(dragStartCount, 0);
94 compare(dragEndCount, 0);
95
96 // (item, x, y, delay, button)
97 mouseMove(draggingArea,
98 25, 125,
99 0, Qt.LeftButton);
100
101 compare(draggingArea.dragging, true);
102 compare(draggingArea.dragValue, 100);
103 compare(dragStartCount, 1);
104 compare(dragEndCount, 0);
105
106 // (item, x, y, button, modifiers, delay)
107 mouseRelease(draggingArea,
108 25, 125,
109 Qt.LeftButton, Qt.NoModifier, 0);
110
111 compare(draggingArea.dragging, false);
112 compare(dragStartCount, 1);
113 compare(dragEndCount, 1);
114 }
115 }
116
38 Column {117 Column {
39 anchors.left: parent.left118 anchors.left: parent.left
40 anchors.top: parent.top119 anchors.top: parent.top
@@ -102,83 +181,4 @@
102 onDragEnd : { ++root.dragEndCount }181 onDragEnd : { ++root.dragEndCount }
103 }182 }
104 }183 }
105
106 TestCase {
107 name: "DraggingArea"
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}184}
185185
=== renamed file 'tests/qmluitests/tst_FilterGrid.qml' => 'tests/qmluitests/Components/tst_FilterGrid.qml'
--- tests/qmluitests/tst_FilterGrid.qml 2013-03-18 15:49:03 +0000
+++ tests/qmluitests/Components/tst_FilterGrid.qml 2013-04-09 10:00:31 +0000
@@ -16,7 +16,7 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Components"19import "../../../Components"
20import Ubuntu.Components.ListItems 0.1 as ListItem20import Ubuntu.Components.ListItems 0.1 as ListItem
21import Ubuntu.Components 0.121import Ubuntu.Components 0.1
2222
@@ -30,6 +30,87 @@
30 height: units.gu(50)30 height: units.gu(50)
31 color: "white"31 color: "white"
3232
33 TestCase {
34 name: "FilterGridTest"
35 when: windowShown
36
37 function test_turningFilterOffShowsAllElements() {
38 compare(countVisibleDelegates(), 6)
39
40 filterCheckBox.checked = false
41
42 // wait for animations to complete
43 tryCompare(filterGrid.__expansionAnimation, "running", false)
44 compare(countVisibleDelegates(), 12)
45
46 // back to initial state
47 filterCheckBox.checked = true
48 // wait for animations to complete
49 tryCompare(filterGrid.__expansionAnimation, "running", false)
50 }
51
52 function test_collapsedRowCount() {
53 for (var i = 0; i < 4; ++i) {
54 collapsedRowCountSelector.selectedIndex = i
55 // wait for animations to complete
56 tryCompare(filterGrid.__expansionAnimation, "running", false)
57 // We have 3 elements per row.
58 // row count == index + 1
59 compare(countVisibleDelegates(), 3*(i+1))
60 }
61
62 // back to initial state
63 collapsedRowCountSelector.selectedIndex = 1
64 // wait for animations to complete
65 tryCompare(filterGrid.__expansionAnimation, "running", false)
66 }
67
68 // Checks that the filter toggle button, the one that says "View All (xy)",
69 // shows up only when it's possible for the grid to be expanded.
70 function test_filterToggleButton() {
71 var filterToggleButton = filterGrid.__filterToggleButton
72
73 for (var i = 0; i < 4; ++i) {
74 collapsedRowCountSelector.selectedIndex = i
75 // wait for animations to complete
76 tryCompare(filterGrid.__expansionAnimation, "running", false)
77 // row count == index + 1
78 // The total number of rows is 4.
79
80 expandableCheckBox.checked = false
81 compare(filterToggleButton.visible, false)
82 expandableCheckBox.checked = true
83
84 if ((i+1) < 4)
85 compare(filterToggleButton.visible, true)
86 else
87 compare(filterToggleButton.visible, false)
88 }
89
90 // back to initial state
91 collapsedRowCountSelector.selectedIndex = 1
92 expandableCheckBox.checked = true
93 // wait for animations to complete
94 tryCompare(filterGrid.__expansionAnimation, "running", false)
95 }
96
97 function countVisibleDelegates() {
98 return __countVisibleDelegates(filterGrid.visibleChildren, 0)
99 }
100
101 function __countVisibleDelegates(objList, total) {
102 for (var i = 0; i < objList.length; ++i) {
103 var child = objList[i];
104 if (child.isGridDelegate !== undefined) {
105 ++total;
106 } else {
107 total = __countVisibleDelegates(child.visibleChildren, total)
108 }
109 }
110 return total
111 }
112 }
113
33 Column {114 Column {
34 id: controls115 id: controls
35 width: units.gu(30)116 width: units.gu(30)
@@ -114,89 +195,5 @@
114 }195 }
115 }196 }
116 }197 }
117
118 TestCase {
119 name: "FilterGrid"
120 when: windowShown
121
122 function test_turningFilterOffShowsAllElements() {
123 compare(countVisibleDelegates(), 6)
124
125 filterCheckBox.checked = false
126
127 // wait for animations to complete
128 tryCompare(filterGrid.__expansionAnimation, "running", false)
129 compare(countVisibleDelegates(), 12)
130
131 // back to initial state
132 filterCheckBox.checked = true
133 // wait for animations to complete
134 tryCompare(filterGrid.__expansionAnimation, "running", false)
135 }
136
137 function test_collapsedRowCount() {
138
139 for (var i = 0; i < 4; ++i) {
140 collapsedRowCountSelector.selectedIndex = i
141 // wait for animations to complete
142 tryCompare(filterGrid.__expansionAnimation, "running", false)
143 // We have 3 elements per row.
144 // row count == index + 1
145 compare(countVisibleDelegates(), 3*(i+1))
146 }
147
148 // back to initial state
149 collapsedRowCountSelector.selectedIndex = 1
150 // wait for animations to complete
151 tryCompare(filterGrid.__expansionAnimation, "running", false)
152 }
153
154 // Checks that the filter toggle button, the one that says "View All (xy)",
155 // shows up only when it's possible for the grid to be expanded.
156 function test_filterToggleButton() {
157
158 var filterToggleButton = filterGrid.__filterToggleButton
159
160 for (var i = 0; i < 4; ++i) {
161 collapsedRowCountSelector.selectedIndex = i
162 // wait for animations to complete
163 tryCompare(filterGrid.__expansionAnimation, "running", false)
164 // row count == index + 1
165 // The total number of rows is 4.
166
167 expandableCheckBox.checked = false
168 compare(filterToggleButton.visible, false)
169 expandableCheckBox.checked = true
170
171 if ((i+1) < 4)
172 compare(filterToggleButton.visible, true)
173 else
174 compare(filterToggleButton.visible, false)
175 }
176
177 // back to initial state
178 collapsedRowCountSelector.selectedIndex = 1
179 expandableCheckBox.checked = true
180 // wait for animations to complete
181 tryCompare(filterGrid.__expansionAnimation, "running", false)
182 }
183
184 function countVisibleDelegates() {
185 return __countVisibleDelegates(filterGrid.visibleChildren, 0)
186 }
187
188 function __countVisibleDelegates(objList, total) {
189 for (var i = 0; i < objList.length; ++i) {
190 var child = objList[i];
191 if (child.isGridDelegate !== undefined) {
192 ++total;
193 } else {
194 total = __countVisibleDelegates(child.visibleChildren, total)
195 }
196 }
197 return total
198 }
199
200 }
201}198}
202199
203200
=== renamed file 'tests/qmluitests/tst_ResponsiveGridView.qml' => 'tests/qmluitests/Components/tst_ResponsiveGridView.qml'
--- tests/qmluitests/tst_ResponsiveGridView.qml 2013-03-20 10:59:28 +0000
+++ tests/qmluitests/Components/tst_ResponsiveGridView.qml 2013-04-09 10:00:31 +0000
@@ -16,7 +16,8 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Components"19import ".."
20import "../../../Components"
20import Ubuntu.Components.ListItems 0.1 as ListItem21import Ubuntu.Components.ListItems 0.1 as ListItem
21import Ubuntu.Components 0.122import Ubuntu.Components 0.1
2223
@@ -24,6 +25,78 @@
24 width: gridRect.width + controls.width25 width: gridRect.width + controls.width
25 height: units.gu(80)26 height: units.gu(80)
2627
28 UnityTestCase {
29 name: "ResponsiveGridViewTest"
30 when: windowShown
31
32 function test_maximumNumberOfColumns_data() {
33 var data = new Array()
34
35 data.push({selectedIndex: 0, maxColumnCount:2, columnCount: 2})
36 data.push({selectedIndex: 1, maxColumnCount:4, columnCount: 4})
37 data.push({selectedIndex: 2, maxColumnCount:8, columnCount: 8})
38 data.push({selectedIndex: 4, maxColumnCount:1000, columnCount: 13})
39
40 return data
41 }
42
43 /* Change ResponsiveGridView's maximumNumberOfColumns property and check
44 that the resulting number of columns matches expectations */
45 function test_maximumNumberOfColumns(data) {
46 minHSpacingSelector.selectedIndex = 0
47
48 // sanity checks
49 compare(maxColumnsSelector.values[data.selectedIndex], data.maxColumnCount)
50 compare(minHSpacingSelector.values[0], 0)
51
52 maxColumnsSelector.selectedIndex = data.selectedIndex
53 tryCompareFunction(countGridDelegatesOnFirstRow, data.columnCount);
54 compare(grid.columns, data.columnCount)
55 }
56
57 function test_minimumHorizontalSpacing_data() {
58 var data = new Array()
59
60 data.push({selectedIndex: 0, minHSpacing:0, columnCount: 13})
61 data.push({selectedIndex: 1, minHSpacing:units.gu(2), columnCount: 9})
62 data.push({selectedIndex: 2, minHSpacing:units.gu(8), columnCount: 5})
63 data.push({selectedIndex: 3, minHSpacing:units.gu(25), columnCount: 2})
64
65 return data
66 }
67
68 /* Change ResponsiveGridView's minimumHorizontalSpacing property and check
69 that the resulting number of columns matches expectations */
70 function test_minimumHorizontalSpacing(data) {
71 maxColumnsSelector.selectedIndex = 4
72
73 // sanity checks
74 compare(maxColumnsSelector.values[4], 1000)
75 compare(minHSpacingSelector.values[data.selectedIndex], data.minHSpacing)
76
77 minHSpacingSelector.selectedIndex = data.selectedIndex
78 tryCompareFunction(countGridDelegatesOnFirstRow, data.columnCount);
79 compare(grid.columns, data.columnCount)
80 }
81
82
83 function countGridDelegatesOnFirstRow() {
84 return __countGridDelegatesOnFirstRow(grid.visibleChildren, 0)
85 }
86
87 function __countGridDelegatesOnFirstRow(objList, total) {
88 for (var i = 0; i < objList.length; ++i) {
89 var child = objList[i];
90 if (child.isGridDelegate !== undefined && child.y === 0) {
91 ++total;
92 } else {
93 total = __countGridDelegatesOnFirstRow(child.visibleChildren, total)
94 }
95 }
96 return total
97 }
98 }
99
27 Column {100 Column {
28 id: controls101 id: controls
29 width: units.gu(40)102 width: units.gu(40)
@@ -116,76 +189,4 @@
116 }189 }
117 }190 }
118 }191 }
119
120 UnityTestCase {
121 name: "ResponsiveGridView"
122 when: windowShown
123
124 function test_maximumNumberOfColumns_data() {
125 var data = new Array()
126
127 data.push({selectedIndex: 0, maxColumnCount:2, columnCount: 2})
128 data.push({selectedIndex: 1, maxColumnCount:4, columnCount: 4})
129 data.push({selectedIndex: 2, maxColumnCount:8, columnCount: 8})
130 data.push({selectedIndex: 4, maxColumnCount:1000, columnCount: 13})
131
132 return data
133 }
134
135 /* Change ResponsiveGridView's maximumNumberOfColumns property and check
136 that the resulting number of columns matches expectations */
137 function test_maximumNumberOfColumns(data) {
138 minHSpacingSelector.selectedIndex = 0
139
140 // sanity checks
141 compare(maxColumnsSelector.values[data.selectedIndex], data.maxColumnCount)
142 compare(minHSpacingSelector.values[0], 0)
143
144 maxColumnsSelector.selectedIndex = data.selectedIndex
145 tryCompareFunction(countGridDelegatesOnFirstRow, data.columnCount);
146 compare(grid.columns, data.columnCount)
147 }
148
149 function test_minimumHorizontalSpacing_data() {
150 var data = new Array()
151
152 data.push({selectedIndex: 0, minHSpacing:0, columnCount: 13})
153 data.push({selectedIndex: 1, minHSpacing:units.gu(2), columnCount: 9})
154 data.push({selectedIndex: 2, minHSpacing:units.gu(8), columnCount: 5})
155 data.push({selectedIndex: 3, minHSpacing:units.gu(25), columnCount: 2})
156
157 return data
158 }
159
160 /* Change ResponsiveGridView's minimumHorizontalSpacing property and check
161 that the resulting number of columns matches expectations */
162 function test_minimumHorizontalSpacing(data) {
163 maxColumnsSelector.selectedIndex = 4
164
165 // sanity checks
166 compare(maxColumnsSelector.values[4], 1000)
167 compare(minHSpacingSelector.values[data.selectedIndex], data.minHSpacing)
168
169 minHSpacingSelector.selectedIndex = data.selectedIndex
170 tryCompareFunction(countGridDelegatesOnFirstRow, data.columnCount);
171 compare(grid.columns, data.columnCount)
172 }
173
174
175 function countGridDelegatesOnFirstRow() {
176 return __countGridDelegatesOnFirstRow(grid.visibleChildren, 0)
177 }
178
179 function __countGridDelegatesOnFirstRow(objList, total) {
180 for (var i = 0; i < objList.length; ++i) {
181 var child = objList[i];
182 if (child.isGridDelegate !== undefined && child.y === 0) {
183 ++total;
184 } else {
185 total = __countGridDelegatesOnFirstRow(child.visibleChildren, total)
186 }
187 }
188 return total
189 }
190 }
191}192}
192193
=== renamed file 'tests/qmluitests/tst_Revealer.qml' => 'tests/qmluitests/Components/tst_Revealer.qml'
--- tests/qmluitests/tst_Revealer.qml 2013-03-19 12:19:11 +0000
+++ tests/qmluitests/Components/tst_Revealer.qml 2013-04-09 10:00:31 +0000
@@ -16,6 +16,7 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import ".."
1920
20/*21/*
21 There's a revealer on each window edge. If you press and hold any edge you22 There's a revealer on each window edge. If you press and hold any edge you
@@ -31,36 +32,8 @@
31 width: units.gu(75)32 width: units.gu(75)
32 height: units.gu(50)33 height: units.gu(50)
3334
34 RevealingRectangle {
35 id: topRevealingRectangle
36 anchors.fill: parent
37 orientation: Qt.Vertical
38 direction: Qt.LeftToRight
39 }
40
41 RevealingRectangle {
42 id: bottomRevealingRectangle
43 anchors.fill: parent
44 orientation: Qt.Vertical
45 direction: Qt.RightToLeft
46 }
47
48 RevealingRectangle {
49 id: leftRevealingRectangle
50 anchors.fill: parent
51 orientation: Qt.Horizontal
52 direction: Qt.LeftToRight
53 }
54
55 RevealingRectangle {
56 id: rightRevealingRectangle
57 anchors.fill: parent
58 orientation: Qt.Horizontal
59 direction: Qt.RightToLeft
60 }
61
62 UnityTestCase {35 UnityTestCase {
63 name: "Revealer"36 name: "RevealerTest"
64 when: windowShown37 when: windowShown
6538
66 /*39 /*
@@ -258,5 +231,33 @@
258 tryCompare(showable, "y", -showable.height)231 tryCompare(showable, "y", -showable.height)
259 }232 }
260 }233 }
234
235 RevealingRectangle {
236 id: topRevealingRectangle
237 anchors.fill: parent
238 orientation: Qt.Vertical
239 direction: Qt.LeftToRight
240 }
241
242 RevealingRectangle {
243 id: bottomRevealingRectangle
244 anchors.fill: parent
245 orientation: Qt.Vertical
246 direction: Qt.RightToLeft
247 }
248
249 RevealingRectangle {
250 id: leftRevealingRectangle
251 anchors.fill: parent
252 orientation: Qt.Horizontal
253 direction: Qt.LeftToRight
254 }
255
256 RevealingRectangle {
257 id: rightRevealingRectangle
258 anchors.fill: parent
259 orientation: Qt.Horizontal
260 direction: Qt.RightToLeft
261 }
261}262}
262263
263264
=== renamed file 'tests/qmluitests/tst_Showable.qml' => 'tests/qmluitests/Components/tst_Showable.qml'
--- tests/qmluitests/tst_Showable.qml 2013-04-02 10:45:33 +0000
+++ tests/qmluitests/Components/tst_Showable.qml 2013-04-09 10:00:31 +0000
@@ -17,7 +17,8 @@
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import Ubuntu.Components 0.119import Ubuntu.Components 0.1
20import "../../Components"20import ".."
21import "../../../Components"
2122
22/*23/*
23 There will be 3 stacked rectangles, red, green & blue. Initially they24 There will be 3 stacked rectangles, red, green & blue. Initially they
@@ -31,77 +32,8 @@
31 width: units.gu(40)32 width: units.gu(40)
32 height: units.gu(60)33 height: units.gu(60)
3334
34 Showable {
35 id: show1
36 anchors.left: parent.left
37 anchors.top: parent.top
38 anchors.right: parent.right
39 height: units.gu(20)
40
41 opacity: 0.2
42 shown: false
43 hides: [show2, show3]
44 showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic }
45 hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic }
46
47 Rectangle {
48 anchors.fill: parent
49 color: "red"
50 }
51 MouseArea {
52 anchors.fill: parent
53 onClicked: { parent.show() }
54 }
55 }
56
57 Showable {
58 id: show2
59 anchors.left: parent.left
60 anchors.top: show1.bottom
61 anchors.right: parent.right
62 height: units.gu(20)
63
64 opacity: 0.2
65 shown: false
66 hides: [show1, show3]
67 showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic }
68 hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic }
69
70 Rectangle {
71 anchors.fill: parent
72 color: "green"
73 }
74 MouseArea {
75 anchors.fill: parent
76 onClicked: { parent.show() }
77 }
78 }
79
80 Showable {
81 id: show3
82 anchors.left: parent.left
83 anchors.top: show2.bottom
84 anchors.right: parent.right
85 anchors.bottom: parent.bottom
86
87 opacity: 0.1
88 shown: false
89 hides: [show1, show2]
90 showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic }
91 hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic }
92
93 Rectangle {
94 anchors.fill: parent
95 color: "blue"
96 }
97 MouseArea {
98 anchors.fill: parent
99 onClicked: { parent.show() }
100 }
101 }
102
103 UnityTestCase {35 UnityTestCase {
104 name: "Showable"36 name: "ShowableTest"
105 when: windowShown37 when: windowShown
10638
107 function init_test() {39 function init_test() {
@@ -155,4 +87,73 @@
155 compare(show1.shown, true, "Showable should automatically show when created changes to true if attempted to show before.");87 compare(show1.shown, true, "Showable should automatically show when created changes to true if attempted to show before.");
156 }88 }
157 }89 }
90
91 Showable {
92 id: show1
93 anchors.left: parent.left
94 anchors.top: parent.top
95 anchors.right: parent.right
96 height: units.gu(20)
97
98 opacity: 0.2
99 shown: false
100 hides: [show2, show3]
101 showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic }
102 hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic }
103
104 Rectangle {
105 anchors.fill: parent
106 color: "red"
107 }
108 MouseArea {
109 anchors.fill: parent
110 onClicked: { parent.show() }
111 }
112 }
113
114 Showable {
115 id: show2
116 anchors.left: parent.left
117 anchors.top: show1.bottom
118 anchors.right: parent.right
119 height: units.gu(20)
120
121 opacity: 0.2
122 shown: false
123 hides: [show1, show3]
124 showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic }
125 hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic }
126
127 Rectangle {
128 anchors.fill: parent
129 color: "green"
130 }
131 MouseArea {
132 anchors.fill: parent
133 onClicked: { parent.show() }
134 }
135 }
136
137 Showable {
138 id: show3
139 anchors.left: parent.left
140 anchors.top: show2.bottom
141 anchors.right: parent.right
142 anchors.bottom: parent.bottom
143
144 opacity: 0.1
145 shown: false
146 hides: [show1, show2]
147 showAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 1.0; easing.type: Easing.OutCubic }
148 hideAnimation: StandardAnimation { property: "opacity"; duration: 350; to: 0.2; easing.type: Easing.OutCubic }
149
150 Rectangle {
151 anchors.fill: parent
152 color: "blue"
153 }
154 MouseArea {
155 anchors.fill: parent
156 onClicked: { parent.show() }
157 }
158 }
158}159}
159160
=== renamed directory 'tests/qmluitests/tst_Stage' => 'tests/qmluitests/Components/tst_Stage'
=== renamed file 'tests/qmluitests/tst_Stage.qml' => 'tests/qmluitests/Components/tst_Stage.qml'
--- tests/qmluitests/tst_Stage.qml 2013-04-02 21:33:33 +0000
+++ tests/qmluitests/Components/tst_Stage.qml 2013-04-09 10:00:31 +0000
@@ -16,9 +16,10 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Components"19import ".."
20import "../../../Components"
20import Ubuntu.Components 0.121import Ubuntu.Components 0.1
21import "../../Applications/applications.js" as ApplicationsModel22import "../../../Applications/applications.js" as ApplicationsModel
22import "tst_Stage"23import "tst_Stage"
2324
24Rectangle {25Rectangle {
@@ -27,6 +28,146 @@
27 width: units.gu(70)28 width: units.gu(70)
28 height: stageRect.height29 height: stageRect.height
2930
31 UnityTestCase {
32 name: "StageTest"
33 when: windowShown
34
35 /* If you press Stage's right edge it should show the hint that it's possible to
36 switch to the next running application. This means (graphically) sliding the
37 next application window from Stage's right edge for a small part of its width */
38 function test_pressingRightEdgeShowsHint() {
39
40 // it shoulnd't be showing anything at first
41 compare(stage.usingScreenshots, false)
42
43 redControl.checked = true
44
45 tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
46 wait(600)
47 tryCompare(stage, "usingScreenshots", false) // and then for it to end
48 compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
49 compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
50
51 greenControl.checked = true
52
53 tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
54 wait(600)
55 tryCompare(stage, "usingScreenshots", false) // and then for it to end
56 compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "green")
57 compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "green")
58
59 var draggingAreaCenterX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
60 var draggingAreaCenterY = stage.height / 2
61 mousePress(stage, draggingAreaCenterX, draggingAreaCenterY)
62
63 // wait for the animation to start
64 tryCompare(stage, "usingScreenshots", true)
65
66 // "red" should be the new/next application being shown
67 compare(newAppScreenshot.application.desktopFile, "red")
68 tryCompareFunction(isShowingABitOfNewApp, true);
69
70 // "green" should be the current application being shown
71 compare(oldAppScreenshot.application.desktopFile, "green")
72 tryCompareFunction(isCurrentAppFadingOut, true);
73
74 mouseRelease(stage, draggingAreaCenterX, draggingAreaCenterY)
75 }
76
77 function isShowingABitOfNewApp() {
78 // it should come from the right and take less than half of the screen
79 // but at least 15% of it
80 return newAppScreenshot.x > stage.width/2
81 && newAppScreenshot.x < stage.width*(85/100)
82 && newAppScreenshot.y === 0
83 && newAppScreenshot.visible
84 }
85
86 function isCurrentAppFadingOut() {
87 // it should get a bit translucent and smaller
88 return oldAppScreenshot.opacity < 0.98
89 && oldAppScreenshot.opacity >= 0.1
90 && oldAppScreenshot.scale < 0.98
91 && oldAppScreenshot.scale >= 0.1
92 && oldAppScreenshot.visible
93 }
94
95 function init() {
96 redControl.checked = false;
97 greenControl.checked = false;
98 blueControl.checked = false;
99 // give some room for animations to start
100 wait(50)
101 // wait until animations end, if any
102 tryCompare(stage, "usingScreenshots", false)
103 }
104
105 /* If you flick from the right edge of the stage leftwards it should cause an
106 application switch. */
107 function test_dragFromRightEdgeToSwitchApplication() {
108 // it shoulnd't be showing anything at first
109 compare(stage.usingScreenshots, false)
110
111 redControl.checked = true
112
113 tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
114 tryCompare(stage, "usingScreenshots", false) // and then for it to end
115 compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
116 compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
117
118 greenControl.checked = true
119
120 tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
121 tryCompare(stage, "usingScreenshots", false) // and then for it to end
122 compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "green")
123 compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "green")
124
125 var mouseX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
126 var mouseY = stage.height / 2
127 mouseFlick(stage, mouseX, mouseY,
128 mouseX - units.gu(5), mouseY)
129
130 // wait until animations end, if any
131 tryCompare(stage, "usingScreenshots", false)
132
133 // "red" should be the new topmost, focused, application
134 compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
135 compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
136 }
137
138 /* When an application is launched, it needs a background before it's drawn on screen
139 so that the user does not see the previous running app while the new one is launching.
140 When switching between applications, backgrounds are unnecessary, 'cause the
141 applications are in front of them. */
142 function test_background() {
143 // it shoulnd't be showing anything at first
144 compare(stage.usingScreenshots, false)
145
146 redControl.checked = true
147 tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
148
149 compare(newAppScreenshot.withBackground, true, "starting app screenshot does not have background enabled")
150
151 tryCompare(stage, "usingScreenshots", false) // wait for the animation to finish
152
153 greenControl.checked = true
154 tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
155 tryCompare(stage, "usingScreenshots", false) // and finish
156
157 var draggingAreaCenterX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
158 var draggingAreaCenterY = stage.height / 2
159 mousePress(stage, draggingAreaCenterX, draggingAreaCenterY)
160
161 // wait for the animation to start
162 tryCompare(stage, "usingScreenshots", true)
163
164 compare(newAppScreenshot.withBackground, false, "switched app does have background enabled")
165
166 tryCompareFunction(isShowingABitOfNewApp, true); // wait for the hint animation to finish
167 mouseRelease(stage, draggingAreaCenterX, draggingAreaCenterY)
168 }
169 }
170
30 // Even though we replace the ApplicationScreenshot instances in Stage171 // Even though we replace the ApplicationScreenshot instances in Stage
31 // with our own fake ones, ApplicationScreenshot.qml still gives out a warning172 // with our own fake ones, ApplicationScreenshot.qml still gives out a warning
32 // if shell.importUbuntuApplicationAvailable is missing.173 // if shell.importUbuntuApplicationAvailable is missing.
@@ -190,144 +331,4 @@
190 AppControl {id: blueControl; desktopFile:"blue"}331 AppControl {id: blueControl; desktopFile:"blue"}
191 }332 }
192 }333 }
193
194 UnityTestCase {
195 name: "Stage"
196 when: windowShown
197
198 /* If you press Stage's right edge it should show the hint that it's possible to
199 switch to the next running application. This means (graphically) sliding the
200 next application window from Stage's right edge for a small part of its width */
201 function test_pressingRightEdgeShowsHint() {
202
203 // it shoulnd't be showing anything at first
204 compare(stage.usingScreenshots, false)
205
206 redControl.checked = true
207
208 tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
209 wait(600)
210 tryCompare(stage, "usingScreenshots", false) // and then for it to end
211 compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
212 compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
213
214 greenControl.checked = true
215
216 tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
217 wait(600)
218 tryCompare(stage, "usingScreenshots", false) // and then for it to end
219 compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "green")
220 compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "green")
221
222 var draggingAreaCenterX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
223 var draggingAreaCenterY = stage.height / 2
224 mousePress(stage, draggingAreaCenterX, draggingAreaCenterY)
225
226 // wait for the animation to start
227 tryCompare(stage, "usingScreenshots", true)
228
229 // "red" should be the new/next application being shown
230 compare(newAppScreenshot.application.desktopFile, "red")
231 tryCompareFunction(isShowingABitOfNewApp, true);
232
233 // "green" should be the current application being shown
234 compare(oldAppScreenshot.application.desktopFile, "green")
235 tryCompareFunction(isCurrentAppFadingOut, true);
236
237 mouseRelease(stage, draggingAreaCenterX, draggingAreaCenterY)
238 }
239
240 function isShowingABitOfNewApp() {
241 // it should come from the right and take less than half of the screen
242 // but at least 15% of it
243 return newAppScreenshot.x > stage.width/2
244 && newAppScreenshot.x < stage.width*(85/100)
245 && newAppScreenshot.y === 0
246 && newAppScreenshot.visible
247 }
248
249 function isCurrentAppFadingOut() {
250 // it should get a bit translucent and smaller
251 return oldAppScreenshot.opacity < 0.98
252 && oldAppScreenshot.opacity >= 0.1
253 && oldAppScreenshot.scale < 0.98
254 && oldAppScreenshot.scale >= 0.1
255 && oldAppScreenshot.visible
256 }
257
258 function init() {
259 redControl.checked = false;
260 greenControl.checked = false;
261 blueControl.checked = false;
262 // give some room for animations to start
263 wait(50)
264 // wait until animations end, if any
265 tryCompare(stage, "usingScreenshots", false)
266 }
267
268 /* If you flick from the right edge of the stage leftwards it should cause an
269 application switch. */
270 function test_dragFromRightEdgeToSwitchApplication() {
271 // it shoulnd't be showing anything at first
272 compare(stage.usingScreenshots, false)
273
274 redControl.checked = true
275
276 tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
277 tryCompare(stage, "usingScreenshots", false) // and then for it to end
278 compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
279 compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
280
281 greenControl.checked = true
282
283 tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
284 tryCompare(stage, "usingScreenshots", false) // and then for it to end
285 compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "green")
286 compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "green")
287
288 var mouseX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
289 var mouseY = stage.height / 2
290 mouseFlick(stage, mouseX, mouseY,
291 mouseX - units.gu(5), mouseY)
292
293 // wait until animations end, if any
294 tryCompare(stage, "usingScreenshots", false)
295
296 // "red" should be the new topmost, focused, application
297 compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
298 compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
299 }
300
301 /* When an application is launched, it needs a background before it's drawn on screen
302 so that the user does not see the previous running app while the new one is launching.
303 When switching between applications, backgrounds are unnecessary, 'cause the
304 applications are in front of them. */
305 function test_background() {
306 // it shoulnd't be showing anything at first
307 compare(stage.usingScreenshots, false)
308
309 redControl.checked = true
310 tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
311
312 compare(newAppScreenshot.withBackground, true, "starting app screenshot does not have background enabled")
313
314 tryCompare(stage, "usingScreenshots", false) // wait for the animation to finish
315
316 greenControl.checked = true
317 tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
318 tryCompare(stage, "usingScreenshots", false) // and finish
319
320 var draggingAreaCenterX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
321 var draggingAreaCenterY = stage.height / 2
322 mousePress(stage, draggingAreaCenterX, draggingAreaCenterY)
323
324 // wait for the animation to start
325 tryCompare(stage, "usingScreenshots", true)
326
327 compare(newAppScreenshot.withBackground, false, "switched app does have background enabled")
328
329 tryCompareFunction(isShowingABitOfNewApp, true); // wait for the hint animation to finish
330 mouseRelease(stage, draggingAreaCenterX, draggingAreaCenterY)
331 }
332 }
333}334}
334335
=== renamed file 'tests/qmluitests/tst_Tile.qml' => 'tests/qmluitests/Components/tst_Tile.qml'
--- tests/qmluitests/tst_Tile.qml 2013-04-08 11:52:36 +0000
+++ tests/qmluitests/Components/tst_Tile.qml 2013-04-09 10:00:31 +0000
@@ -16,7 +16,8 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Components"19import ".."
20import "../../../Components"
20import Ubuntu.Components 0.121import Ubuntu.Components 0.1
2122
22Item {23Item {
@@ -57,11 +58,11 @@
57 mouseRelease(label, 1, 1)58 mouseRelease(label, 1, 1)
58 }59 }
59 }60 }
60 61
61 Tile {62 Tile {
62 id: tile63 id: tile
63 anchors.fill: parent64 anchors.fill: parent
64 source: "../../graphics/clock@18.png"65 source: "../../../graphics/clock@18.png"
65 text: "Testing rocks, debugging sucks!"66 text: "Testing rocks, debugging sucks!"
66 imageWidth: width67 imageWidth: width
67 imageHeight: width68 imageHeight: width
6869
=== added directory 'tests/qmluitests/Dash'
=== added file 'tests/qmluitests/Dash/CMakeLists.txt'
--- tests/qmluitests/Dash/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Dash/CMakeLists.txt 2013-04-09 10:00:31 +0000
@@ -0,0 +1,1 @@
1add_qml_test(DashPreview)
02
=== renamed file 'tests/qmluitests/tst_DashPreview.qml' => 'tests/qmluitests/Dash/tst_DashPreview.qml'
--- tests/qmluitests/tst_DashPreview.qml 2013-03-26 14:25:34 +0000
+++ tests/qmluitests/Dash/tst_DashPreview.qml 2013-04-09 10:00:31 +0000
@@ -16,7 +16,8 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Dash"19import ".."
20import "../../../Dash"
20import Ubuntu.Components 0.121import Ubuntu.Components 0.1
2122
22Item {23Item {
@@ -109,7 +110,7 @@
109 }110 }
110111
111 }112 }
112 113
113 DashPreview {114 DashPreview {
114 id: preview115 id: preview
115 anchors.fill: parent116 anchors.fill: parent
116117
=== added directory 'tests/qmluitests/Greeter'
=== added file 'tests/qmluitests/Greeter/CMakeLists.txt'
--- tests/qmluitests/Greeter/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Greeter/CMakeLists.txt 2013-04-09 10:00:31 +0000
@@ -0,0 +1,1 @@
1add_qml_test(Greeter)
02
=== renamed file 'tests/qmluitests/tst_Greeter.qml' => 'tests/qmluitests/Greeter/tst_Greeter.qml'
--- tests/qmluitests/tst_Greeter.qml 2013-04-05 17:07:17 +0000
+++ tests/qmluitests/Greeter/tst_Greeter.qml 2013-04-09 10:00:31 +0000
@@ -16,16 +16,18 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Greeter"19import ".."
20import "../../../Greeter"
20import Ubuntu.Components 0.121import Ubuntu.Components 0.1
2122
22Item {23Item {
23 width: units.gu(120)24 width: units.gu(120)
24 height: units.gu(80)25 height: units.gu(80)
26
25 UnityTestCase {27 UnityTestCase {
26 name: "GreeterTest"28 name: "GreeterTest"
27 when: windowShown29 when: windowShown
28 30
29 function test_cycle_data() {31 function test_cycle_data() {
30 tryCompare(findChild(greeter, "userList"), "count", 5)32 tryCompare(findChild(greeter, "userList"), "count", 5)
31 var data = new Array()33 var data = new Array()
@@ -35,7 +37,7 @@
35 data[greeter.model.count] = {tag: greeter.model.get(0).name, username: "username0", uid: 0 }37 data[greeter.model.count] = {tag: greeter.model.get(0).name, username: "username0", uid: 0 }
36 return data38 return data
37 }39 }
38 40
39 function test_cycle(data) {41 function test_cycle(data) {
40 tryCompare(findChild(greeter, "userList"), "count", 5)42 tryCompare(findChild(greeter, "userList"), "count", 5)
41 selectionSpy.clear();43 selectionSpy.clear();
@@ -46,7 +48,7 @@
46 tryCompare(greeter, "locked", greeter.model.get(data.uid).password !== undefined)48 tryCompare(greeter, "locked", greeter.model.get(data.uid).password !== undefined)
47 tryCompare(selectionSpy, "count", 1)49 tryCompare(selectionSpy, "count", 1)
48 }50 }
49 51
50 function test_unlock_password() {52 function test_unlock_password() {
51 unlockSpy.clear()53 unlockSpy.clear()
52 // First one is Lolas account right now. Replace with password protected user from lightdm54 // First one is Lolas account right now. Replace with password protected user from lightdm
@@ -93,7 +95,7 @@
93 compare(unlockSpy.count, 1)95 compare(unlockSpy.count, 1)
94 }96 }
95 }97 }
96 98
97 Greeter {99 Greeter {
98 id: greeter100 id: greeter
99 anchors.fill: parent101 anchors.fill: parent
100102
=== added directory 'tests/qmluitests/Hud'
=== added file 'tests/qmluitests/Hud/CMakeLists.txt'
--- tests/qmluitests/Hud/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Hud/CMakeLists.txt 2013-04-09 10:00:31 +0000
@@ -0,0 +1,3 @@
1add_subdirectory(qml)
2
3add_qml_test(Hud IMPORT_PATH ${CMAKE_CURRENT_BINARY_DIR}/qml)
04
=== added directory 'tests/qmluitests/Hud/qml'
=== renamed file 'tests/qmluitests/qml/CMakeLists.txt' => 'tests/qmluitests/Hud/qml/CMakeLists.txt'
=== renamed directory 'tests/qmluitests/qml/HudClient' => 'tests/qmluitests/Hud/qml/HudClient'
=== modified file 'tests/qmluitests/Hud/qml/HudClient/CMakeLists.txt'
--- tests/qmluitests/qml/HudClient/CMakeLists.txt 2013-03-15 16:49:45 +0000
+++ tests/qmluitests/Hud/qml/HudClient/CMakeLists.txt 2013-04-09 10:00:31 +0000
@@ -25,8 +25,8 @@
25add_definitions(-DQT_NO_KEYWORDS)25add_definitions(-DQT_NO_KEYWORDS)
2626
27set(HudQML_SOURCES27set(HudQML_SOURCES
28 ../../../../plugins/HudClient/hudclient.cpp28 ../../../../../plugins/HudClient/hudclient.cpp
29 ../../../../plugins/HudClient/volumepeakdetector.cpp29 ../../../../../plugins/HudClient/volumepeakdetector.cpp
30 fake_hud_plugin.cpp30 fake_hud_plugin.cpp
31 fake_libhud_client.cpp31 fake_libhud_client.cpp
32 libhud_client_stub.cpp32 libhud_client_stub.cpp
3333
=== modified file 'tests/qmluitests/Hud/qml/HudClient/fake_hud_plugin.cpp'
--- tests/qmluitests/qml/HudClient/fake_hud_plugin.cpp 2013-03-15 16:57:11 +0000
+++ tests/qmluitests/Hud/qml/HudClient/fake_hud_plugin.cpp 2013-04-09 10:00:31 +0000
@@ -16,8 +16,8 @@
1616
17#include "fake_hud_plugin.h"17#include "fake_hud_plugin.h"
1818
19#include "../../../../plugins/HudClient/hudclient.h"19#include "../../../../../plugins/HudClient/hudclient.h"
20#include "../../../../plugins/HudClient/volumepeakdetector.h"20#include "../../../../../plugins/HudClient/volumepeakdetector.h"
21#include "libhud_client_stub.h"21#include "libhud_client_stub.h"
2222
23#include <deelistmodel.h>23#include <deelistmodel.h>
2424
=== renamed file 'tests/qmluitests/tst_Hud.qml' => 'tests/qmluitests/Hud/tst_Hud.qml'
--- tests/qmluitests/tst_Hud.qml 2013-04-02 08:20:21 +0000
+++ tests/qmluitests/Hud/tst_Hud.qml 2013-04-09 10:00:31 +0000
@@ -16,10 +16,10 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import ".."
20import "../../../Hud"
19import HudClient 0.121import HudClient 0.1
2022
21import "../../Hud"
22
23Hud {23Hud {
24 id: hud24 id: hud
25 height: units.gu(80)25 height: units.gu(80)
@@ -33,10 +33,6 @@
33 }33 }
34 }34 }
3535
36 HudClientStub {
37 id: hudClientStub
38 }
39
40 UnityTestCase {36 UnityTestCase {
41 name: "HudTest"37 name: "HudTest"
42 when: windowShown38 when: windowShown
@@ -281,4 +277,8 @@
281 compare(hudClientStub.lastParametrizedCommandCommited, true, "Confirming does commit")277 compare(hudClientStub.lastParametrizedCommandCommited, true, "Confirming does commit")
282 }278 }
283 }279 }
280
281 HudClientStub {
282 id: hudClientStub
283 }
284}284}
285285
=== added directory 'tests/qmluitests/Launcher'
=== added file 'tests/qmluitests/Launcher/CMakeLists.txt'
--- tests/qmluitests/Launcher/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Launcher/CMakeLists.txt 2013-04-09 10:00:31 +0000
@@ -0,0 +1,1 @@
1add_qml_test(Launcher)
02
=== renamed file 'tests/qmluitests/tst_Launcher.qml' => 'tests/qmluitests/Launcher/tst_Launcher.qml'
--- tests/qmluitests/tst_Launcher.qml 2013-03-28 11:03:01 +0000
+++ tests/qmluitests/Launcher/tst_Launcher.qml 2013-04-09 10:00:31 +0000
@@ -16,8 +16,9 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Launcher"19import ".."
20import "../../Applications/applications.js" as ApplicationsModel20import "../../../Launcher"
21import "../../../Applications/applications.js" as ApplicationsModel
2122
22/* Nothing is shown at first. If you drag from left edge you will bring up the23/* Nothing is shown at first. If you drag from left edge you will bring up the
23 launcher. */24 launcher. */
@@ -26,38 +27,9 @@
26 width: units.gu(50)27 width: units.gu(50)
27 height: units.gu(81)28 height: units.gu(81)
2829
29 Launcher {
30 id: launcher
31 x: 0
32 y: 0
33 width: units.gu(40)
34 height: units.gu(71)
35
36 favourites: ["/usr/share/applications/phone-app.desktop",
37 "/usr/share/applications/camera-app.desktop",
38 "/usr/share/applications/gallery-app.desktop"]
39
40 shortcutsWidth: units.gu(9)
41 shortcutsThreshold: units.gu(2)
42 iconPath: "graphics/applicationIcons"
43 __dateTime: testCase.fakeDateTime
44
45 property string latestApplicationSelected
46
47 onLauncherApplicationSelected: {
48 latestApplicationSelected = name
49 }
50
51 property int dashItemSelected_count: 0
52 onDashItemSelected: {
53 dashItemSelected_count++;
54 }
55
56 }
57
58 UnityTestCase {30 UnityTestCase {
59 id: testCase31 id: testCase
60 name: "Launcher"32 name: "LauncherTest"
61 when: windowShown33 when: windowShown
6234
63 // Drag from the left edge of the screen rightwards and check that the launcher35 // Drag from the left edge of the screen rightwards and check that the launcher
@@ -197,7 +169,6 @@
197 false, /* but do not release yet */169 false, /* but do not release yet */
198 launcher.maxFlickSpeedToLaunchApp*2 /* speed */ )170 launcher.maxFlickSpeedToLaunchApp*2 /* speed */ )
199171
200
201 // wait until it gets fully extended172 // wait until it gets fully extended
202 tryCompare(shortcuts, "x", 0)173 tryCompare(shortcuts, "x", 0)
203174
@@ -243,6 +214,33 @@
243 var shortcuts = findChild(launcher, "shortcuts")214 var shortcuts = findChild(launcher, "shortcuts")
244 tryCompare(shortcuts, "x", -shortcuts.width, 1000)215 tryCompare(shortcuts, "x", -shortcuts.width, 1000)
245 }216 }
246217 }
218
219 Launcher {
220 id: launcher
221 x: 0
222 y: 0
223 width: units.gu(40)
224 height: units.gu(71)
225
226 favourites: ["/usr/share/applications/phone-app.desktop",
227 "/usr/share/applications/camera-app.desktop",
228 "/usr/share/applications/gallery-app.desktop"]
229
230 shortcutsWidth: units.gu(9)
231 shortcutsThreshold: units.gu(2)
232 iconPath: "graphics/applicationIcons"
233 __dateTime: testCase.fakeDateTime
234
235 property string latestApplicationSelected
236
237 onLauncherApplicationSelected: {
238 latestApplicationSelected = name
239 }
240
241 property int dashItemSelected_count: 0
242 onDashItemSelected: {
243 dashItemSelected_count++;
244 }
247 }245 }
248}246}
249247
=== added directory 'tests/qmluitests/Panel'
=== added file 'tests/qmluitests/Panel/CMakeLists.txt'
--- tests/qmluitests/Panel/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Panel/CMakeLists.txt 2013-04-09 10:00:31 +0000
@@ -0,0 +1,2 @@
1add_qml_test(IndicatorRow IMPORT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/qml)
2add_qml_test(SearchIndicator)
03
=== renamed directory 'tests/qmluitests/qml' => 'tests/qmluitests/Panel/qml'
=== renamed file 'tests/qmluitests/tst_IndicatorRow.qml' => 'tests/qmluitests/Panel/tst_IndicatorRow.qml'
--- tests/qmluitests/tst_IndicatorRow.qml 2013-04-05 12:44:49 +0000
+++ tests/qmluitests/Panel/tst_IndicatorRow.qml 2013-04-09 10:00:31 +0000
@@ -16,7 +16,8 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Panel"19import ".."
20import "../../../Panel"
20import Ubuntu.ChewieUI 0.1 as ChewieUI21import Ubuntu.ChewieUI 0.1 as ChewieUI
2122
22/*23/*
@@ -28,24 +29,6 @@
28 width: units.gu(40)29 width: units.gu(40)
29 height: units.gu(60)30 height: units.gu(60)
3031
31 PanelBackground {
32 anchors.fill: indicatorRow
33 }
34
35 IndicatorRow {
36 id: indicatorRow
37 anchors {
38 left: parent.left
39 right: parent.right
40 }
41
42 indicatorsModel: indicatorModel
43 }
44
45 ChewieUI.PluginModel {
46 id: indicatorModel
47 }
48
49 function init_test()32 function init_test()
50 {33 {
51 indicatorRow.overviewActive = false;34 indicatorRow.overviewActive = false;
@@ -54,7 +37,7 @@
54 }37 }
5538
56 UnityTestCase {39 UnityTestCase {
57 name: "IndicatorRow"40 name: "IndicatorRowTest"
58 when: windowShown41 when: windowShown
5942
60 function test_set_current_item() {43 function test_set_current_item() {
@@ -71,7 +54,7 @@
71 }54 }
7255
73 UnityTestCase {56 UnityTestCase {
74 name: "IndicatorRow_IconPosition"57 name: "IndicatorRow_IconPositionTest"
75 when: windowShown58 when: windowShown
7659
77 function get_indicator_item_at(index) {60 function get_indicator_item_at(index) {
@@ -93,7 +76,7 @@
93 }76 }
9477
95 UnityTestCase {78 UnityTestCase {
96 name: "IndicatorRow_Highlight"79 name: "IndicatorRow_HighlightTest"
97 when: windowShown80 when: windowShown
9881
99 function get_indicator_item_at(index) {82 function get_indicator_item_at(index) {
@@ -167,7 +150,7 @@
167 }150 }
168151
169 UnityTestCase {152 UnityTestCase {
170 name: "IndicatorRow_Dimmed"153 name: "IndicatorRow_DimmedTest"
171 when: windowShown154 when: windowShown
172155
173 function get_indicator_item_at(index) {156 function get_indicator_item_at(index) {
@@ -253,4 +236,21 @@
253 }236 }
254 }237 }
255238
239 PanelBackground {
240 anchors.fill: indicatorRow
241 }
242
243 IndicatorRow {
244 id: indicatorRow
245 anchors {
246 left: parent.left
247 right: parent.right
248 }
249
250 indicatorsModel: indicatorModel
251 }
252
253 ChewieUI.PluginModel {
254 id: indicatorModel
255 }
256}256}
257257
=== added file 'tests/qmluitests/Panel/tst_SearchIndicator.qml'
--- tests/qmluitests/Panel/tst_SearchIndicator.qml 1970-01-01 00:00:00 +0000
+++ tests/qmluitests/Panel/tst_SearchIndicator.qml 2013-04-09 10:00:31 +0000
@@ -0,0 +1,63 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import QtTest 1.0
19import ".."
20import "../../../Panel"
21import Ubuntu.Components 0.1
22
23Item {
24 width: units.gu(9)
25 height: units.gu(3)
26
27 UnityTestCase {
28 name: "SearchIndicatorTest"
29 when: windowShown
30
31 function test_clickedSignal() {
32 clickedSpy.clear()
33 mouseClick(searchIndicator,
34 searchIndicator.width / 2, searchIndicator.height / 2);
35 compare(clickedSpy.count, 1)
36 }
37
38 function test_hideUp() {
39 var container = findChild(searchIndicator, "container")
40 searchIndicator.hideUp()
41 tryCompare(container, "opacity", 0)
42 tryCompare(container, "y", -container.height)
43 }
44
45 function test_show() {
46 var container = findChild(searchIndicator, "container")
47 searchIndicator.show()
48 tryCompare(container, "opacity", 1)
49 tryCompare(container, "y", 0)
50 }
51 }
52
53 SignalSpy {
54 id: clickedSpy
55 target: searchIndicator
56 signalName: "clicked"
57 }
58
59 SearchIndicator {
60 id: searchIndicator
61 anchors.fill: parent
62 }
63}
064
=== modified file 'tests/unittests/CMakeLists.txt'
--- tests/unittests/CMakeLists.txt 2013-03-27 15:48:19 +0000
+++ tests/unittests/CMakeLists.txt 2013-04-09 10:00:31 +0000
@@ -3,9 +3,4 @@
3set(qmltest_DEFAULT_TARGETS unittests alltests)3set(qmltest_DEFAULT_TARGETS unittests alltests)
4set(qmltest_DEFAULT_PROPERTIES PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")4set(qmltest_DEFAULT_PROPERTIES PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
55
6add_qml_test(AnimationControllerWithSignals)6add_subdirectory(Components)
7add_qml_test(Carousel)
8add_qml_test(CrossFadeImage)
9add_qml_test(MathLocal)
10add_qml_test(RatingStars)
11add_qml_test(TimeLocal)
127
=== added directory 'tests/unittests/Components'
=== added file 'tests/unittests/Components/CMakeLists.txt'
--- tests/unittests/Components/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/unittests/Components/CMakeLists.txt 2013-04-09 10:00:31 +0000
@@ -0,0 +1,6 @@
1add_qml_test(AnimationControllerWithSignals)
2add_qml_test(Carousel)
3add_qml_test(CrossFadeImage)
4add_qml_test(MathLocal)
5add_qml_test(RatingStars)
6add_qml_test(TimeLocal)
07
=== renamed file 'tests/unittests/tst_AnimationControllerWithSignals.qml' => 'tests/unittests/Components/tst_AnimationControllerWithSignals.qml'
--- tests/unittests/tst_AnimationControllerWithSignals.qml 2013-03-14 12:32:50 +0000
+++ tests/unittests/Components/tst_AnimationControllerWithSignals.qml 2013-04-09 10:00:31 +0000
@@ -16,14 +16,108 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Components"19import "../../../Components"
2020
21TestCase {21TestCase {
22 id: testCase22 id: testCase
23 name: "AnimationControllerWithSignals"23 name: "AnimationControllerWithSignalsTest"
2424
25 property real someNumber: 0.025 property real someNumber: 0.0
2626
27 function test_completeToEndWithSignal() {
28 loader.sourceComponent = testSubjectComponent;
29 var testSubject = loader.item;
30
31 testSubject.animation = someNumberAnimation;
32 testSubject.progress = 0;
33
34 signalSpy.signalName = "animationCompletedAtEnd";
35 signalSpy.target = testSubject;
36 signalSpy.clear();
37
38 compare(testSubject.completing, false)
39 compare(testSubject.completed, true)
40
41 testSubject.completeToEndWithSignal();
42 compare(testSubject.completing, true)
43 compare(testSubject.completed, true)
44 compare(signalSpy.count, 0);
45
46 testSubject.progress = 0.5;
47 compare(testSubject.completing, true)
48 compare(testSubject.completed, false)
49 compare(signalSpy.count, 0);
50
51 testSubject.progress = 1.0;
52 compare(testSubject.completing, false)
53 compare(testSubject.completed, true)
54 compare(signalSpy.count, 1);
55
56 testSubject.animation = null
57 loader.sourceComponent = undefined;
58 }
59
60 function test_completeToBeginningWithSignal() {
61 loader.sourceComponent = testSubjectComponent;
62 var testSubject = loader.item;
63
64 testSubject.animation = someNumberAnimation;
65 testSubject.progress = 1;
66
67 signalSpy.signalName = "animationCompletedAtBeginning";
68 signalSpy.target = testSubject;
69 signalSpy.clear();
70
71 compare(testSubject.completing, false)
72 compare(testSubject.completed, true)
73
74 testSubject.completeToBeginningWithSignal();
75 compare(testSubject.completing, true)
76 compare(testSubject.completed, true)
77 compare(signalSpy.count, 0);
78
79 testSubject.progress = 0.5;
80 compare(testSubject.completing, true)
81 compare(testSubject.completed, false)
82 compare(signalSpy.count, 0);
83
84 testSubject.progress = 0;
85 compare(testSubject.completing, false)
86 compare(testSubject.completed, true)
87 compare(signalSpy.count, 1);
88
89 testSubject.animation = null
90 loader.sourceComponent = undefined;
91 }
92
93 function test_settingProgressWithoutCallingCompleteWithSignal() {
94 loader.sourceComponent = testSubjectComponent;
95 var testSubject = loader.item;
96
97 testSubject.animation = someNumberAnimation;
98 testSubject.progress = 0;
99
100 signalSpy.signalName = "animationCompletedAtEnd";
101 signalSpy.target = testSubject;
102 signalSpy.clear();
103
104 compare(testSubject.completing, false)
105 compare(testSubject.completed, true)
106
107 testSubject.progress = 0.5;
108 compare(testSubject.completing, false)
109 compare(testSubject.completed, false)
110 compare(signalSpy.count, 0);
111
112 testSubject.progress = 1;
113 compare(testSubject.completing, false)
114 compare(testSubject.completed, true)
115 compare(signalSpy.count, 0);
116
117 testSubject.animation = null
118 loader.sourceComponent = undefined;
119 }
120
27 NumberAnimation {121 NumberAnimation {
28 id: someNumberAnimation122 id: someNumberAnimation
29 target: testCase123 target: testCase
@@ -45,99 +139,4 @@
45 SignalSpy {139 SignalSpy {
46 id: signalSpy140 id: signalSpy
47 }141 }
48
49 function test_completeToEndWithSignal() {
50 loader.sourceComponent = testSubjectComponent;
51 var testSubject = loader.item;
52
53 testSubject.animation = someNumberAnimation;
54 testSubject.progress = 0;
55
56 signalSpy.signalName = "animationCompletedAtEnd";
57 signalSpy.target = testSubject;
58 signalSpy.clear();
59
60 compare(testSubject.completing, false)
61 compare(testSubject.completed, true)
62
63 testSubject.completeToEndWithSignal();
64 compare(testSubject.completing, true)
65 compare(testSubject.completed, true)
66 compare(signalSpy.count, 0);
67
68 testSubject.progress = 0.5;
69 compare(testSubject.completing, true)
70 compare(testSubject.completed, false)
71 compare(signalSpy.count, 0);
72
73 testSubject.progress = 1.0;
74 compare(testSubject.completing, false)
75 compare(testSubject.completed, true)
76 compare(signalSpy.count, 1);
77
78 testSubject.animation = null
79 loader.sourceComponent = undefined;
80 }
81
82 function test_completeToBeginningWithSignal() {
83 loader.sourceComponent = testSubjectComponent;
84 var testSubject = loader.item;
85
86 testSubject.animation = someNumberAnimation;
87 testSubject.progress = 1;
88
89 signalSpy.signalName = "animationCompletedAtBeginning";
90 signalSpy.target = testSubject;
91 signalSpy.clear();
92
93 compare(testSubject.completing, false)
94 compare(testSubject.completed, true)
95
96 testSubject.completeToBeginningWithSignal();
97 compare(testSubject.completing, true)
98 compare(testSubject.completed, true)
99 compare(signalSpy.count, 0);
100
101 testSubject.progress = 0.5;
102 compare(testSubject.completing, true)
103 compare(testSubject.completed, false)
104 compare(signalSpy.count, 0);
105
106 testSubject.progress = 0;
107 compare(testSubject.completing, false)
108 compare(testSubject.completed, true)
109 compare(signalSpy.count, 1);
110
111 testSubject.animation = null
112 loader.sourceComponent = undefined;
113 }
114
115 function test_settingProgressWithoutCallingCompleteWithSignal() {
116 loader.sourceComponent = testSubjectComponent;
117 var testSubject = loader.item;
118
119 testSubject.animation = someNumberAnimation;
120 testSubject.progress = 0;
121
122 signalSpy.signalName = "animationCompletedAtEnd";
123 signalSpy.target = testSubject;
124 signalSpy.clear();
125
126 compare(testSubject.completing, false)
127 compare(testSubject.completed, true)
128
129 testSubject.progress = 0.5;
130 compare(testSubject.completing, false)
131 compare(testSubject.completed, false)
132 compare(signalSpy.count, 0);
133
134 testSubject.progress = 1;
135 compare(testSubject.completing, false)
136 compare(testSubject.completed, true)
137 compare(signalSpy.count, 0);
138
139 testSubject.animation = null
140 loader.sourceComponent = undefined;
141 }
142}142}
143
144143
=== renamed file 'tests/unittests/tst_Carousel.qml' => 'tests/unittests/Components/tst_Carousel.qml'
--- tests/unittests/tst_Carousel.qml 2013-03-28 09:50:26 +0000
+++ tests/unittests/Components/tst_Carousel.qml 2013-04-09 10:00:31 +0000
@@ -16,7 +16,7 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Components/carousel.js" as Carousel19import "../../../Components/carousel.js" as Carousel
2020
21TestCase {21TestCase {
22 name: "CarouselTest"22 name: "CarouselTest"
2323
=== renamed file 'tests/unittests/tst_CrossFadeImage.qml' => 'tests/unittests/Components/tst_CrossFadeImage.qml'
--- tests/unittests/tst_CrossFadeImage.qml 2013-03-13 22:58:26 +0000
+++ tests/unittests/Components/tst_CrossFadeImage.qml 2013-04-09 10:00:31 +0000
@@ -16,7 +16,7 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Components"19import "../../../Components"
2020
21TestCase {21TestCase {
22 name: "CrossFadeImageTest"22 name: "CrossFadeImageTest"
@@ -33,11 +33,11 @@
33 fadeInFirst = argFadeInFirst33 fadeInFirst = argFadeInFirst
34 compare(status, Image.Null, "Could not reset CrossFadeImage")34 compare(status, Image.Null, "Could not reset CrossFadeImage")
35 }35 }
36 36
37 function loadImage(url) {37 function loadImage(url) {
38 console.log("Loading image...")38 console.log("Loading image...")
39 source = url39 source = url
40 40
41 signalSpy.signalName = "statusChanged"41 signalSpy.signalName = "statusChanged"
42 signalSpy.wait()42 signalSpy.wait()
4343
@@ -45,7 +45,7 @@
45 signalSpy.clear()45 signalSpy.clear()
46 signalSpy.wait()46 signalSpy.wait()
47 }47 }
48 48
49 if (status == Image.Loading) {49 if (status == Image.Loading) {
50 signalSpy.clear()50 signalSpy.clear()
51 signalSpy.wait()51 signalSpy.wait()
@@ -54,7 +54,7 @@
54 compare(status, Image.Ready, "Image not ready")54 compare(status, Image.Ready, "Image not ready")
55 console.log("Image loaded.")55 console.log("Image loaded.")
56 }56 }
57 57
58 function waitForAnimation() {58 function waitForAnimation() {
59 signalSpy.signalName = "runningChanged"59 signalSpy.signalName = "runningChanged"
6060
@@ -63,7 +63,7 @@
63 signalSpy.wait()63 signalSpy.wait()
64 compare(running, true, "Animation did not start")64 compare(running, true, "Animation did not start")
65 }65 }
66 66
67 signalSpy.clear()67 signalSpy.clear()
68 console.log("Waiting for animation to finish...")68 console.log("Waiting for animation to finish...")
69 signalSpy.wait()69 signalSpy.wait()
@@ -74,31 +74,31 @@
74 compare(running, false, "Animation is running after testcase")74 compare(running, false, "Animation is running after testcase")
75 compare(crossFadeImage.__nextImage.source, "", "nextimage source is not reset")75 compare(crossFadeImage.__nextImage.source, "", "nextimage source is not reset")
76 }76 }
77 77
78 function test_fadeFirst() {78 function test_fadeFirst() {
79 initTestFunction(true, true)79 initTestFunction(true, true)
8080
81 loadImage("../../graphics/phone_background.jpg")81 loadImage("../../../graphics/phone_background.jpg")
8282
83 waitForAnimation()83 waitForAnimation()
84 84
85 cleanupTest()85 cleanupTest()
86 }86 }
8787
88 function test_no_fadeFirst() {88 function test_no_fadeFirst() {
89 initTestFunction(true, false)89 initTestFunction(true, false)
90 90
91 loadImage("../../graphics/phone_background.jpg")91 loadImage("../../../graphics/phone_background.jpg")
92 92
93 cleanupTest()93 cleanupTest()
94 }94 }
95 95
96 function test_crossFade() {96 function test_crossFade() {
97 initTestFunction(true, false)97 initTestFunction(true, false)
9898
99 loadImage("../../graphics/phone_background.jpg")99 loadImage("../../../graphics/phone_background.jpg")
100 100
101 loadImage("../../graphics/tablet_background.jpg")101 loadImage("../../../graphics/tablet_background.jpg")
102102
103 // Due to the internal implementation, __currentImage and __nextImage are swapped before the animation starts103 // Due to the internal implementation, __currentImage and __nextImage are swapped before the animation starts
104 // Make sure z order reflects that too.104 // Make sure z order reflects that too.
@@ -107,12 +107,11 @@
107 compare(crossFadeImage.__nextImage.opacity > 0.5, true)107 compare(crossFadeImage.__nextImage.opacity > 0.5, true)
108108
109 waitForAnimation()109 waitForAnimation()
110 110
111 compare(crossFadeImage.__currentImage.opacity > 0.5, true)111 compare(crossFadeImage.__currentImage.opacity > 0.5, true)
112 compare(crossFadeImage.__nextImage.opacity < 0.5, true)112 compare(crossFadeImage.__nextImage.opacity < 0.5, true)
113 113
114 cleanupTest()114 cleanupTest()
115
116 }115 }
117116
118 CrossFadeImage {117 CrossFadeImage {
119118
=== renamed file 'tests/unittests/tst_MathLocal.qml' => 'tests/unittests/Components/tst_MathLocal.qml'
--- tests/unittests/tst_MathLocal.qml 2013-02-27 20:06:20 +0000
+++ tests/unittests/Components/tst_MathLocal.qml 2013-04-09 10:00:31 +0000
@@ -16,7 +16,7 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Components/Math.js" as MathLocal19import "../../../Components/Math.js" as MathLocal
2020
21TestCase {21TestCase {
22 name: "MathLocalTest"22 name: "MathLocalTest"
2323
=== renamed file 'tests/unittests/tst_RatingStars.qml' => 'tests/unittests/Components/tst_RatingStars.qml'
--- tests/unittests/tst_RatingStars.qml 2013-02-27 20:06:20 +0000
+++ tests/unittests/Components/tst_RatingStars.qml 2013-04-09 10:00:31 +0000
@@ -16,7 +16,7 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Components"19import "../../../Components"
2020
21TestCase {21TestCase {
22 name: "RatingStarsTest"22 name: "RatingStarsTest"
2323
=== renamed file 'tests/unittests/tst_TimeLocal.qml' => 'tests/unittests/Components/tst_TimeLocal.qml'
--- tests/unittests/tst_TimeLocal.qml 2013-03-11 13:07:33 +0000
+++ tests/unittests/Components/tst_TimeLocal.qml 2013-04-09 10:00:31 +0000
@@ -16,7 +16,7 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import QtTest 1.018import QtTest 1.0
19import "../../Components/Time.js" as TimeLocal19import "../../../Components/Time.js" as TimeLocal
2020
21TestCase {21TestCase {
22 name: "TimeLocalTest"22 name: "TimeLocalTest"

Subscribers

People subscribed via source and target branches

to all changes: