@@ -28,60 +28,60 @@ Item {
2828
2929 property ListModel searchHistory: ListModel {}
3030
31− property var lensStatus: {
32− 'MockLens1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
33− 'MockLens2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
34− 'MockLens3': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
35− 'MockLens4': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
36− 'MockLens5': { 'movementStarted': 0, 'positionedAtBeginning': 0 }
31+ property var scopeStatus: {
32+ 'MockScope1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
33+ 'MockScope2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
34+ 'MockScope3': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
35+ 'MockScope4': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
36+ 'MockScope5': { 'movementStarted': 0, 'positionedAtBeginning': 0 }
3737 }
3838
39− Lenses {
40− id: lensesModel
39+ Scopes {
40+ id: scopesModel
4141 }
4242
4343 DashContent {
4444 id: dashContent
4545 anchors.fill: parent
4646
47− model: lensesModel
48− lenses : lensesModel
47+ model: scopesModel
48+ scopes : scopesModel
4949
50− lensMapper : lensDelegateMapper
50+ scopeMapper : scopeDelegateMapper
5151 }
5252
53− LensDelegateMapper {
54− id: lensDelegateMapper
55− lensDelegateMapping: {
56− "MockLens1": "../tests/qmltests/Dash/qml/fake_lensView1.qml",
57− "MockLens2": "../tests/qmltests/Dash/qml/fake_lensView2.qml",
58− "MockLens3": "../tests/qmltests/Dash/qml/fake_lensView3.qml",
59− "MockLens4": "../tests/qmltests/Dash/qml/fake_lensView4.qml"
53+ ScopeDelegateMapper {
54+ id: scopeDelegateMapper
55+ scopeDelegateMapping: {
56+ "MockScope1": "../tests/qmltests/Dash/qml/fake_scopeView1.qml",
57+ "MockScope2": "../tests/qmltests/Dash/qml/fake_scopeView2.qml",
58+ "MockScope3": "../tests/qmltests/Dash/qml/fake_scopeView3.qml",
59+ "MockScope4": "../tests/qmltests/Dash/qml/fake_scopeView4.qml"
6060 }
61− genericLens: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"
61+ genericScope: "../tests/qmltests/Dash/qml/fake_generic_scopeView.qml"
6262 }
6363
64− function clear_lens_status() {
65− lensStatus["MockLens1"].movementStarted = 0;
66− lensStatus["MockLens1"].positionedAtBeginning = 0;
64+ function clear_scope_status() {
65+ scopeStatus["MockScope1"].movementStarted = 0;
66+ scopeStatus["MockScope1"].positionedAtBeginning = 0;
6767
68− lensStatus["MockLens2"].movementStarted = 0;
69− lensStatus["MockLens2"].positionedAtBeginning = 0;
68+ scopeStatus["MockScope2"].movementStarted = 0;
69+ scopeStatus["MockScope2"].positionedAtBeginning = 0;
7070
71− lensStatus["MockLens3"].movementStarted = 0;
72− lensStatus["MockLens3"].positionedAtBeginning = 0;
71+ scopeStatus["MockScope3"].movementStarted = 0;
72+ scopeStatus["MockScope3"].positionedAtBeginning = 0;
7373
74− lensStatus["MockLens4"].movementStarted = 0;
75− lensStatus["MockLens4"].positionedAtBeginning = 0;
74+ scopeStatus["MockScope4"].movementStarted = 0;
75+ scopeStatus["MockScope4"].positionedAtBeginning = 0;
7676
77− lensStatus["MockLens5"].movementStarted = 0;
78− lensStatus["MockLens5"].positionedAtBeginning = 0;
77+ scopeStatus["MockScope5"].movementStarted = 0;
78+ scopeStatus["MockScope5"].positionedAtBeginning = 0;
7979 }
8080
8181 SignalSpy {
82− id: lensLoadedSpy
82+ id: scopeLoadedSpy
8383 target: dashContent
84− signalName: "lensLoaded"
84+ signalName: "scopeLoaded"
8585 }
8686
8787 SignalSpy {
@@ -101,78 +101,81 @@ Item {
101101 when: windowShown
102102
103103 function init() {
104− lensLoadedSpy.clear();
104+ scopeLoadedSpy.clear();
105105 movementStartedSpy.clear();
106106 contentEndReachedSpy.clear()
107− clear_lens_status();
107+ clear_scope_status();
108108
109− // clear, wait for dahs to empty and load lenses.
109+ // clear, wait for dahs to empty and load scopes.
110110 var dashContentList = findChild(dashContent, "dashContentList");
111111 verify(dashContentList != undefined)
112− lensesModel.clear();
112+ scopesModel.clear();
113113 tryCompare(dashContentList, "count", 0);
114− lensesModel.load();
114+ scopesModel.load();
115115 }
116116
117117 function test_movement_started_signal() {
118− dashContent.setCurrentLensAtIndex(3, true, false);
118+ dashContent.setCurrentScopeAtIndex(3, true, false);
119119
120120 var dashContentList = findChild(dashContent, "dashContentList");
121121 verify(dashContentList != undefined)
122− tryCompare(lensLoadedSpy, "count", 5);
122+
123+ tryCompare(scopeLoadedSpy, "count", 5);
123124
124125 dashContentList.movementStarted();
126+
125127 compare(movementStartedSpy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
126− compare(lensStatus["MockLens1"].movementStarted, 1, "MockLens1 should have emitted movementStarted signal when content list did.");
127− compare(lensStatus["MockLens2"].movementStarted, 1, "MockLens2 should have emitted movementStarted signal when content list did.");
128− compare(lensStatus["MockLens3"].movementStarted, 1, "MockLens3 should have emitted movementStarted signal when content list did.");
129− compare(lensStatus["MockLens4"].movementStarted, 1, "MockLens4 should have emitted movementStarted signal when content list did.");
130− compare(lensStatus["MockLens5"].movementStarted, 1, "MockLens5 should have emitted movementStarted signal when content list did.");
128+ compare(scopeStatus["MockScope1"].movementStarted, 1, "MockScope1 should have emitted movementStarted signal when content list did.");
129+ compare(scopeStatus["MockScope2"].movementStarted, 1, "MockScope2 should have emitted movementStarted signal when content list did.");
130+ compare(scopeStatus["MockScope3"].movementStarted, 1, "MockScope3 should have emitted movementStarted signal when content list did.");
131+ compare(scopeStatus["MockScope4"].movementStarted, 1, "MockScope4 should have emitted movementStarted signal when content list did.");
132+ compare(scopeStatus["MockScope5"].movementStarted, 1, "MockScope5 should have emitted movementStarted signal when content list did.");
131133 }
132134
133135 function test_positioned_at_beginning_signal() {
134− dashContent.setCurrentLensAtIndex(3, true, false);
136+ dashContent.setCurrentScopeAtIndex(3, true, false);
135137
136− tryCompare(lensLoadedSpy, "count", 5);
138+ tryCompare(scopeLoadedSpy, "count", 5);
137139
138140 dashContent.positionedAtBeginning();
139− compare(lensStatus["MockLens1"].positionedAtBeginning, 1, "MockLens1 should have emitted positionedAtBeginning signal when DashContent did.");
140− compare(lensStatus["MockLens2"].positionedAtBeginning, 1, "MockLens2 should have emitted positionedAtBeginning signal when DashContent did.");
141− compare(lensStatus["MockLens3"].positionedAtBeginning, 1, "MockLens3 should have emitted positionedAtBeginning signal when DashContent did.");
142− compare(lensStatus["MockLens4"].positionedAtBeginning, 1, "MockLens4 should have emitted positionedAtBeginning signal when DashContent did.");
143− compare(lensStatus["MockLens5"].positionedAtBeginning, 1, "MockLens5 should have emitted positionedAtBeginning signal when DashContent did.");
141+ compare(scopeStatus["MockScope1"].positionedAtBeginning, 1, "MockScope1 should have emitted positionedAtBeginning signal when DashContent did.");
142+ compare(scopeStatus["MockScope2"].positionedAtBeginning, 1, "MockScope2 should have emitted positionedAtBeginning signal when DashContent did.");
143+ compare(scopeStatus["MockScope3"].positionedAtBeginning, 1, "MockScope3 should have emitted positionedAtBeginning signal when DashContent did.");
144+ compare(scopeStatus["MockScope4"].positionedAtBeginning, 1, "MockScope4 should have emitted positionedAtBeginning signal when DashContent did.");
145+ compare(scopeStatus["MockScope5"].positionedAtBeginning, 1, "MockScope5 should have emitted positionedAtBeginning signal when DashContent did.");
144146 }
145147
146− function test_lens_loaded() {
147− tryCompare(lensLoadedSpy, "count", 5);
148+ function test_scope_loaded() {
149+ tryCompare(scopeLoadedSpy, "count", 5);
148150 }
149151
150152 function test_content_end_reached() {
151153 var dashContentList = findChild(dashContent, "dashContentList");
152154 verify(dashContentList != undefined);
153− tryCompare(lensLoadedSpy, "count", 5);
154155
155− dashContent.setCurrentLensAtIndex(0, true, false);
156+ tryCompare(scopeLoadedSpy, "count", 5);
157+ dashContent.setCurrentScopeAtIndex(0, true, false);
156158 dashContentList.currentItem.item.endReached();
157159
158160 compare(contentEndReachedSpy.count, 1);
159161 }
160162
161− // This tests that setting the current lens index will end up at the correct index even if
162− // the lenses are loaded asynchrounsly.
163− function test_set_current_lens_index_async() {
164− verify(lensesModel.loaded == false);
163+ // This tests that setting the current scope index will end up at the correct index even if
164+ // the scopes are loaded asynchrounsly.
165+ function test_set_current_scope_index_async() {
166+ verify(scopesModel.loaded == false);
165167
166168 // next index is 1 if current is -1, otherwise it's current + 1
167169 var next_index = ((dashContent.currentIndex == -1 ? 0 : dashContent.currentIndex) + 1) % 5
168170
169− dashContent.setCurrentLensAtIndex(next_index, true, false);
171+ dashContent.setCurrentScopeAtIndex(next_index, true, false);
170172 tryCompare(dashContent, "currentIndex", next_index);
171− verify(lensesModel.loaded == true);
173+ verify(scopesModel.loaded == true);
172174
173− // test greater than lens count.
174− dashContent.setCurrentLensAtIndex(lensesModel.count, true, false);
175− compare(dashContent.currentIndex, 4);
175+ // test greater than scope count.
176+ var currentScopeIndex = dashContent.currentIndex;
177+ dashContent.setCurrentScopeAtIndex(scopesModel.count, true, false);
178+ compare(dashContent.currentIndex, currentScopeIndex, "Scope should not change if changing to greater index than count");
176179 }
177180
178181 function get_current_item_object_name() {
@@ -187,18 +190,18 @@ Item {
187190 return "";
188191 }
189192
190− function test_lens_mapping_data() {
193+ function test_scope_mapping_data() {
191194 return [
192− {tag: "index0", index: 0, objectName: "fake_lensView1"},
193− {tag: "index1", index: 1, objectName: "fake_lensView2"},
194− {tag: "index2", index: 2, objectName: "fake_lensView3"},
195− {tag: "index3", index: 3, objectName: "fake_lensView4"},
196− {tag: "index4", index: 4, objectName: "fake_generic_lensView"}
195+ {tag: "index0", index: 0, objectName: "fake_scopeView1"},
196+ {tag: "index1", index: 1, objectName: "fake_scopeView2"},
197+ {tag: "index2", index: 2, objectName: "fake_scopeView3"},
198+ {tag: "index3", index: 3, objectName: "fake_scopeView4"},
199+ {tag: "index4", index: 4, objectName: "fake_generic_scopeView"}
197200 ]
198201 }
199202
200− function test_lens_mapping(data) {
201− dashContent.setCurrentLensAtIndex(data.index, true, false);
203+ function test_scope_mapping(data) {
204+ dashContent.setCurrentScopeAtIndex(data.index, true, false);
202205 tryCompareFunction(get_current_item_object_name, data.objectName)
203206 }
204207