@@ -28,60 +28,60 @@ Item {
29 property ListModel searchHistory: ListModel {}
29 property ListModel searchHistory: ListModel {}
31− property var lensStatus: {
31+ property var scopeStatus: {
32− 'MockLens1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
32+ 'MockScope1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
33− 'MockLens2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
33+ 'MockScope2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
34− 'MockLens3': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
34+ 'MockScope3': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
35− 'MockLens4': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
35+ 'MockScope4': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
36− 'MockLens5': { 'movementStarted': 0, 'positionedAtBeginning': 0 }
36+ 'MockScope5': { 'movementStarted': 0, 'positionedAtBeginning': 0 }
40− id: lensesModel
40+ id: scopesModel
43 DashContent {
43 DashContent {
44 id: dashContent
44 id: dashContent
45 anchors.fill: parent
45 anchors.fill: parent
47− model: lensesModel
47+ model: scopesModel
48− lenses : lensesModel
48+ scopes : scopesModel
50− lensMapper : lensDelegateMapper
50+ scopeMapper : scopeDelegateMapper
53− LensDelegateMapper {
53+ ScopeDelegateMapper {
54− id: lensDelegateMapper
54+ id: scopeDelegateMapper
55− lensDelegateMapping: {
55+ scopeDelegateMapping: {
56− "MockLens1": "../tests/qmltests/Dash/qml/fake_lensView1.qml",
56+ "MockScope1": "../tests/qmltests/Dash/qml/fake_scopeView1.qml",
57− "MockLens2": "../tests/qmltests/Dash/qml/fake_lensView2.qml",
57+ "MockScope2": "../tests/qmltests/Dash/qml/fake_scopeView2.qml",
58− "MockLens3": "../tests/qmltests/Dash/qml/fake_lensView3.qml",
58+ "MockScope3": "../tests/qmltests/Dash/qml/fake_scopeView3.qml",
59− "MockLens4": "../tests/qmltests/Dash/qml/fake_lensView4.qml"
59+ "MockScope4": "../tests/qmltests/Dash/qml/fake_scopeView4.qml"
61− genericLens: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"
61+ genericScope: "../tests/qmltests/Dash/qml/fake_generic_scopeView.qml"
64− function clear_lens_status() {
64+ function clear_scope_status() {
65− lensStatus["MockLens1"].movementStarted = 0;
65+ scopeStatus["MockScope1"].movementStarted = 0;
66− lensStatus["MockLens1"].positionedAtBeginning = 0;
66+ scopeStatus["MockScope1"].positionedAtBeginning = 0;
68− lensStatus["MockLens2"].movementStarted = 0;
68+ scopeStatus["MockScope2"].movementStarted = 0;
69− lensStatus["MockLens2"].positionedAtBeginning = 0;
69+ scopeStatus["MockScope2"].positionedAtBeginning = 0;
71− lensStatus["MockLens3"].movementStarted = 0;
71+ scopeStatus["MockScope3"].movementStarted = 0;
72− lensStatus["MockLens3"].positionedAtBeginning = 0;
72+ scopeStatus["MockScope3"].positionedAtBeginning = 0;
74− lensStatus["MockLens4"].movementStarted = 0;
74+ scopeStatus["MockScope4"].movementStarted = 0;
75− lensStatus["MockLens4"].positionedAtBeginning = 0;
75+ scopeStatus["MockScope4"].positionedAtBeginning = 0;
77− lensStatus["MockLens5"].movementStarted = 0;
77+ scopeStatus["MockScope5"].movementStarted = 0;
78− lensStatus["MockLens5"].positionedAtBeginning = 0;
78+ scopeStatus["MockScope5"].positionedAtBeginning = 0;
81 SignalSpy {
81 SignalSpy {
82− id: lensLoadedSpy
82+ id: scopeLoadedSpy
83 target: dashContent
83 target: dashContent
84− signalName: "lensLoaded"
84+ signalName: "scopeLoaded"
87 SignalSpy {
87 SignalSpy {
@@ -101,78 +101,81 @@ Item {
101 when: windowShown
101 when: windowShown
103 function init() {
103 function init() {
104− lensLoadedSpy.clear();
104+ scopeLoadedSpy.clear();
105 movementStartedSpy.clear();
105 movementStartedSpy.clear();
106 contentEndReachedSpy.clear()
106 contentEndReachedSpy.clear()
107− clear_lens_status();
107+ clear_scope_status();
109− // clear, wait for dahs to empty and load lenses.
109+ // clear, wait for dahs to empty and load scopes.
110 var dashContentList = findChild(dashContent, "dashContentList");
110 var dashContentList = findChild(dashContent, "dashContentList");
111 verify(dashContentList != undefined)
111 verify(dashContentList != undefined)
112− lensesModel.clear();
112+ scopesModel.clear();
113 tryCompare(dashContentList, "count", 0);
113 tryCompare(dashContentList, "count", 0);
114− lensesModel.load();
114+ scopesModel.load();
117 function test_movement_started_signal() {
117 function test_movement_started_signal() {
118− dashContent.setCurrentLensAtIndex(3, true, false);
118+ dashContent.setCurrentScopeAtIndex(3, true, false);
120 var dashContentList = findChild(dashContent, "dashContentList");
120 var dashContentList = findChild(dashContent, "dashContentList");
121 verify(dashContentList != undefined)
121 verify(dashContentList != undefined)
122− tryCompare(lensLoadedSpy, "count", 5);
123+ tryCompare(scopeLoadedSpy, "count", 5);
124 dashContentList.movementStarted();
125 dashContentList.movementStarted();
125 compare(movementStartedSpy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
127 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.");
128+ compare(scopeStatus["MockScope1"].movementStarted, 1, "MockScope1 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.");
129+ compare(scopeStatus["MockScope2"].movementStarted, 1, "MockScope2 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.");
130+ compare(scopeStatus["MockScope3"].movementStarted, 1, "MockScope3 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.");
131+ compare(scopeStatus["MockScope4"].movementStarted, 1, "MockScope4 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.");
132+ compare(scopeStatus["MockScope5"].movementStarted, 1, "MockScope5 should have emitted movementStarted signal when content list did.");
133 function test_positioned_at_beginning_signal() {
135 function test_positioned_at_beginning_signal() {
134− dashContent.setCurrentLensAtIndex(3, true, false);
136+ dashContent.setCurrentScopeAtIndex(3, true, false);
136− tryCompare(lensLoadedSpy, "count", 5);
138+ tryCompare(scopeLoadedSpy, "count", 5);
138 dashContent.positionedAtBeginning();
140 dashContent.positionedAtBeginning();
139− compare(lensStatus["MockLens1"].positionedAtBeginning, 1, "MockLens1 should have emitted positionedAtBeginning signal when DashContent did.");
141+ compare(scopeStatus["MockScope1"].positionedAtBeginning, 1, "MockScope1 should have emitted positionedAtBeginning signal when DashContent did.");
140− compare(lensStatus["MockLens2"].positionedAtBeginning, 1, "MockLens2 should have emitted positionedAtBeginning signal when DashContent did.");
142+ compare(scopeStatus["MockScope2"].positionedAtBeginning, 1, "MockScope2 should have emitted positionedAtBeginning signal when DashContent did.");
141− compare(lensStatus["MockLens3"].positionedAtBeginning, 1, "MockLens3 should have emitted positionedAtBeginning signal when DashContent did.");
143+ compare(scopeStatus["MockScope3"].positionedAtBeginning, 1, "MockScope3 should have emitted positionedAtBeginning signal when DashContent did.");
142− compare(lensStatus["MockLens4"].positionedAtBeginning, 1, "MockLens4 should have emitted positionedAtBeginning signal when DashContent did.");
144+ compare(scopeStatus["MockScope4"].positionedAtBeginning, 1, "MockScope4 should have emitted positionedAtBeginning signal when DashContent did.");
143− compare(lensStatus["MockLens5"].positionedAtBeginning, 1, "MockLens5 should have emitted positionedAtBeginning signal when DashContent did.");
145+ compare(scopeStatus["MockScope5"].positionedAtBeginning, 1, "MockScope5 should have emitted positionedAtBeginning signal when DashContent did.");
146− function test_lens_loaded() {
148+ function test_scope_loaded() {
147− tryCompare(lensLoadedSpy, "count", 5);
149+ tryCompare(scopeLoadedSpy, "count", 5);
150 function test_content_end_reached() {
152 function test_content_end_reached() {
151 var dashContentList = findChild(dashContent, "dashContentList");
153 var dashContentList = findChild(dashContent, "dashContentList");
152 verify(dashContentList != undefined);
154 verify(dashContentList != undefined);
153− tryCompare(lensLoadedSpy, "count", 5);
156+ tryCompare(scopeLoadedSpy, "count", 5);
155− dashContent.setCurrentLensAtIndex(0, true, false);
157+ dashContent.setCurrentScopeAtIndex(0, true, false);
156 dashContentList.currentItem.item.endReached();
158 dashContentList.currentItem.item.endReached();
158 compare(contentEndReachedSpy.count, 1);
160 compare(contentEndReachedSpy.count, 1);
161− // This tests that setting the current lens index will end up at the correct index even if
163+ // This tests that setting the current scope index will end up at the correct index even if
162− // the lenses are loaded asynchrounsly.
164+ // the scopes are loaded asynchrounsly.
163− function test_set_current_lens_index_async() {
165+ function test_set_current_scope_index_async() {
164− verify(lensesModel.loaded == false);
166+ verify(scopesModel.loaded == false);
166 // next index is 1 if current is -1, otherwise it's current + 1
168 // next index is 1 if current is -1, otherwise it's current + 1
167 var next_index = ((dashContent.currentIndex == -1 ? 0 : dashContent.currentIndex) + 1) % 5
169 var next_index = ((dashContent.currentIndex == -1 ? 0 : dashContent.currentIndex) + 1) % 5
169− dashContent.setCurrentLensAtIndex(next_index, true, false);
171+ dashContent.setCurrentScopeAtIndex(next_index, true, false);
170 tryCompare(dashContent, "currentIndex", next_index);
172 tryCompare(dashContent, "currentIndex", next_index);
171− verify(lensesModel.loaded == true);
173+ verify(scopesModel.loaded == true);
173− // test greater than lens count.
175+ // test greater than scope count.
176+ var currentScopeIndex = dashContent.currentIndex;
174− dashContent.setCurrentLensAtIndex(lensesModel.count, true, false);
177+ dashContent.setCurrentScopeAtIndex(scopesModel.count, true, false);
175− compare(dashContent.currentIndex, 4);
178+ compare(dashContent.currentIndex, currentScopeIndex, "Scope should not change if changing to greater index than count");
178 function get_current_item_object_name() {
181 function get_current_item_object_name() {
@@ -187,18 +190,18 @@ Item {
187 return "";
190 return "";
190− function test_lens_mapping_data() {
193+ function test_scope_mapping_data() {
192− {tag: "index0", index: 0, objectName: "fake_lensView1"},
195+ {tag: "index0", index: 0, objectName: "fake_scopeView1"},
193− {tag: "index1", index: 1, objectName: "fake_lensView2"},
196+ {tag: "index1", index: 1, objectName: "fake_scopeView2"},
194− {tag: "index2", index: 2, objectName: "fake_lensView3"},
197+ {tag: "index2", index: 2, objectName: "fake_scopeView3"},
195− {tag: "index3", index: 3, objectName: "fake_lensView4"},
198+ {tag: "index3", index: 3, objectName: "fake_scopeView4"},
196− {tag: "index4", index: 4, objectName: "fake_generic_lensView"}
199+ {tag: "index4", index: 4, objectName: "fake_generic_scopeView"}
200− function test_lens_mapping(data) {
203+ function test_scope_mapping(data) {
201− dashContent.setCurrentLensAtIndex(data.index, true, false);
204+ dashContent.setCurrentScopeAtIndex(data.index, true, false);
202 tryCompareFunction(get_current_item_object_name, data.objectName)
205 tryCompareFunction(get_current_item_object_name, data.objectName)