on xenial help sign in
Added Dash tests.
fe7ed42Nick Dedekind
Dash/Dash.qml+2
@@ -59,6 +59,7 @@ Showable {
59
59
60 DashContent {
60 DashContent {
61 id: dashContent
61 id: dashContent
62+ objectName: "dashContent"
62 anchors.fill: parent
63 anchors.fill: parent
63 model: filteredLenses
64 model: filteredLenses
64 lenses: lenses
65 lenses: lenses
@@ -79,6 +80,7 @@ Showable {
79
80
80 DashBar {
81 DashBar {
81 id: dashbar
82 id: dashbar
83+ objectName: "dashbar"
82 anchors.bottom: parent.bottom
84 anchors.bottom: parent.bottom
83 anchors.left: parent.left
85 anchors.left: parent.left
84 anchors.right: parent.right
86 anchors.right: parent.right
Dash/DashContent.qml+5−16
@@ -28,6 +28,8 @@ Item {
28 property real contentProgress: Math.max(0, Math.min(dashContentList.contentX / (dashContentList.contentWidth - dashContentList.width), units.dp(1)))
28 property real contentProgress: Math.max(0, Math.min(dashContentList.contentX / (dashContentList.contentWidth - dashContentList.width), units.dp(1)))
29 property alias currentIndex: dashContentList.currentIndex
29 property alias currentIndex: dashContentList.currentIndex
30
30
31+ property LensDelegateMapper lensMapper : LensDelegateMapper {}
32+
31 signal movementStarted()
33 signal movementStarted()
32 signal movementEnded()
34 signal movementEnded()
33 signal contentFlickStarted()
35 signal contentFlickStarted()
@@ -79,14 +81,6 @@ Item {
79 }
81 }
80 }
82 }
81
83
82− property var lensDelegateMapping: {"mockmusic.lens": "DashMusic.qml",
83− "applications.lens": "DashApps.qml",
84− "home.lens": "DashHome.qml",
85− "mockvideos.lens": "DashVideos.qml",
86− "people.lens": "DashPeople.qml",
87− }
88− property string genericLens: "GenericLensView.qml"
89−
90 ListView {
84 ListView {
91 id: dashContentList
85 id: dashContentList
92 objectName: "dashContentList"
86 objectName: "dashContentList"
@@ -121,14 +115,7 @@ Item {
121 width: ListView.view.width
115 width: ListView.view.width
122 height: ListView.view.height
116 height: ListView.view.height
123 asynchronous: true
117 asynchronous: true
124− source: {
118+ source: lensMapper.map(lens.id)
125− var customLens = lensDelegateMapping[lens.id]
126− if (customLens) {
127− return customLens
128− } else {
129− return genericLens
130− }
131− }
132 onLoaded: {
119 onLoaded: {
133 item.lens = Qt.binding(function() { return lens })
120 item.lens = Qt.binding(function() { return lens })
134 item.isCurrent = Qt.binding(function() { return ListView.isCurrentItem })
121 item.isCurrent = Qt.binding(function() { return ListView.isCurrentItem })
@@ -150,6 +137,8 @@ Item {
150 }
137 }
151 }
138 }
152 }
139 }
140+
141+ Component.onDestruction: active = false
153 }
142 }
154 }
143 }
155}
144}
Dash/LensDelegateMapper.qmlnew file+35
@@ -0,0 +1,35 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+
19+QtObject {
20+ property var lensDelegateMapping: {"mockmusic.lens": "DashMusic.qml",
21+ "applications.lens": "DashApps.qml",
22+ "home.lens": "DashHome.qml",
23+ "mockvideos.lens": "DashVideos.qml",
24+ "people.lens": "DashPeople.qml",
25+ }
26+ property string genericLens: "GenericLensView.qml"
27+
28+ function map(lensId) {
29+ var customLens = lensDelegateMapping[lensId]
30+ if (customLens != undefined) {
31+ return customLens
32+ }
33+ return genericLens
34+ }
35+}
tests/qmltests/CMakeLists.txt+1
@@ -37,6 +37,7 @@ add_qml_test(Components Stage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}
37 ${CMAKE_BINARY_DIR}/plugins)
37 ${CMAKE_BINARY_DIR}/plugins)
38add_qml_test(Components Tile)
38add_qml_test(Components Tile)
39add_qml_test(Components PageHeader)
39add_qml_test(Components PageHeader)
40+add_qml_test(Dash Dash IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
40add_qml_test(Dash DashBar IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
41add_qml_test(Dash DashBar IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
41add_qml_test(Dash DashContent IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS})
42add_qml_test(Dash DashContent IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS})
42add_qml_test(Dash DashPreview)
43add_qml_test(Dash DashPreview)
tests/qmltests/Dash/qml/FakeLensView.qml+69−42
@@ -22,71 +22,98 @@ FocusScope {
22 property Lens lens : null
22 property Lens lens : null
23 property bool isCurrent : false
23 property bool isCurrent : false
24
24
25− property alias rect_color1 : rect1.color
26− property alias rect_color2 : rect2.color
27− property alias rect_color3 : rect3.color
28−
29 property ListModel searchHistory
25 property ListModel searchHistory
30
26
31 signal endReached
27 signal endReached
32 signal movementStarted
28 signal movementStarted
33 signal positionedAtBeginning
29 signal positionedAtBeginning
34
30
31+ property alias backColor : back.color
32+
35 onEndReached: {
33 onEndReached: {
36− if (shell != undefined && shell.lens_status != undefined) {
34+ if (shell != undefined && shell.lensStatus != undefined) {
37− shell.lens_status[lens.id].endReached++;
35+ shell.lensStatus[lens.id].endReached++;
38 }
36 }
39 }
37 }
40 onMovementStarted: {
38 onMovementStarted: {
41− if (shell != undefined && shell.lens_status != undefined) {
39+ if (shell != undefined && shell.lensStatus != undefined) {
42− shell.lens_status[lens.id].movementStarted++;
40+ shell.lensStatus[lens.id].movementStarted++;
43 }
41 }
44 }
42 }
45 onPositionedAtBeginning: {
43 onPositionedAtBeginning: {
46− if (shell != undefined && shell.lens_status != undefined) {
44+ if (shell != undefined && shell.lensStatus != undefined) {
47− shell.lens_status[lens.id].positionedAtBeginning++;
45+ shell.lensStatus[lens.id].positionedAtBeginning++;
48 }
46 }
49 }
47 }
50
48
49+ Rectangle {
50+ id: back
51+ anchors.fill: parent
52+ color: "grey"
53+ }
54+
55+ function randomBg()
56+ {
57+ var hex1=new Array("4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F")
58+ var bg="#"+hex1[Math.floor(Math.random()*hex1.length)]+
59+ hex1[Math.floor(Math.random()*hex1.length)]+
60+ hex1[Math.floor(Math.random()*hex1.length)]+
61+ hex1[Math.floor(Math.random()*hex1.length)]+
62+ hex1[Math.floor(Math.random()*hex1.length)]+
63+ hex1[Math.floor(Math.random()*hex1.length)]
64+ return bg
65+ }
51
66
52− Column {
67+
68+ ListView {
69+ id: listView
53 anchors.fill: parent
70 anchors.fill: parent
54− Rectangle {
71+ model: lens ? lens.categories : null
55− id: rect1
72+ orientation: ListView.Vertical
56− height: parent.height/3; width: parent.width;
57
73
58− Text {
74+ delegate: Column {
59− id: label1
75+ id: column
60− anchors.fill: parent
76+ width: listView.width
61− verticalAlignment: Text.AlignVCenter
77+ height: childrenRect.height
62− horizontalAlignment: Text.AlignHCenter
63− text: lens ? lens.id : ""
64− }
65− }
66
78
67− Rectangle {
79+ Rectangle {
68− id: rect2
80+ width: listView.width
69− height: parent.height/3; width: parent.width
81+ height: units.gu(3)
82+ color: randomBg()
70
83
71− Text {
84+ Text {
72− id: label2
85+ text: name
86+ font.family: "Ubuntu"
87+ font.weight: Font.Bold
88+ font.pixelSize: 20
73− anchors.fill: parent
89+ anchors.horizontalCenter: parent.horizontalCenter
74− verticalAlignment: Text.AlignVCenter
90+ }
75− horizontalAlignment: Text.AlignHCenter
76− text: lens ? lens.id : ""
77 }
91 }
78− }
92+ GridView {
79−
93+ id: resultsGrid
80− Rectangle {
94+ model: results
81− id: rect3
95+ cellWidth: units.gu(10); cellHeight: units.gu(10)
82− height: parent.height/3; width: parent.width
96+ height: childrenRect.height
97+ width: listView.width
98+ interactive: false
83
99
84− Text {
100+ delegate: Component {
85− id: label3
101+ id: resultDelegate
102+ Item {
103+ width: resultsGrid.cellWidth; height: resultsGrid.cellHeight
104+ Column {
86− anchors.fill: parent
105+ anchors.verticalCenter: parent.verticalCenter
87− verticalAlignment: Text.AlignVCenter
106+ anchors.horizontalCenter: parent.horizontalCenter
88− horizontalAlignment: Text.AlignHCenter
107+ Image {
89− text: lens ? lens.id : ""
108+ width: units.gu(5)
109+ height: units.gu(5)
110+ source: column_1
111+ anchors.horizontalCenter: parent.horizontalCenter
112+ }
113+ Text { text: column_4; anchors.horizontalCenter: parent.horizontalCenter }
114+ }
115+ }
116+ }
90 }
117 }
91 }
118 }
92 }
119 }
tests/qmltests/Dash/qml/fake_generic_lensView.qml+1−3
@@ -20,7 +20,5 @@ FakeLensView {
20 id: fake_generic_lensView
20 id: fake_generic_lensView
21 objectName: "fake_generic_lensView"
21 objectName: "fake_generic_lensView"
22
22
23− rect_color1: "blue"
23+ backColor: "#D0D0D0"
24− rect_color2: "orange"
25− rect_color3: "teal"
26}
24}
tests/qmltests/Dash/qml/fake_lensView1.qml+1−3
@@ -20,7 +20,5 @@ FakeLensView {
20 id: fake_lensView1
20 id: fake_lensView1
21 objectName: "fake_lensView1"
21 objectName: "fake_lensView1"
22
22
23− rect_color1: "red"
23+ backColor: "#909090"
24− rect_color2: "green"
25− rect_color3: "blue"
26}
24}
tests/qmltests/Dash/qml/fake_lensView2.qml+1−3
@@ -20,7 +20,5 @@ FakeLensView {
20 id: fake_lensView2
20 id: fake_lensView2
21 objectName: "fake_lensView2"
21 objectName: "fake_lensView2"
22
22
23− rect_color1: "orange"
23+ backColor: "#A0A0A0"
24− rect_color2: "grey"
25− rect_color3: "purple"
26}
24}
tests/qmltests/Dash/qml/fake_lensView3.qml+1−3
@@ -20,7 +20,5 @@ FakeLensView {
20 id: fake_lensView3
20 id: fake_lensView3
21 objectName: "fake_lensView3"
21 objectName: "fake_lensView3"
22
22
23− rect_color1: "yellow"
23+ backColor: "#B0B0B0"
24− rect_color2: "cyan"
25− rect_color3: "white"
26}
24}
tests/qmltests/Dash/qml/fake_lensView4.qml+1−3
@@ -20,7 +20,5 @@ FakeLensView {
20 id: fake_lensView4
20 id: fake_lensView4
21 objectName: "fake_lensView4"
21 objectName: "fake_lensView4"
22
22
23− rect_color1: "grey"
23+ backColor: "#C0C0C0"
24− rect_color2: "purple"
25− rect_color3: "red"
26}
24}
tests/qmltests/Dash/tst_Dash.qmlnew file+133
@@ -0,0 +1,133 @@
1+/*
2+ * Copyright 2013 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+import QtTest 1.0
19+import "../../../Dash"
20+import Ubuntu.Components 0.1
21+import Unity.Test 0.1 as UT
22+
23+Item {
24+ id: shell
25+ width: units.gu(40)
26+ height: units.gu(80)
27+
28+ property ListModel searchHistory : ListModel {}
29+
30+ Dash {
31+ id: dash
32+ anchors.fill: parent
33+ showLensOnLoaded: "MockLens2"
34+ }
35+
36+ LensDelegateMapper {
37+ id: lensDelegateMapper
38+ lensDelegateMapping: {
39+ "MockLens1": "../tests/qmltests/Dash/qml/fake_lensView1.qml",
40+ "MockLens2": "../tests/qmltests/Dash/qml/fake_lensView2.qml",
41+ "MockLens3": "../tests/qmltests/Dash/qml/fake_lensView3.qml",
42+ "MockLens4": "../tests/qmltests/Dash/qml/fake_lensView4.qml"
43+ }
44+ genericLens: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"
45+ }
46+
47+ UT.UnityTestCase {
48+ name: "Dash"
49+ when: windowShown
50+
51+ property var lenses
52+
53+ Component.onCompleted: {
54+ var dashContent = findChild(dash, "dashContent");
55+ dashContent.lensMapper = lensDelegateMapper;
56+ lenses = dashContent.lenses;
57+ }
58+
59+ function init() {
60+ // clear and reload the lenses.
61+ lenses.clear();
62+ var dashContentList = findChild(dash, "dashContentList");
63+ verify(dashContentList != undefined);
64+ tryCompare(dashContentList, "count", 0);
65+ lenses.load();
66+ }
67+
68+ function get_lens_data() {
69+ return [
70+ { tag: "MockLens1", visualIndex: 0, shouldBeVisible: true },
71+ { tag: "MockLens2", visualIndex: -1, shouldBeVisible: false },
72+ { tag: "MockLens3", visualIndex: 1, shouldBeVisible: true },
73+ { tag: "MockLens4", visualIndex: 2, shouldBeVisible: true },
74+ { tag: "MockLens5", visualIndex: 3, shouldBeVisible: true },
75+ ]
76+ }
77+
78+ function test_set_current_lens_data() {
79+ return get_lens_data()
80+ }
81+
82+ function test_set_current_lens(data) {
83+ // wait for lenses to load
84+ tryCompare(lenses, "loaded", true);
85+
86+ var dashbar = findChild(dash, "dashbar");
87+ verify(dashbar != undefined)
88+ var dashContent = findChild(dash, "dashContent");
89+ var current_index = dashContent.currentIndex;
90+
91+ dash.setCurrentLens(data.tag, true /* animate */, false /* reset */);
92+ compare(dashContent.currentIndex, data.shouldBeVisible ? data.visualIndex : current_index);
93+ compare(dashbar.currentIndex, data.shouldBeVisible ? data.visualIndex : current_index);
94+ }
95+
96+ function test_show_lens_on_load_data() {
97+ return get_lens_data()
98+ }
99+
100+ function test_show_lens_on_load(data) {
101+ if (data.shouldBeVisible == false) {
102+ console.log("Not testing " + data.tag + ": not visible");
103+ return;
104+ }
105+ dash.showLensOnLoaded = data.tag
106+
107+ var dashContentList = findChild(dash, "dashContentList");
108+ verify(dashContentList != undefined);
109+ tryCompare(dashContentList, "currentIndex", data.visualIndex);
110+ }
111+
112+ function test_dash_bar_set_index_connection_data() {
113+ return get_lens_data()
114+ }
115+
116+ function test_dash_bar_set_index_connection(data) {
117+ if (data.shouldBeVisible == false) {
118+ console.log("Not testing " + data.tag + ": not visible");
119+ return;
120+ }
121+ // wait for lenses to load
122+ tryCompare(lenses, "loaded", true);
123+
124+ var dashbar = findChild(dash, "dashbar");
125+ verify(dashbar != undefined)
126+ var dashContent = findChild(dash, "dashContent");
127+ var current_index = dashContent.currentIndex;
128+
129+ dashbar.itemSelected(data.visualIndex);
130+ compare(dashContent.currentIndex, data.shouldBeVisible ? data.visualIndex : current_index);
131+ }
132+ }
133+}
tests/qmltests/Dash/tst_DashContent.qml+61−56
@@ -28,7 +28,7 @@ Item {
28
28
29 property ListModel searchHistory: ListModel {}
29 property ListModel searchHistory: ListModel {}
30
30
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 {
41 }
41 }
42
42
43 DashContent {
43 DashContent {
44− id: dash_content
44+ id: dashContent
45 anchors.fill: parent
45 anchors.fill: parent
46
46
47 model: lensesModel
47 model: lensesModel
48 lenses : lensesModel
48 lenses : lensesModel
49
49
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− }
51+ }
55
52
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"
60+ }
56 genericLens: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"
61 genericLens: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"
57 }
62 }
58
63
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;
62
67
63− lens_status["MockLens2"].movementStarted = 0;
68+ lensStatus["MockLens2"].movementStarted = 0;
64− lens_status["MockLens2"].positionedAtBeginning = 0;
69+ lensStatus["MockLens2"].positionedAtBeginning = 0;
65
70
66− lens_status["MockLens3"].movementStarted = 0;
71+ lensStatus["MockLens3"].movementStarted = 0;
67− lens_status["MockLens3"].positionedAtBeginning = 0;
72+ lensStatus["MockLens3"].positionedAtBeginning = 0;
68
73
69− lens_status["MockLens4"].movementStarted = 0;
74+ lensStatus["MockLens4"].movementStarted = 0;
70− lens_status["MockLens4"].positionedAtBeginning = 0;
75+ lensStatus["MockLens4"].positionedAtBeginning = 0;
71
76
72− lens_status["MockLens5"].movementStarted = 0;
77+ lensStatus["MockLens5"].movementStarted = 0;
73− lens_status["MockLens5"].positionedAtBeginning = 0;
78+ lensStatus["MockLens5"].positionedAtBeginning = 0;
74 }
79 }
75
80
76 SignalSpy {
81 SignalSpy {
77− id: lensLoaded_spy
82+ id: lensLoadedSpy
78− target: dash_content
83+ target: dashContent
79 signalName: "lensLoaded"
84 signalName: "lensLoaded"
80 }
85 }
81
86
82 SignalSpy {
87 SignalSpy {
83− id: movementStarted_spy
88+ id: movementStartedSpy
84− target: dash_content
89+ target: dashContent
85 signalName: "movementStarted"
90 signalName: "movementStarted"
86 }
91 }
87
92
88 SignalSpy {
93 SignalSpy {
89− id: contentEndReached_spy
94+ id: contentEndReachedSpy
90− target: dash_content
95+ target: dashContent
91 signalName: "contentEndReached"
96 signalName: "contentEndReached"
92 }
97 }
93
98
@@ -96,13 +101,13 @@ Item {
96 when: windowShown
101 when: windowShown
97
102
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();
103
108
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 {
110 }
115 }
111
116
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);
114
119
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);
118
123
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.");
126 }
131 }
127
132
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);
130
135
131− tryCompare(lensLoaded_spy, "count", 5);
136+ tryCompare(lensLoadedSpy, "count", 5);
132
137
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.");
139 }
144 }
140
145
141 function test_lens_loaded() {
146 function test_lens_loaded() {
142− tryCompare(lensLoaded_spy, "count", 5);
147+ tryCompare(lensLoadedSpy, "count", 5);
143 }
148 }
144
149
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);
149
154
150− dash_content.setCurrentLensAtIndex(0, true, false);
155+ dashContent.setCurrentLensAtIndex(0, true, false);
151 dashContentList.currentItem.item.endReached();
156 dashContentList.currentItem.item.endReached();
152
157
153− compare(contentEndReached_spy.count, 1);
158+ compare(contentEndReachedSpy.count, 1);
154 }
159 }
155
160
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);
160
165
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
163
168
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);
167
172
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);
171 }
176 }
172
177
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);
176
181
177 if (dashContentList.currentItem != undefined) {
182 if (dashContentList.currentItem != undefined) {
@@ -193,7 +198,7 @@ Item {
193 }
198 }
194
199
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)
198 }
203 }
199
204