on xenial help sign in
Adapt test to new mock behaviour
49867a5Albert Astals Cid
qml/Dash/ScopesList.qml+1
@@ -72,6 +72,7 @@ Item {
72 }
72 }
73
73
74 Flickable {
74 Flickable {
75+ objectName: "scopesListFlickable"
75 anchors {
76 anchors {
76 top: header.bottom
77 top: header.bottom
77 bottom: parent.bottom
78 bottom: parent.bottom
tests/mocks/Unity/fake_scope.cpp+6−1
@@ -39,6 +39,7 @@ Scope::Scope(QString const& id, QString const& name, bool favorite, Scopes* pare
39 , m_searching(false)
39 , m_searching(false)
40 , m_favorite(favorite)
40 , m_favorite(favorite)
41 , m_isActive(false)
41 , m_isActive(false)
42+ , m_hasBeenActive(false)
42 , m_hasNavigation(true)
43 , m_hasNavigation(true)
43 , m_hasPrimaryFilter(true)
44 , m_hasPrimaryFilter(true)
44 , m_currentNavigationId("root")
45 , m_currentNavigationId("root")
@@ -108,7 +109,7 @@ bool Scope::favorite() const
108
109
109unity::shell::scopes::CategoriesInterface* Scope::categories() const
110unity::shell::scopes::CategoriesInterface* Scope::categories() const
110{
111{
111− return m_categories;
112+ return m_hasBeenActive ? m_categories : nullptr;
112}
113}
113
114
114unity::shell::scopes::SettingsModelInterface* Scope::settings() const
115unity::shell::scopes::SettingsModelInterface* Scope::settings() const
@@ -153,6 +154,10 @@ void Scope::setActive(const bool active)
153 m_isActive = active;
154 m_isActive = active;
154 Q_EMIT isActiveChanged();
155 Q_EMIT isActiveChanged();
155 }
156 }
157+ if (active && !m_hasBeenActive) {
158+ m_hasBeenActive = true;
159+ Q_EMIT categoriesChanged();
160+ }
156}
161}
157
162
158void Scope::setFavorite(const bool favorite)
163void Scope::setFavorite(const bool favorite)
tests/mocks/Unity/fake_scope.h+1
@@ -109,6 +109,7 @@ protected:
109 bool m_searching;
109 bool m_searching;
110 bool m_favorite;
110 bool m_favorite;
111 bool m_isActive;
111 bool m_isActive;
112+ bool m_hasBeenActive;
112 bool m_hasNavigation;
113 bool m_hasNavigation;
113 bool m_hasPrimaryFilter;
114 bool m_hasPrimaryFilter;
114 QString m_currentNavigationId;
115 QString m_currentNavigationId;
tests/qmltests/Dash/tst_Dash.qml+56−71
@@ -112,6 +112,19 @@ Item {
112 mouseClick(tile);
112 mouseClick(tile);
113 }
113 }
114
114
115+ function open_manage_dash() {
116+ // Show the manage dash
117+ touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
118+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
119+ tryCompare(bottomEdgeController, "progress", 1);
120+
121+ // Make sure stuff is loaded
122+ var favScopesListCategory = findChild(dash, "scopesListCategoryfavorites");
123+ var favScopesListCategoryList = findChild(favScopesListCategory, "scopesListCategoryInnerList");
124+ waitForRendering(favScopesListCategoryList);
125+ tryCompare(favScopesListCategoryList, "currentIndex", 0);
126+ }
127+
115 function test_longNavigationFilterList() {
128 function test_longNavigationFilterList() {
116 // Select the scope with long navigation
129 // Select the scope with long navigation
117 dash.setCurrentScope("LongPrimaryNavigation")
130 dash.setCurrentScope("LongPrimaryNavigation")
@@ -121,6 +134,7 @@ Item {
121 var dashContentList = findChild(dashContent, "dashContentList")
134 var dashContentList = findChild(dashContent, "dashContentList")
122 var searchButton = findChild(dashContentList.currentItem, "search_button")
135 var searchButton = findChild(dashContentList.currentItem, "search_button")
123 var extraPanel = findChild(dashContentList.currentItem, "peExtraPanel")
136 var extraPanel = findChild(dashContentList.currentItem, "peExtraPanel")
137+ waitForRendering(extraPanel);
124 tryCompare(extraPanel, "visible", false)
138 tryCompare(extraPanel, "visible", false)
125
139
126 // Open the primaryNavigationFilter
140 // Open the primaryNavigationFilter
@@ -179,22 +193,16 @@ Item {
179 }
193 }
180
194
181 function test_manage_dash_clickscope_unfavoritable() {
195 function test_manage_dash_clickscope_unfavoritable() {
182− // Show the manage dash
196+ open_manage_dash();
183− touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
184− var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
185− tryCompare(bottomEdgeController, "progress", 1);
186−
187− // Make sure stuff is loaded
188− var favScopesListCategory = findChild(dash, "scopesListCategoryfavorites");
189− var favScopesListCategoryList = findChild(favScopesListCategory, "scopesListCategoryInnerList");
190− tryCompare(favScopesListCategoryList, "currentIndex", 0);
191
197
192 // Click scope star area is not visible (i.e. can't be unfavorited)
198 // Click scope star area is not visible (i.e. can't be unfavorited)
199+ var favScopesListCategoryList = findChild(findChild(dash, "scopesListCategoryfavorites"), "scopesListCategoryInnerList");
193 var clickScope = findChild(favScopesListCategoryList, "delegateclickscope");
200 var clickScope = findChild(favScopesListCategoryList, "delegateclickscope");
194 var starArea = findChild(clickScope, "starArea");
201 var starArea = findChild(clickScope, "starArea");
195 compare(starArea.visible, false);
202 compare(starArea.visible, false);
196
203
197 // Go back
204 // Go back
205+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
198 var scopesList = findChild(dash, "scopesList");
206 var scopesList = findChild(dash, "scopesList");
199 var scopesListPageHeader = findChild(scopesList, "pageHeader");
207 var scopesListPageHeader = findChild(scopesList, "pageHeader");
200 var backButton = findChild(scopesListPageHeader, "innerPageHeader").leadingActionBar;
208 var backButton = findChild(scopesListPageHeader, "innerPageHeader").leadingActionBar;
@@ -203,20 +211,14 @@ Item {
203 }
211 }
204
212
205 function test_manage_dash_select_same_favorite() {
213 function test_manage_dash_select_same_favorite() {
206− // Show the manage dash
214+ open_manage_dash();
207− touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
208− var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
209− tryCompare(bottomEdgeController, "progress", 1);
210−
211− // Make sure stuff is loaded
212− var favScopesListCategory = findChild(dash, "scopesListCategoryfavorites");
213− var favScopesListCategoryList = findChild(favScopesListCategory, "scopesListCategoryInnerList");
214− tryCompare(favScopesListCategoryList, "currentIndex", 0);
215
215
216 // Click in first item
216 // Click in first item
217+ var favScopesListCategoryList = findChild(findChild(dash, "scopesListCategoryfavorites"), "scopesListCategoryInnerList");
217 mouseClick(favScopesListCategoryList.currentItem);
218 mouseClick(favScopesListCategoryList.currentItem);
218
219
219 // Make sure animation went back
220 // Make sure animation went back
221+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
220 tryCompare(bottomEdgeController, "progress", 0);
222 tryCompare(bottomEdgeController, "progress", 0);
221
223
222 var dashContentList = findChild(dash, "dashContentList");
224 var dashContentList = findChild(dash, "dashContentList");
@@ -224,31 +226,25 @@ Item {
224 }
226 }
225
227
226 function test_manage_dash_select_different_favorite() {
228 function test_manage_dash_select_different_favorite() {
227− // Show the manage dash
229+ open_manage_dash();
228− touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
229− var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
230− tryCompare(bottomEdgeController, "progress", 1);
231−
232− // Make sure stuff is loaded
233− var favScopesListCategory = findChild(dash, "scopesListCategoryfavorites");
234− var favScopesListCategoryList = findChild(favScopesListCategory, "scopesListCategoryInnerList");
235− tryCompare(favScopesListCategoryList, "currentIndex", 0);
236
230
237 // Click in second item
231 // Click in second item
232+ var favScopesListCategoryList = findChild(findChild(dash, "scopesListCategoryfavorites"), "scopesListCategoryInnerList");
238 favScopesListCategoryList.currentIndex = 1;
233 favScopesListCategoryList.currentIndex = 1;
239 mouseClick(favScopesListCategoryList.currentItem);
234 mouseClick(favScopesListCategoryList.currentItem);
240
235
241 // Make sure animation went back
236 // Make sure animation went back
237+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
242 tryCompare(bottomEdgeController, "progress", 0);
238 tryCompare(bottomEdgeController, "progress", 0);
243 var dashContentList = findChild(dash, "dashContentList");
239 var dashContentList = findChild(dash, "dashContentList");
244 compare(dashContentList.currentIndex, 1);
240 compare(dashContentList.currentIndex, 1);
245 }
241 }
246
242
247 function test_manage_dash_select_non_favorite() {
243 function test_manage_dash_select_non_favorite() {
248− // Show the manage dash
244+ open_manage_dash();
249− touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
245+
250− var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
246+ // Ensure non favorites are visible
251− tryCompare(bottomEdgeController, "progress", 1);
247+ flickToYEnd(findChild(dash,"scopesListFlickable"));
252
248
253 // Make sure stuff is loaded
249 // Make sure stuff is loaded
254 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
250 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
@@ -268,6 +264,7 @@ Item {
268 tryCompare(dashTempScopeItem, "visible", true);
264 tryCompare(dashTempScopeItem, "visible", true);
269
265
270 // Check the manage dash is gone
266 // Check the manage dash is gone
267+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
271 tryCompare(bottomEdgeController, "progress", 0);
268 tryCompare(bottomEdgeController, "progress", 0);
272
269
273 // Go back
270 // Go back
@@ -296,6 +293,7 @@ Item {
296 tryCompare(bottomEdgeController, "progress", 1);
293 tryCompare(bottomEdgeController, "progress", 1);
297
294
298 // Go back
295 // Go back
296+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
299 var scopesList = findChild(dash, "scopesList");
297 var scopesList = findChild(dash, "scopesList");
300 var scopesListPageHeader = findChild(scopesList, "pageHeader");
298 var scopesListPageHeader = findChild(scopesList, "pageHeader");
301 var backButton = findChild(scopesListPageHeader, "innerPageHeader").leadingActionBar;
299 var backButton = findChild(scopesListPageHeader, "innerPageHeader").leadingActionBar;
@@ -358,10 +356,7 @@ Item {
358 }
356 }
359
357
360 function test_manage_dash_store_no_favorites() {
358 function test_manage_dash_store_no_favorites() {
361− // Show the manage dash
359+ open_manage_dash();
362− touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
363− var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
364− tryCompare(bottomEdgeController, "progress", 1);
365
360
366 // clear the favorite scopes
361 // clear the favorite scopes
367 scopes.clearFavorites();
362 scopes.clearFavorites();
@@ -379,6 +374,7 @@ Item {
379
374
380 spy.wait();
375 spy.wait();
381 compare(spy.signalArguments[0][0], "scope://com.canonical.scopes.clickstore");
376 compare(spy.signalArguments[0][0], "scope://com.canonical.scopes.clickstore");
377+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
382 tryCompare(bottomEdgeController, "progress", 0);
378 tryCompare(bottomEdgeController, "progress", 0);
383 }
379 }
384
380
@@ -387,17 +383,10 @@ Item {
387 compare(dashContentList.currentIndex, 0);
383 compare(dashContentList.currentIndex, 0);
388 compare(dashContentList.currentItem.scopeId, "MockScope1");
384 compare(dashContentList.currentItem.scopeId, "MockScope1");
389
385
390− // Show the manage dash
386+ open_manage_dash();
391− touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
392− var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
393− tryCompare(bottomEdgeController, "progress", 1);
394−
395− // Make sure stuff is loaded
396− var favScopesListCategory = findChild(dash, "scopesListCategoryfavorites");
397− var favScopesListCategoryList = findChild(favScopesListCategory, "scopesListCategoryInnerList");
398− tryCompare(favScopesListCategoryList, "currentIndex", 0);
399
387
400 // Enter edit mode
388 // Enter edit mode
389+ var favScopesListCategoryList = findChild(findChild(dash, "scopesListCategoryfavorites"), "scopesListCategoryInnerList");
401 var scopesList = findChild(dash, "scopesList");
390 var scopesList = findChild(dash, "scopesList");
402 var clickScope = findChild(favScopesListCategoryList, "delegateclickscope");
391 var clickScope = findChild(favScopesListCategoryList, "delegateclickscope");
403 mousePress(clickScope);
392 mousePress(clickScope);
@@ -408,6 +397,7 @@ Item {
408 touchFlick(starArea, 0, 0, 0, -units.gu(10));
397 touchFlick(starArea, 0, 0, 0, -units.gu(10));
409
398
410 // Exit edit mode and go back
399 // Exit edit mode and go back
400+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
411 var scopesList = findChild(dash, "scopesList");
401 var scopesList = findChild(dash, "scopesList");
412 var scopesListPageHeader = findChild(scopesList, "pageHeader");
402 var scopesListPageHeader = findChild(scopesList, "pageHeader");
413 var backButton = findChild(scopesListPageHeader, "innerPageHeader").leadingActionBar;
403 var backButton = findChild(scopesListPageHeader, "innerPageHeader").leadingActionBar;
@@ -429,17 +419,10 @@ Item {
429 compare(dashContentList.currentIndex, 0);
419 compare(dashContentList.currentIndex, 0);
430 compare(dashContentList.currentItem.scopeId, "MockScope1");
420 compare(dashContentList.currentItem.scopeId, "MockScope1");
431
421
432− // Show the manage dash
422+ open_manage_dash();
433− touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
434− var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
435− tryCompare(bottomEdgeController, "progress", 1);
436−
437− // Make sure stuff is loaded
438− var favScopesListCategory = findChild(dash, "scopesListCategoryfavorites");
439− var favScopesListCategoryList = findChild(favScopesListCategory, "scopesListCategoryInnerList");
440− tryCompare(favScopesListCategoryList, "currentIndex", 0);
441
423
442 // Enter edit mode
424 // Enter edit mode
425+ var favScopesListCategoryList = findChild(findChild(dash, "scopesListCategoryfavorites"), "scopesListCategoryInnerList");
443 var scopesList = findChild(dash, "scopesList");
426 var scopesList = findChild(dash, "scopesList");
444 var clickScope = findChild(favScopesListCategoryList, "delegateclickscope");
427 var clickScope = findChild(favScopesListCategoryList, "delegateclickscope");
445 mousePress(clickScope);
428 mousePress(clickScope);
@@ -459,6 +442,8 @@ Item {
459 mouseClick(backButton);
442 mouseClick(backButton);
460
443
461 // Click on third scope
444 // Click on third scope
445+ var favScopesListCategoryList = findChild(findChild(dash, "scopesListCategoryfavorites"), "scopesListCategoryInnerList");
446+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
462 var mockScope5 = findChild(favScopesListCategoryList, "delegateMockScope5");
447 var mockScope5 = findChild(favScopesListCategoryList, "delegateMockScope5");
463 waitForRendering(mockScope5)
448 waitForRendering(mockScope5)
464 mouseClick(mockScope5);
449 mouseClick(mockScope5);
@@ -472,14 +457,12 @@ Item {
472 compare(dashContentList.currentIndex, 0);
457 compare(dashContentList.currentIndex, 0);
473 compare(dashContentList.currentItem.scopeId, "MockScope1");
458 compare(dashContentList.currentItem.scopeId, "MockScope1");
474
459
475− // Show the manage dash
460+ open_manage_dash();
476− touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
477− var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
478− tryCompare(bottomEdgeController, "progress", 1);
479
461
480 var dashCommunicatorService = findInvisibleChild(dash, "dashCommunicatorService");
462 var dashCommunicatorService = findInvisibleChild(dash, "dashCommunicatorService");
481 dashCommunicatorService.mockSetCurrentScope(1, true, false);
463 dashCommunicatorService.mockSetCurrentScope(1, true, false);
482
464
465+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
483 tryCompare(bottomEdgeController, "progress", 0);
466 tryCompare(bottomEdgeController, "progress", 0);
484 tryCompare(dashContentList, "currentIndex", 1)
467 tryCompare(dashContentList, "currentIndex", 1)
485 }
468 }
@@ -507,10 +490,10 @@ Item {
507 }
490 }
508
491
509 function test_close_temp_scope_preview_opening_scope() {
492 function test_close_temp_scope_preview_opening_scope() {
510− // Show the manage dash
493+ open_manage_dash();
511− touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
494+
512− var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
495+ // Ensure non favorite scopes are visible
513− tryCompare(bottomEdgeController, "progress", 1);
496+ flickToYEnd(findChild(dash, "scopesListFlickable"));
514
497
515 // Make sure stuff is loaded
498 // Make sure stuff is loaded
516 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
499 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
@@ -530,6 +513,7 @@ Item {
530 tryCompare(dashTempScopeItem, "visible", true);
513 tryCompare(dashTempScopeItem, "visible", true);
531
514
532 // Check the manage dash is gone
515 // Check the manage dash is gone
516+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
533 tryCompare(bottomEdgeController, "progress", 0);
517 tryCompare(bottomEdgeController, "progress", 0);
534
518
535 // Open preview
519 // Open preview
@@ -580,12 +564,10 @@ Item {
580 UriHandler.opened("scopes://clickscope");
564 UriHandler.opened("scopes://clickscope");
581 tryCompare(dashContentList, "currentIndex", 1);
565 tryCompare(dashContentList, "currentIndex", 1);
582
566
583− // Show the manage dash
567+ open_manage_dash();
584− touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
585− var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
586− tryCompare(bottomEdgeController, "progress", 1);
587
568
588 // UriHandler changes to a scope and closes the manage scopes
569 // UriHandler changes to a scope and closes the manage scopes
570+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
589 UriHandler.opened("scopes://MockScope1");
571 UriHandler.opened("scopes://MockScope1");
590 tryCompare(dashContentList, "currentIndex", 0);
572 tryCompare(dashContentList, "currentIndex", 0);
591 tryCompare(bottomEdgeController, "progress", 0);
573 tryCompare(bottomEdgeController, "progress", 0);
@@ -603,11 +585,11 @@ Item {
603 tryCompare(dashContent, "subPageShown", false);
585 tryCompare(dashContent, "subPageShown", false);
604
586
605 // Go to a temp scope
587 // Go to a temp scope
606− touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
588+ open_manage_dash();
607− var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
589+
608− tryCompare(bottomEdgeController, "progress", 1);
609 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
590 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
610 var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");
591 var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");
592+ flickToYEnd(findChild(dash, "scopesListFlickable"));
611 tryCompare(nonfavScopesListCategoryList, "currentIndex", 0);
593 tryCompare(nonfavScopesListCategoryList, "currentIndex", 0);
612 mouseClick(nonfavScopesListCategoryList.currentItem);
594 mouseClick(nonfavScopesListCategoryList.currentItem);
613 var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
595 var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
@@ -666,12 +648,15 @@ Item {
666 function test_tempScopeItemXOnResize()
648 function test_tempScopeItemXOnResize()
667 {
649 {
668 // Go to a temp scope
650 // Go to a temp scope
669− touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
651+ open_manage_dash();
670− var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
652+
671− tryCompare(bottomEdgeController, "progress", 1);
672 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
653 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
673 var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");
654 var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");
655+ var scopesListFlickable = findChild(dash, "scopesListFlickable");
674 tryCompare(nonfavScopesListCategoryList, "currentIndex", 0);
656 tryCompare(nonfavScopesListCategoryList, "currentIndex", 0);
657+
658+ // Ensure the non-favorites, located at the bottom, are visible
659+ flickToYEnd(scopesListFlickable);
675 mouseClick(nonfavScopesListCategoryList.currentItem);
660 mouseClick(nonfavScopesListCategoryList.currentItem);
676 var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
661 var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
677 tryCompare(dashTempScopeItem, "x", 0);
662 tryCompare(dashTempScopeItem, "x", 0);
tests/qmltests/Dash/tst_DashContent.qml+7−1
@@ -70,7 +70,7 @@ Item {
70 function loadScopes() {
70 function loadScopes() {
71 scopeLoadedSpy.clear();
71 scopeLoadedSpy.clear();
72 scopesModel.load();
72 scopesModel.load();
73− tryCompare(scopeLoadedSpy, "count", 6, 15000);
73+ tryCompare(scopeLoadedSpy, "count", 8, 15000);
74 tryCompare(scopesModel, "loaded", true);
74 tryCompare(scopesModel, "loaded", true);
75 tryCompareFunction(function() {
75 tryCompareFunction(function() {
76 var mockScope1Loader = findChild(shell, "scopeLoader0");
76 var mockScope1Loader = findChild(shell, "scopeLoader0");
@@ -610,6 +610,12 @@ Item {
610 }
610 }
611
611
612 function test_noDelegateCreationDestructionOnMove() {
612 function test_noDelegateCreationDestructionOnMove() {
613+ // Go to scope 1 and back so that items are created
614+ // and so this test makes sense
615+ dashContent.setCurrentScopeAtIndex(1);
616+ waitForRendering(dashContent);
617+ dashContent.setCurrentScopeAtIndex(0);
618+
613 // Our cards are of type AbstractButton as defined in CardCreator.js
619 // Our cards are of type AbstractButton as defined in CardCreator.js
614 // This gives also other things that are not cards but for our purpose it
620 // This gives also other things that are not cards but for our purpose it
615 // does not matter
621 // does not matter
tests/qmltests/Dash/tst_GenericScopeView.qml+7
@@ -76,6 +76,7 @@ Item {
76 tryCompare(scopes, "loaded", true);
76 tryCompare(scopes, "loaded", true);
77
77
78 genericScopeView.scope = scopes.getScope(2);
78 genericScopeView.scope = scopes.getScope(2);
79+ genericScopeView.isCurrent = true;
79 shell.width = units.gu(120);
80 shell.width = units.gu(120);
80 genericScopeView.categoryView.positionAtBeginning();
81 genericScopeView.categoryView.positionAtBeginning();
81 waitForRendering(genericScopeView.categoryView);
82 waitForRendering(genericScopeView.categoryView);
@@ -116,6 +117,7 @@ Item {
116 }
117 }
117
118
118 function test_isActive() {
119 function test_isActive() {
120+ genericScopeView.isCurrent = false
119 tryCompare(genericScopeView.scope, "isActive", false)
121 tryCompare(genericScopeView.scope, "isActive", false)
120 genericScopeView.isCurrent = true
122 genericScopeView.isCurrent = true
121 tryCompare(genericScopeView.scope, "isActive", true)
123 tryCompare(genericScopeView.scope, "isActive", true)
@@ -140,6 +142,7 @@ Item {
140 }
142 }
141
143
142 function test_searchQuery() {
144 function test_searchQuery() {
145+ genericScopeView.isCurrent = false
143 genericScopeView.scope = scopes.getScope(0);
146 genericScopeView.scope = scopes.getScope(0);
144 genericScopeView.scope.searchQuery = "test";
147 genericScopeView.scope.searchQuery = "test";
145 genericScopeView.scope = scopes.getScope(1);
148 genericScopeView.scope = scopes.getScope(1);
@@ -151,6 +154,7 @@ Item {
151 }
154 }
152
155
153 function test_changeScope() {
156 function test_changeScope() {
157+ genericScopeView.isCurrent = false;
154 genericScopeView.scope.searchQuery = "test"
158 genericScopeView.scope.searchQuery = "test"
155 var originalScopeId = genericScopeView.scope.id;
159 var originalScopeId = genericScopeView.scope.id;
156 genericScopeView.scope = scopes.getScope(originalScopeId + 1)
160 genericScopeView.scope = scopes.getScope(originalScopeId + 1)
@@ -458,6 +462,7 @@ Item {
458 function test_seeAllTwoCategoriesScenario1() {
462 function test_seeAllTwoCategoriesScenario1() {
459 mockScope.setId("mockScope");
463 mockScope.setId("mockScope");
460 mockScope.setName("Mock Scope");
464 mockScope.setName("Mock Scope");
465+ mockScope.isActive = true;
461 mockScope.categories.setCount(2);
466 mockScope.categories.setCount(2);
462 mockScope.categories.resultModel(0).setResultCount(50);
467 mockScope.categories.resultModel(0).setResultCount(50);
463 mockScope.categories.resultModel(1).setResultCount(25);
468 mockScope.categories.resultModel(1).setResultCount(25);
@@ -501,6 +506,7 @@ Item {
501 function test_seeAllTwoCategoriesScenario2() {
506 function test_seeAllTwoCategoriesScenario2() {
502 mockScope.setId("mockScope");
507 mockScope.setId("mockScope");
503 mockScope.setName("Mock Scope");
508 mockScope.setName("Mock Scope");
509+ mockScope.isActive = true;
504 mockScope.categories.setCount(2);
510 mockScope.categories.setCount(2);
505 mockScope.categories.resultModel(0).setResultCount(25);
511 mockScope.categories.resultModel(0).setResultCount(25);
506 mockScope.categories.resultModel(1).setResultCount(50);
512 mockScope.categories.resultModel(1).setResultCount(50);
@@ -629,6 +635,7 @@ Item {
629 var category0 = findChild(categoryListView, "dashCategory0");
635 var category0 = findChild(categoryListView, "dashCategory0");
630 waitForRendering(category0);
636 waitForRendering(category0);
631
637
638+ tryCompareFunction(function() { return category0.item != null; }, true);
632 var cardGrid = category0.item;
639 var cardGrid = category0.item;
633 compare(cardGrid.cardTool.template["non-interactive"], true);
640 compare(cardGrid.cardTool.template["non-interactive"], true);
634
641