@@ -28,7 +28,7 @@ Item {
29 property ListModel searchHistory: ListModel {}
29 property ListModel searchHistory: ListModel {}
31− property var lens_status: {
31+ property var lensStatus: {
32 'MockLens1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
32 'MockLens1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
33 'MockLens2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
33 'MockLens2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
34 'MockLens3': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
34 'MockLens3': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
@@ -41,53 +41,58 @@ Item {
43 DashContent {
43 DashContent {
44− id: dash_content
44+ id: dashContent
45 anchors.fill: parent
45 anchors.fill: parent
47 model: lensesModel
47 model: lensesModel
48 lenses : lensesModel
48 lenses : lensesModel
50− lensDelegateMapping: { "MockLens3" : "../tests/qmltests/Dash/qml/fake_lensView3.qml",
50+ lensMapper : lensDelegateMapper
51− "MockLens2" : "../tests/qmltests/Dash/qml/fake_lensView2.qml",
52− "MockLens1" : "../tests/qmltests/Dash/qml/fake_lensView1.qml",
53− "MockLens4" : "../tests/qmltests/Dash/qml/fake_lensView4.qml"
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"
56 genericLens: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"
61 genericLens: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"
59 function clear_lens_status() {
64 function clear_lens_status() {
60− lens_status["MockLens1"].movementStarted = 0;
65+ lensStatus["MockLens1"].movementStarted = 0;
61− lens_status["MockLens1"].positionedAtBeginning = 0;
66+ lensStatus["MockLens1"].positionedAtBeginning = 0;
63− lens_status["MockLens2"].movementStarted = 0;
68+ lensStatus["MockLens2"].movementStarted = 0;
64− lens_status["MockLens2"].positionedAtBeginning = 0;
69+ lensStatus["MockLens2"].positionedAtBeginning = 0;
66− lens_status["MockLens3"].movementStarted = 0;
71+ lensStatus["MockLens3"].movementStarted = 0;
67− lens_status["MockLens3"].positionedAtBeginning = 0;
72+ lensStatus["MockLens3"].positionedAtBeginning = 0;
69− lens_status["MockLens4"].movementStarted = 0;
74+ lensStatus["MockLens4"].movementStarted = 0;
70− lens_status["MockLens4"].positionedAtBeginning = 0;
75+ lensStatus["MockLens4"].positionedAtBeginning = 0;
72− lens_status["MockLens5"].movementStarted = 0;
77+ lensStatus["MockLens5"].movementStarted = 0;
73− lens_status["MockLens5"].positionedAtBeginning = 0;
78+ lensStatus["MockLens5"].positionedAtBeginning = 0;
76 SignalSpy {
81 SignalSpy {
77− id: lensLoaded_spy
82+ id: lensLoadedSpy
78− target: dash_content
83+ target: dashContent
79 signalName: "lensLoaded"
84 signalName: "lensLoaded"
82 SignalSpy {
87 SignalSpy {
83− id: movementStarted_spy
88+ id: movementStartedSpy
84− target: dash_content
89+ target: dashContent
85 signalName: "movementStarted"
90 signalName: "movementStarted"
88 SignalSpy {
93 SignalSpy {
89− id: contentEndReached_spy
94+ id: contentEndReachedSpy
90− target: dash_content
95+ target: dashContent
91 signalName: "contentEndReached"
96 signalName: "contentEndReached"
@@ -96,13 +101,13 @@ Item {
96 when: windowShown
101 when: windowShown
98 function init() {
103 function init() {
99− lensLoaded_spy.clear();
104+ lensLoadedSpy.clear();
100− movementStarted_spy.clear();
105+ movementStartedSpy.clear();
101− contentEndReached_spy.clear()
106+ contentEndReachedSpy.clear()
102 clear_lens_status();
107 clear_lens_status();
104 // clear, wait for dahs to empty and load lenses.
109 // clear, wait for dahs to empty and load lenses.
105− var dashContentList = findChild(dash_content, "dashContentList");
110+ var dashContentList = findChild(dashContent, "dashContentList");
106 verify(dashContentList != undefined)
111 verify(dashContentList != undefined)
107 lensesModel.clear();
112 lensesModel.clear();
108 tryCompare(dashContentList, "count", 0);
113 tryCompare(dashContentList, "count", 0);
@@ -110,47 +115,47 @@ Item {
112 function test_movement_started_signal() {
117 function test_movement_started_signal() {
113− dash_content.setCurrentLensAtIndex(3, true, false);
118+ dashContent.setCurrentLensAtIndex(3, true, false);
115− var dashContentList = findChild(dash_content, "dashContentList");
120+ var dashContentList = findChild(dashContent, "dashContentList");
116 verify(dashContentList != undefined)
121 verify(dashContentList != undefined)
117− tryCompare(lensLoaded_spy, "count", 5);
122+ tryCompare(lensLoadedSpy, "count", 5);
119 dashContentList.movementStarted();
124 dashContentList.movementStarted();
120− compare(movementStarted_spy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
125+ compare(movementStartedSpy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
121− compare(lens_status["MockLens1"].movementStarted, 1, "MockLens1 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.");
122− compare(lens_status["MockLens2"].movementStarted, 1, "MockLens2 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.");
123− compare(lens_status["MockLens3"].movementStarted, 1, "MockLens3 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.");
124− compare(lens_status["MockLens4"].movementStarted, 1, "MockLens4 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.");
125− compare(lens_status["MockLens5"].movementStarted, 1, "MockLens5 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 function test_positioned_at_beginning_signal() {
133 function test_positioned_at_beginning_signal() {
129− dash_content.setCurrentLensAtIndex(3, true, false);
134+ dashContent.setCurrentLensAtIndex(3, true, false);
131− tryCompare(lensLoaded_spy, "count", 5);
136+ tryCompare(lensLoadedSpy, "count", 5);
133− dash_content.positionedAtBeginning();
138+ dashContent.positionedAtBeginning();
134− compare(lens_status["MockLens1"].positionedAtBeginning, 1, "MockLens1 should have emitted positionedAtBeginning signal when DashContent did.");
139+ compare(lensStatus["MockLens1"].positionedAtBeginning, 1, "MockLens1 should have emitted positionedAtBeginning signal when DashContent did.");
135− compare(lens_status["MockLens2"].positionedAtBeginning, 1, "MockLens2 should have emitted positionedAtBeginning signal when DashContent did.");
140+ compare(lensStatus["MockLens2"].positionedAtBeginning, 1, "MockLens2 should have emitted positionedAtBeginning signal when DashContent did.");
136− compare(lens_status["MockLens3"].positionedAtBeginning, 1, "MockLens3 should have emitted positionedAtBeginning signal when DashContent did.");
141+ compare(lensStatus["MockLens3"].positionedAtBeginning, 1, "MockLens3 should have emitted positionedAtBeginning signal when DashContent did.");
137− compare(lens_status["MockLens4"].positionedAtBeginning, 1, "MockLens4 should have emitted positionedAtBeginning signal when DashContent did.");
142+ compare(lensStatus["MockLens4"].positionedAtBeginning, 1, "MockLens4 should have emitted positionedAtBeginning signal when DashContent did.");
138− compare(lens_status["MockLens5"].positionedAtBeginning, 1, "MockLens5 should have emitted positionedAtBeginning signal when DashContent did.");
143+ compare(lensStatus["MockLens5"].positionedAtBeginning, 1, "MockLens5 should have emitted positionedAtBeginning signal when DashContent did.");
141 function test_lens_loaded() {
146 function test_lens_loaded() {
142− tryCompare(lensLoaded_spy, "count", 5);
147+ tryCompare(lensLoadedSpy, "count", 5);
145 function test_content_end_reached() {
150 function test_content_end_reached() {
146− var dashContentList = findChild(dash_content, "dashContentList");
151+ var dashContentList = findChild(dashContent, "dashContentList");
147 verify(dashContentList != undefined);
152 verify(dashContentList != undefined);
148− tryCompare(lensLoaded_spy, "count", 5);
153+ tryCompare(lensLoadedSpy, "count", 5);
150− dash_content.setCurrentLensAtIndex(0, true, false);
155+ dashContent.setCurrentLensAtIndex(0, true, false);
151 dashContentList.currentItem.item.endReached();
156 dashContentList.currentItem.item.endReached();
153− compare(contentEndReached_spy.count, 1);
158+ compare(contentEndReachedSpy.count, 1);
156 // This tests that setting the current lens index will end up at the correct index even if
161 // This tests that setting the current lens index will end up at the correct index even if
@@ -159,19 +164,19 @@ Item {
159 verify(lensesModel.loaded == false);
164 verify(lensesModel.loaded == false);
161 // next index is 1 if current is -1, otherwise it's current + 1
166 // next index is 1 if current is -1, otherwise it's current + 1
162− var next_index = ((dash_content.currentIndex == -1 ? 0 : dash_content.currentIndex) + 1) % 5
167+ var next_index = ((dashContent.currentIndex == -1 ? 0 : dashContent.currentIndex) + 1) % 5
164− dash_content.setCurrentLensAtIndex(next_index, true, false);
169+ dashContent.setCurrentLensAtIndex(next_index, true, false);
165− tryCompare(dash_content, "currentIndex", next_index);
170+ tryCompare(dashContent, "currentIndex", next_index);
166 verify(lensesModel.loaded == true);
171 verify(lensesModel.loaded == true);
168 // test greater than lens count.
173 // test greater than lens count.
169− dash_content.setCurrentLensAtIndex(lensesModel.count, true, false);
174+ dashContent.setCurrentLensAtIndex(lensesModel.count, true, false);
170− compare(dash_content.currentIndex, 4);
175+ compare(dashContent.currentIndex, 4);
173 function get_current_item_object_name() {
178 function get_current_item_object_name() {
174− var dashContentList = findChild(dash_content, "dashContentList");
179+ var dashContentList = findChild(dashContent, "dashContentList");
175 verify(dashContentList != undefined);
180 verify(dashContentList != undefined);
177 if (dashContentList.currentItem != undefined) {
182 if (dashContentList.currentItem != undefined) {
@@ -193,7 +198,7 @@ Item {
195 function test_lens_mapping(data) {
200 function test_lens_mapping(data) {
196− dash_content.setCurrentLensAtIndex(data.index, true, false);
201+ dashContent.setCurrentLensAtIndex(data.index, true, false);
197 tryCompareFunction(get_current_item_object_name, data.objectName)
202 tryCompareFunction(get_current_item_object_name, data.objectName)