on xenial help sign in
Move common waiting to the top
0c6b0c9Albert Astals
tests/qmltests/Dash/tst_Dash.qml+10−37
@@ -55,6 +55,11 @@ Item {
55 scopes.load();
55 scopes.load();
56 tryCompare(dashContentList, "currentIndex", 0);
56 tryCompare(dashContentList, "currentIndex", 0);
57 tryCompare(dashContentList, "count", 6);
57 tryCompare(dashContentList, "count", 6);
58+ tryCompare(scopes, "loaded", true);
59+ tryCompareFunction(function() {
60+ var mockScope1Loader = findChild(dash, "MockScope1 loader");
61+ return mockScope1Loader && mockScope1Loader.item != null; },
62+ true, 15000);
58 }
63 }
59
64
60 function get_scope_data() {
65 function get_scope_data() {
@@ -92,15 +97,6 @@ Item {
92 }
97 }
93
98
94 function test_dash_overview_show_select_same_favorite() {
99 function test_dash_overview_show_select_same_favorite() {
95− // Wait for stuff to be loaded
96− tryCompare(scopes, "loaded", true);
97− var dashContentList = findChild(dash, "dashContentList");
98− tryCompare(dashContentList, "count", 6);
99− tryCompareFunction(function() {
100− var mockScope1Loader = findChild(dash, "MockScope1 loader");
101− return mockScope1Loader && mockScope1Loader.item != null; },
102− true, 15000);
103−
104 // Show the overview
100 // Show the overview
105 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
101 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
106 var overviewController = findInvisibleChild(dash, "overviewController");
102 var overviewController = findInvisibleChild(dash, "overviewController");
@@ -121,18 +117,12 @@ Item {
121
117
122 // Make sure animation went back
118 // Make sure animation went back
123 tryCompare(overviewController, "progress", 0);
119 tryCompare(overviewController, "progress", 0);
120+
121+ var dashContentList = findChild(dash, "dashContentList");
124 compare(dashContentList.currentIndex, 0);
122 compare(dashContentList.currentIndex, 0);
125 }
123 }
126
124
127 function test_dash_overview_show_select_different_favorite() {
125 function test_dash_overview_show_select_different_favorite() {
128− // Wait for stuff to be loaded
129− tryCompare(scopes, "loaded", true);
130− var dashContentList = findChild(dash, "dashContentList");
131− tryCompare(dashContentList, "count", 6);
132− tryCompareFunction(function() { return findChild(dash, "MockScope1 loader") != null; }, true, 15000);
133− var mockScope1Loader = findChild(dash, "MockScope1 loader");
134− tryCompare(mockScope1Loader, "status", Loader.Ready);
135−
136 // Show the overview
126 // Show the overview
137 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
127 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
138 var overviewController = findInvisibleChild(dash, "overviewController");
128 var overviewController = findInvisibleChild(dash, "overviewController");
@@ -153,19 +143,11 @@ Item {
153
143
154 // Make sure animation went back
144 // Make sure animation went back
155 tryCompare(overviewController, "progress", 0);
145 tryCompare(overviewController, "progress", 0);
146+ var dashContentList = findChild(dash, "dashContentList");
156 compare(dashContentList.currentIndex, 1);
147 compare(dashContentList.currentIndex, 1);
157 }
148 }
158
149
159 function test_dash_overview_all_temp_scope_done_from_all() {
150 function test_dash_overview_all_temp_scope_done_from_all() {
160− // Wait for stuff to be loaded
161− tryCompare(scopes, "loaded", true);
162− var dashContentList = findChild(dash, "dashContentList");
163− tryCompare(dashContentList, "count", 6);
164− tryCompareFunction(function() {
165− var mockScope1Loader = findChild(dash, "MockScope1 loader");
166− return mockScope1Loader && mockScope1Loader.item != null; },
167− true, 15000);
168−
169 // Show the overview
151 // Show the overview
170 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
152 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
171 var overviewController = findInvisibleChild(dash, "overviewController");
153 var overviewController = findInvisibleChild(dash, "overviewController");
@@ -227,20 +209,13 @@ Item {
227 tryCompare(overviewController, "progress", 0);
209 tryCompare(overviewController, "progress", 0);
228
210
229 // Original list is still on 0
211 // Original list is still on 0
212+ var dashContentList = findChild(dash, "dashContentList");
230 compare(dashContentList.currentIndex, 0);
213 compare(dashContentList.currentIndex, 0);
231 }
214 }
232
215
233 function test_temp_scope_dash_overview_all_search_temp_scope_favorite_from_all() {
216 function test_temp_scope_dash_overview_all_search_temp_scope_favorite_from_all() {
234− // Wait for stuff to be loaded
235− tryCompare(scopes, "loaded", true);
236− var dashContentList = findChild(dash, "dashContentList");
237− tryCompare(dashContentList, "count", 6);
238− tryCompareFunction(function() {
239− var mockScope1Loader = findChild(dash, "MockScope1 loader");
240− return mockScope1Loader && mockScope1Loader.item != null; },
241− true, 15000);
242−
243 // Swipe right to Apps scope
217 // Swipe right to Apps scope
218+ var dashContentList = findChild(dash, "dashContentList");
244 touchFlick(dash, dash.width - 1, units.gu(1), dash.width - units.gu(10), units.gu(1));
219 touchFlick(dash, dash.width - 1, units.gu(1), dash.width - units.gu(10), units.gu(1));
245 tryCompare(dashContentList, "contentX", dashContentList.width);
220 tryCompare(dashContentList, "contentX", dashContentList.width);
246 tryCompare(dashContentList, "currentIndex", 1);
221 tryCompare(dashContentList, "currentIndex", 1);
@@ -339,8 +314,6 @@ Item {
339 }
314 }
340
315
341 function test_processing_indicator() {
316 function test_processing_indicator() {
342− tryCompare(scopes, "loaded", true);
343−
344 var processingIndicator = findChild(dash, "processingIndicator");
317 var processingIndicator = findChild(dash, "processingIndicator");
345 verify(processingIndicator, "Can't find the processing indicator.");
318 verify(processingIndicator, "Can't find the processing indicator.");
346
319