@@ -95,25 +95,19 @@ Item {
9595 signalName: "movementStarted"
9696 }
9797
98− SignalSpy {
99− id: contentEndReachedSpy
100− target: dashContent
101− signalName: "contentEndReached"
102− }
103−
10498 UT.UnityTestCase {
10599 name: "DashContent"
106100 when: scopesModel.loaded
107101
108102 function init() {
109103 scopesModel.clear();
104+ scopeLoadedSpy.clear();
110105 scopesModel.load();
106+ tryCompare(scopeLoadedSpy, "count", 4);
111107 }
112108
113109 function cleanup() {
114− scopeLoadedSpy.clear();
115110 movementStartedSpy.clear();
116− contentEndReachedSpy.clear();
117111 clear_scope_status();
118112 dashContent.visible = true;
119113
@@ -122,17 +116,18 @@ Item {
122116 scopesModel.clear();
123117 // wait for dash to empty scopes.
124118 tryCompare(dashContentList, "count", 0);
125− // this is the default state for empty model
126− dashContentList.currentIndex = -1;
127119 }
128120
129121 function test_current_index() {
130122 var dashContentList = findChild(dashContent, "dashContentList");
131123 verify(dashContentList != undefined)
132124
125+ scopesModel.clear();
133126 compare(dashContentList.count, 0, "DashContent should have 0 items when it starts");
134− compare(dashContentList.currentIndex, -1, "DashContent's currentIndex should be -1 while there have been no items in the model");
127+ tryCompare(dashContentList, "currentIndex", -1);
135128
129+ scopeLoadedSpy.clear();
130+ scopesModel.load();
136131 tryCompare(scopeLoadedSpy, "count", 4);
137132
138133 verify(dashContentList.currentIndex >= 0);
@@ -142,10 +137,13 @@ Item {
142137 var dashContentList = findChild(dashContent, "dashContentList");
143138 verify(dashContentList != undefined)
144139
145− compare(dashContentList.count, 0, "DashContent should have 0 items when it starts");
140+ scopesModel.clear();
141+ compare(dashContentList.count, 0, "DashContent should have 0 items after clearing");
146142 // pretend we're running after a model reset
147143 dashContentList.currentIndex = 27;
148144
145+ scopeLoadedSpy.clear();
146+ scopesModel.load();
149147 tryCompare(scopeLoadedSpy, "count", 4);
150148
151149 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < 5);
@@ -157,8 +155,6 @@ Item {
157155 var dashContentList = findChild(dashContent, "dashContentList");
158156 verify(dashContentList != undefined)
159157
160− tryCompare(scopeLoadedSpy, "count", 4);
161−
162158 dashContentList.movementStarted();
163159
164160 compare(movementStartedSpy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
@@ -171,8 +167,6 @@ Item {
171167 function test_positioned_at_beginning_signal() {
172168 dashContent.setCurrentScopeAtIndex(3, true, false);
173169
174− tryCompare(scopeLoadedSpy, "count", 4);
175−
176170 dashContent.positionedAtBeginning();
177171 compare(scopeStatus["MockScope1"].positionedAtBeginning, 1, "MockScope1 should have emitted positionedAtBeginning signal when DashContent did.");
178172 compare(scopeStatus["MockScope2"].positionedAtBeginning, 1, "MockScope2 should have emitted positionedAtBeginning signal when DashContent did.");
@@ -180,30 +174,17 @@ Item {
180174 compare(scopeStatus["MockScope5"].positionedAtBeginning, 1, "MockScope5 should have emitted positionedAtBeginning signal when DashContent did.");
181175 }
182176
183− function test_scope_loaded() {
184− tryCompare(scopeLoadedSpy, "count", 4);
185− }
186−
187− function test_content_end_reached() {
188− var dashContentList = findChild(dashContent, "dashContentList");
189− verify(dashContentList != undefined);
190−
191− tryCompare(scopeLoadedSpy, "count", 4);
192− dashContent.setCurrentScopeAtIndex(0, true, false);
193− dashContentList.currentItem.item.endReached();
194−
195− compare(contentEndReachedSpy.count, 1);
196− }
197−
198177 // This tests that setting the current scope index will end up at the correct index even if
199178 // the scopes are loaded asynchrounsly.
200179 function test_set_current_scope_index_async() {
180+ scopesModel.clear();
201181 verify(scopesModel.loaded == false);
202182
203− // next index is 1 if current is -1, otherwise it's current + 1
204− var next_index = ((dashContent.currentIndex == -1 ? 0 : dashContent.currentIndex) + 1) % 5
183+ tryCompare(dashContent, "currentIndex", -1);
184+ var next_index = 1
205185
206186 dashContent.setCurrentScopeAtIndex(next_index, true, false);
187+ scopesModel.load();
207188 tryCompare(dashContent, "currentIndex", next_index);
208189 verify(scopesModel.loaded == true);
209190
@@ -252,8 +233,6 @@ Item {
252233 function test_is_active(data) {
253234 var dashContentList = findChild(dashContent, "dashContentList");
254235
255− tryCompare(scopeLoadedSpy, "count", 4);
256−
257236 dashContent.setCurrentScopeAtIndex(data.select, true, false);
258237 dashContent.visible = data.visible;
259238