on xenial help sign in
More renaming.
commitd828b92350deb9f2448e1af8e563711b754004c8 authorPawel Stolowski <pawel.stolowski@canonical.com> dateWed 12 Jun 2013, 16:15 (13 years ago) parente12ee10
21 files changed+191−193
Shell.qml+3−3 plugins/Unity/scope.cpp+2−2 plugins/Unity/scope.h+1−1 plugins/Unity/scopes.cpp+2−4 plugins/Unity/scopes.h+1−1 tests/autopilot/unity8/tests/helpers.py+1−1 tests/qmltests/Dash/qml/FakeLensView.qml → tests/qmltests/Dash/qml/FakeScopeView.qml+11−11 tests/qmltests/Dash/qml/fake_generic_lensView.qml+3−3 tests/qmltests/Dash/qml/fake_lensView1.qml+3−3 tests/qmltests/Dash/qml/fake_lensView2.qml+3−3 tests/qmltests/Dash/qml/fake_lensView3.qml+3−3 tests/qmltests/Dash/qml/fake_lensView4.qml+3−3 tests/qmltests/Dash/tst_DashBar.qml+4−4 tests/qmltests/Dash/tst_DashContent.qml+67−67 tests/qmltests/Dash/tst_GenericLensView.qml+8−8 tests/qmltests/Dash/tst_LensView.qml+10−10 tests/qmltests/plugins/Unity/fake_lens.cpp+9−9 tests/qmltests/plugins/Unity/fake_lens.h+6−6 tests/qmltests/plugins/Unity/fake_lenses.cpp+37−37 tests/qmltests/plugins/Unity/fake_lenses.h+12−12 tests/qmltests/plugins/Unity/fake_unity_plugin.cpp+2−2
Shell.qml+3−3
@@ -502,14 +502,14 @@ FocusScope {
502502 greeter.hide()
503503 // Animate if moving between application and dash
504504 if (!stages.shown) {
505− dash.setCurrentLens("home.lens", true, false)
505+ dash.setCurrentScope("home.scope", true, false)
506506 } else {
507− dash.setCurrentLens("home.lens", false, false)
507+ dash.setCurrentScope("home.scope", false, false)
508508 }
509509 stages.hide();
510510 }
511511 onDash: {
512− dash.setCurrentLens("applications.lens", true, false)
512+ dash.setCurrentScope("applications.scope", true, false)
513513 stages.hide();
514514 }
515515 onLauncherApplicationSelected:{
plugins/Unity/scope.cpp+2−2
@@ -174,9 +174,9 @@ void Scope::fallbackActivate(const QString& uri)
174174 QDesktopServices::openUrl(url);
175175}
176176
177−void Scope::setUnityScope(const unity::dash::Scope::Ptr& lens)
177+void Scope::setUnityScope(const unity::dash::Scope::Ptr& scope)
178178{
179− m_unityScope = lens;
179+ m_unityScope = scope;
180180
181181 if (QString::fromStdString(m_unityScope->results()->swarm_name) == QString(":local")) {
182182 m_results->setModel(m_unityScope->results()->model());
plugins/Unity/scope.h+1−1
@@ -61,7 +61,7 @@ public:
6161 enum ViewType {
6262 Hidden,
6363 HomeView,
64− LensView
64+ ScopeView
6565 };
6666
6767 /* getters */
plugins/Unity/scopes.cpp+2−4
@@ -33,7 +33,7 @@ Scopes::Scopes(QObject *parent)
3333 , m_unityScopes(std::make_shared<unity::dash::GSettingsScopes>())
3434 , m_loaded(false)
3535{
36− m_roles[Scopes::RoleLens] = "scope";
36+ m_roles[Scopes::RoleScope] = "scope";
3737 m_roles[Scopes::RoleId] = "id";
3838 m_roles[Scopes::RoleVisible] = "visible";
3939
@@ -65,7 +65,7 @@ QVariant Scopes::data(const QModelIndex& index, int role) const
6565
6666 Scope* scope = m_scopes.at(index.row());
6767
68− if (role == Scopes::RoleLens) {
68+ if (role == Scopes::RoleScope) {
6969 return QVariant::fromValue(scope);
7070 } else if (role == Scopes::RoleId) {
7171 return QVariant::fromValue(scope->id());
@@ -111,7 +111,6 @@ void Scopes::onScopeAdded(const unity::dash::Scope::Ptr& scope, int position)
111111
112112void Scopes::onScopesLoaded()
113113{
114− qWarning() << "Scopes Loaded!!!";
115114}
116115
117116void Scopes::onScopeRemoved(const unity::dash::Scope::Ptr& scope)
@@ -132,7 +131,6 @@ void Scopes::onScopePropertyChanged()
132131
133132void Scopes::addUnityScope(const unity::dash::Scope::Ptr& unity_scope)
134133{
135− qDebug() << "Scope added:" << QString::fromStdString(unity_scope->id);
136134 Scope* scope = new Scope(this);
137135 scope->setUnityScope(unity_scope);
138136 /* DOCME */
plugins/Unity/scopes.h+1−1
@@ -52,7 +52,7 @@ public:
5252 ~Scopes() = default;
5353
5454 enum Roles {
55− RoleLens,
55+ RoleScope,
5656 RoleId,
5757 RoleVisible
5858 };
tests/autopilot/unity8/tests/helpers.py+1−1
@@ -71,7 +71,7 @@ class TestShellHelpers(object):
7171 self.touch.drag(start_x, start_y, stop_x, stop_y)
7272
7373 # Because the shell loads up lots of stuff, unlocking the greeter can
74− # be a bit stuttery while lenses are still consuming all resources.
74+ # be a bit stuttery while scopes are still consuming all resources.
7575 # Give it another (max retries) chance
7676 try:
7777 self.assertThat(greeter.created, Eventually(Equals(False)))
tests/qmltests/Dash/qml/FakeLensView.qml → tests/qmltests/Dash/qml/FakeScopeView.qmlrenamed+11−11
@@ -18,8 +18,8 @@ import QtQuick 2.0
1818import Unity 0.1
1919
2020FocusScope {
21− id: fakeLensView
22− property Lens lens : null
21+ id: fakeScopeView
22+ property Scope scope : null
2323 property bool isCurrent : false
2424
2525 property alias rect_color1 : rect1.color
@@ -33,18 +33,18 @@ FocusScope {
3333 signal positionedAtBeginning
3434
3535 onEndReached: {
36− if (shell != undefined && shell.lens_status != undefined) {
37− shell.lens_status[lens.id].endReached++;
36+ if (shell != undefined && shell.scope_status != undefined) {
37+ shell.scope_status[scope.id].endReached++;
3838 }
3939 }
4040 onMovementStarted: {
41− if (shell != undefined && shell.lens_status != undefined) {
42− shell.lens_status[lens.id].movementStarted++;
41+ if (shell != undefined && shell.scope_status != undefined) {
42+ shell.scope_status[scope.id].movementStarted++;
4343 }
4444 }
4545 onPositionedAtBeginning: {
46− if (shell != undefined && shell.lens_status != undefined) {
47− shell.lens_status[lens.id].positionedAtBeginning++;
46+ if (shell != undefined && shell.scope_status != undefined) {
47+ shell.scope_status[scope.id].positionedAtBeginning++;
4848 }
4949 }
5050
@@ -60,7 +60,7 @@ FocusScope {
6060 anchors.fill: parent
6161 verticalAlignment: Text.AlignVCenter
6262 horizontalAlignment: Text.AlignHCenter
63− text: lens ? lens.id : ""
63+ text: scope ? scope.id : ""
6464 }
6565 }
6666
@@ -73,7 +73,7 @@ FocusScope {
7373 anchors.fill: parent
7474 verticalAlignment: Text.AlignVCenter
7575 horizontalAlignment: Text.AlignHCenter
76− text: lens ? lens.id : ""
76+ text: scope ? scope.id : ""
7777 }
7878 }
7979
@@ -86,7 +86,7 @@ FocusScope {
8686 anchors.fill: parent
8787 verticalAlignment: Text.AlignVCenter
8888 horizontalAlignment: Text.AlignHCenter
89− text: lens ? lens.id : ""
89+ text: scope ? scope.id : ""
9090 }
9191 }
9292 }
tests/qmltests/Dash/qml/fake_generic_lensView.qml+3−3
@@ -16,9 +16,9 @@
1616
1717import QtQuick 2.0
1818
19−FakeLensView {
20− id: fake_generic_lensView
21− objectName: "fake_generic_lensView"
19+FakeScopeView {
20+ id: fake_generic_scopeView
21+ objectName: "fake_generic_scopeView"
2222
2323 rect_color1: "blue"
2424 rect_color2: "orange"
tests/qmltests/Dash/qml/fake_lensView1.qml+3−3
@@ -16,9 +16,9 @@
1616
1717import QtQuick 2.0
1818
19−FakeLensView {
20− id: fake_lensView1
21− objectName: "fake_lensView1"
19+FakeScopeView {
20+ id: fake_scopeView1
21+ objectName: "fake_scopeView1"
2222
2323 rect_color1: "red"
2424 rect_color2: "green"
tests/qmltests/Dash/qml/fake_lensView2.qml+3−3
@@ -16,9 +16,9 @@
1616
1717import QtQuick 2.0
1818
19−FakeLensView {
20− id: fake_lensView2
21− objectName: "fake_lensView2"
19+FakeScopeView {
20+ id: fake_scopeView2
21+ objectName: "fake_scopeView2"
2222
2323 rect_color1: "orange"
2424 rect_color2: "grey"
tests/qmltests/Dash/qml/fake_lensView3.qml+3−3
@@ -16,9 +16,9 @@
1616
1717import QtQuick 2.0
1818
19−FakeLensView {
20− id: fake_lensView3
21− objectName: "fake_lensView3"
19+FakeScopeView {
20+ id: fake_scopeView3
21+ objectName: "fake_scopeView3"
2222
2323 rect_color1: "yellow"
2424 rect_color2: "cyan"
tests/qmltests/Dash/qml/fake_lensView4.qml+3−3
@@ -16,9 +16,9 @@
1616
1717import QtQuick 2.0
1818
19−FakeLensView {
20− id: fake_lensView4
21− objectName: "fake_lensView4"
19+FakeScopeView {
20+ id: fake_scopeView4
21+ objectName: "fake_scopeView4"
2222
2323 rect_color1: "grey"
2424 rect_color2: "purple"
tests/qmltests/Dash/tst_DashBar.qml+4−4
@@ -34,12 +34,12 @@ Item {
3434 right: parent.right
3535 bottom: parent.bottom
3636 }
37− model: lenses
37+ model: scopes
3838 onItemSelected: currentIndex = index
3939 }
4040
41− Lenses {
42− id: lenses
41+ Scopes {
42+ id: scopes
4343 }
4444
4545 SignalSpy {
@@ -50,7 +50,7 @@ Item {
5050
5151 UT.UnityTestCase {
5252 name: "DashBar"
53− when: lenses.loaded
53+ when: scopes.loaded
5454
5555 property alias model: dashBar.model
5656 property alias currentIndex: dashBar.currentIndex
tests/qmltests/Dash/tst_DashContent.qml+67−67
@@ -28,55 +28,55 @@ Item {
2828
2929 property ListModel searchHistory: ListModel {}
3030
31− property var lens_status: {
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 scope_status: {
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: dash_content
4545 anchors.fill: parent
4646
47− model: lensesModel
48− scopes : lensesModel
47+ model: scopesModel
48+ scopes : scopesModel
4949
50− lensDelegateMapping: { "MockLens3" : "../tests/qmltests/Dash/qml/fake_lensView3.qml",
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"
50+ scopeDelegateMapping: { "MockScope3" : "../tests/qmltests/Dash/qml/fake_lensView3.qml",
51+ "MockScope2" : "../tests/qmltests/Dash/qml/fake_lensView2.qml",
52+ "MockScope1" : "../tests/qmltests/Dash/qml/fake_lensView1.qml",
53+ "MockScope4" : "../tests/qmltests/Dash/qml/fake_lensView4.qml"
5454 }
5555
56− genericLens: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"
56+ genericScope: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"
5757 }
5858
59− function clear_lens_status() {
60− lens_status["MockLens1"].movementStarted = 0;
61− lens_status["MockLens1"].positionedAtBeginning = 0;
59+ function clear_scope_status() {
60+ scope_status["MockScope1"].movementStarted = 0;
61+ scope_status["MockScope1"].positionedAtBeginning = 0;
6262
63− lens_status["MockLens2"].movementStarted = 0;
64− lens_status["MockLens2"].positionedAtBeginning = 0;
63+ scope_status["MockScope2"].movementStarted = 0;
64+ scope_status["MockScope2"].positionedAtBeginning = 0;
6565
66− lens_status["MockLens3"].movementStarted = 0;
67− lens_status["MockLens3"].positionedAtBeginning = 0;
66+ scope_status["MockScope3"].movementStarted = 0;
67+ scope_status["MockScope3"].positionedAtBeginning = 0;
6868
69− lens_status["MockLens4"].movementStarted = 0;
70− lens_status["MockLens4"].positionedAtBeginning = 0;
69+ scope_status["MockScope4"].movementStarted = 0;
70+ scope_status["MockScope4"].positionedAtBeginning = 0;
7171
72− lens_status["MockLens5"].movementStarted = 0;
73− lens_status["MockLens5"].positionedAtBeginning = 0;
72+ scope_status["MockScope5"].movementStarted = 0;
73+ scope_status["MockScope5"].positionedAtBeginning = 0;
7474 }
7575
7676 SignalSpy {
77− id: lensLoaded_spy
77+ id: scopeLoaded_spy
7878 target: dash_content
79− signalName: "lensLoaded"
79+ signalName: "scopeLoaded"
8080 }
8181
8282 SignalSpy {
@@ -96,77 +96,77 @@ Item {
9696 when: windowShown
9797
9898 function init() {
99− lensLoaded_spy.clear();
99+ scopeLoaded_spy.clear();
100100 movementStarted_spy.clear();
101101 contentEndReached_spy.clear()
102− clear_lens_status();
102+ clear_scope_status();
103103
104− // clear, wait for dahs to empty and load lenses.
104+ // clear, wait for dahs to empty and load scopes.
105105 var dashContentList = findChild(dash_content, "dashContentList");
106106 verify(dashContentList != undefined)
107− lensesModel.clear();
107+ scopesModel.clear();
108108 tryCompare(dashContentList, "count", 0);
109− lensesModel.load();
109+ scopesModel.load();
110110 }
111111
112112 function test_movement_started_signal() {
113− dash_content.setCurrentLensAtIndex(3, true, false);
113+ dash_content.setCurrentScopeAtIndex(3, true, false);
114114
115115 var dashContentList = findChild(dash_content, "dashContentList");
116116 verify(dashContentList != undefined)
117− tryCompare(lensLoaded_spy, "count", 5);
117+ tryCompare(scopeLoaded_spy, "count", 5);
118118
119119 dashContentList.movementStarted();
120120 compare(movementStarted_spy.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.");
122− compare(lens_status["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.");
124− compare(lens_status["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.");
121+ compare(scope_status["MockScope1"].movementStarted, 1, "MockScope1 should have emitted movementStarted signal when content list did.");
122+ compare(scope_status["MockScope2"].movementStarted, 1, "MockScope2 should have emitted movementStarted signal when content list did.");
123+ compare(scope_status["MockScope3"].movementStarted, 1, "MockScope3 should have emitted movementStarted signal when content list did.");
124+ compare(scope_status["MockScope4"].movementStarted, 1, "MockScope4 should have emitted movementStarted signal when content list did.");
125+ compare(scope_status["MockScope5"].movementStarted, 1, "MockScope5 should have emitted movementStarted signal when content list did.");
126126 }
127127
128128 function test_positioned_at_beginning_signal() {
129− dash_content.setCurrentLensAtIndex(3, true, false);
129+ dash_content.setCurrentScopeAtIndex(3, true, false);
130130
131− tryCompare(lensLoaded_spy, "count", 5);
131+ tryCompare(scopeLoaded_spy, "count", 5);
132132
133133 dash_content.positionedAtBeginning();
134− compare(lens_status["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.");
136− compare(lens_status["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.");
138− compare(lens_status["MockLens5"].positionedAtBeginning, 1, "MockLens5 should have emitted positionedAtBeginning signal when DashContent did.");
134+ compare(scope_status["MockScope1"].positionedAtBeginning, 1, "MockScope1 should have emitted positionedAtBeginning signal when DashContent did.");
135+ compare(scope_status["MockScope2"].positionedAtBeginning, 1, "MockScope2 should have emitted positionedAtBeginning signal when DashContent did.");
136+ compare(scope_status["MockScope3"].positionedAtBeginning, 1, "MockScope3 should have emitted positionedAtBeginning signal when DashContent did.");
137+ compare(scope_status["MockScope4"].positionedAtBeginning, 1, "MockScope4 should have emitted positionedAtBeginning signal when DashContent did.");
138+ compare(scope_status["MockScope5"].positionedAtBeginning, 1, "MockScope5 should have emitted positionedAtBeginning signal when DashContent did.");
139139 }
140140
141− function test_lens_loaded() {
142− tryCompare(lensLoaded_spy, "count", 5);
141+ function test_scope_loaded() {
142+ tryCompare(scopeLoaded_spy, "count", 5);
143143 }
144144
145145 function test_content_end_reached() {
146146 var dashContentList = findChild(dash_content, "dashContentList");
147147 verify(dashContentList != undefined);
148− tryCompare(lensLoaded_spy, "count", 5);
148+ tryCompare(scopeLoaded_spy, "count", 5);
149149
150− dash_content.setCurrentLensAtIndex(0, true, false);
150+ dash_content.setCurrentScopeAtIndex(0, true, false);
151151 dashContentList.currentItem.item.endReached();
152152
153153 compare(contentEndReached_spy.count, 1);
154154 }
155155
156− // This tests that setting the current lens index will end up at the correct index even if
157− // the lenses are loaded asynchrounsly.
158− function test_set_current_lens_index_async() {
159− verify(lensesModel.loaded == false);
156+ // This tests that setting the current scope index will end up at the correct index even if
157+ // the scopes are loaded asynchrounsly.
158+ function test_set_current_scope_index_async() {
159+ verify(scopesModel.loaded == false);
160160
161161 // next index is 1 if current is -1, otherwise it's current + 1
162162 var next_index = ((dash_content.currentIndex == -1 ? 0 : dash_content.currentIndex) + 1) % 5
163163
164− dash_content.setCurrentLensAtIndex(next_index, true, false);
164+ dash_content.setCurrentScopeAtIndex(next_index, true, false);
165165 tryCompare(dash_content, "currentIndex", next_index);
166− verify(lensesModel.loaded == true);
166+ verify(scopesModel.loaded == true);
167167
168− // test greater than lens count.
169− dash_content.setCurrentLensAtIndex(lensesModel.count, true, false);
168+ // test greater than scope count.
169+ dash_content.setCurrentScopeAtIndex(scopesModel.count, true, false);
170170 compare(dash_content.currentIndex, 4);
171171 }
172172
@@ -182,18 +182,18 @@ Item {
182182 return "";
183183 }
184184
185− function test_lens_mapping_data() {
185+ function test_scope_mapping_data() {
186186 return [
187− {tag: "index0", index: 0, objectName: "fake_lensView1"},
188− {tag: "index1", index: 1, objectName: "fake_lensView2"},
189− {tag: "index2", index: 2, objectName: "fake_lensView3"},
190− {tag: "index3", index: 3, objectName: "fake_lensView4"},
191− {tag: "index4", index: 4, objectName: "fake_generic_lensView"}
187+ {tag: "index0", index: 0, objectName: "fake_scopeView1"},
188+ {tag: "index1", index: 1, objectName: "fake_scopeView2"},
189+ {tag: "index2", index: 2, objectName: "fake_scopeView3"},
190+ {tag: "index3", index: 3, objectName: "fake_scopeView4"},
191+ {tag: "index4", index: 4, objectName: "fake_generic_scopeView"}
192192 ]
193193 }
194194
195− function test_lens_mapping(data) {
196− dash_content.setCurrentLensAtIndex(data.index, true, false);
195+ function test_scope_mapping(data) {
196+ dash_content.setCurrentScopeAtIndex(data.index, true, false);
197197 tryCompareFunction(get_current_item_object_name, data.objectName)
198198 }
199199
tests/qmltests/Dash/tst_GenericLensView.qml+8−8
@@ -26,27 +26,27 @@ Item {
2626 width: units.gu(120)
2727 height: units.gu(80)
2828
29− Lenses {
29+ Scopes {
3030 id: scopes
3131 }
3232
33− GenericLensView {
34− id: genericLensView
33+ GenericScopeView {
34+ id: genericScopeView
3535 anchors.fill: parent
3636
3737 UT.UnityTestCase {
38− name: "GenericLensView"
38+ name: "GenericScopeView"
3939 when: scopes.loaded
4040
4141 function init() {
42− genericLensView.lens = scopes.get(0)
42+ genericScopeView.scope = scopes.get(0)
4343 }
4444
4545 function test_isCurrent() {
46− var pageHeader = findChild(genericLensView, "pageHeader");
47− genericLensView.isCurrent = true
46+ var pageHeader = findChild(genericScopeView, "pageHeader");
47+ genericScopeView.isCurrent = true
4848 pageHeader.searchQuery = "test"
49− genericLensView.isCurrent = false
49+ genericScopeView.isCurrent = false
5050 tryCompare(pageHeader, "searchQuery", "")
5151 }
5252 }
tests/qmltests/Dash/tst_LensView.qml+10−10
@@ -25,27 +25,27 @@ Item {
2525 width: units.gu(120)
2626 height: units.gu(80)
2727
28− Lenses {
28+ Scopes {
2929 id: scopes
3030 }
3131
32− LensView {
33− id: lensView
32+ ScopeView {
33+ id: scopeView
3434 anchors.fill: parent
3535
3636 TestCase {
37− name: "LensView"
37+ name: "ScopeView"
3838 when: scopes.loaded
3939
4040 function init() {
41− lensView.lens = lenses.get(0)
41+ scopeView.scope = scopes.get(0)
4242 }
4343
44− function test_changeLens() {
45− lensView.lens.searchQuery = "test"
46− lensView.lens = lenses.get(1)
47− lensView.lens = lenses.get(0)
48− tryCompare(lensView.lens, "searchQuery", "")
44+ function test_changeScope() {
45+ scopeView.scope.searchQuery = "test"
46+ scopeView.scope = scopes.get(1)
47+ scopeView.scope = scopes.get(0)
48+ tryCompare(scopeView.scope, "searchQuery", "")
4949 }
5050 }
5151 }
tests/qmltests/plugins/Unity/fake_lens.cpp+9−9
@@ -25,7 +25,7 @@ static DeeModel* create_results_model(unsigned category_count, unsigned result_c
2525
2626// TODO: Implement remaining pieces
2727
28−Lens::Lens(QObject* parent)
28+Scope::Scope(QObject* parent)
2929: QObject(parent),
3030 m_visible(false),
3131 m_categories(new Categories(this)),
@@ -38,7 +38,7 @@ Lens::Lens(QObject* parent)
3838// m_categories->setGlobalResultModel(m_results);
3939}
4040
41−Lens::Lens(QString const& id,
41+Scope::Scope(QString const& id,
4242 QString const& name,
4343 bool visible,
4444 QObject* parent)
@@ -56,37 +56,37 @@ Lens::Lens(QString const& id,
5656// m_categories->setGlobalResultModel(m_results);
5757}
5858
59−QString Lens::id() const {
59+QString Scope::id() const {
6060 return m_id;
6161}
6262
63−QString Lens::name() const {
63+QString Scope::name() const {
6464 return m_name;
6565}
6666
67−QString Lens::searchQuery() const {
67+QString Scope::searchQuery() const {
6868 return m_searchQuery;
6969}
7070
71−void Lens::setName(const QString &str) {
71+void Scope::setName(const QString &str) {
7272 if (str != m_name) {
7373 m_name = str;
7474 Q_EMIT nameChanged(m_name);
7575 }
7676}
7777
78−void Lens::setSearchQuery(const QString &str) {
78+void Scope::setSearchQuery(const QString &str) {
7979 if (str != m_searchQuery) {
8080 m_searchQuery = str;
8181 Q_EMIT searchQueryChanged(m_searchQuery);
8282 }
8383}
8484
85−bool Lens::visible() const {
85+bool Scope::visible() const {
8686 return m_visible;
8787}
8888
89−Categories* Lens::categories() const {
89+Categories* Scope::categories() const {
9090 return m_categories;
9191}
9292
tests/qmltests/plugins/Unity/fake_lens.h+6−6
@@ -14,14 +14,14 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#ifndef FAKE_LENS_H
18−#define FAKE_LENS_H
17+#ifndef FAKE_SCOPE_H
18+#define FAKE_SCOPE_H
1919
2020// Qt
2121#include <QObject>
2222#include "categories.h"
2323
24−class Lens : public QObject
24+class Scope : public QObject
2525{
2626 Q_OBJECT
2727 Q_PROPERTY(QString id READ id NOTIFY idChanged)
@@ -31,8 +31,8 @@ class Lens : public QObject
3131 Q_PROPERTY(Categories* categories READ categories NOTIFY categoriesChanged)
3232
3333public:
34− Lens(QObject* parent = 0);
35− Lens(QString const& id, QString const& name, bool visible, QObject* parent = 0);
34+ Scope(QObject* parent = 0);
35+ Scope(QString const& id, QString const& name, bool visible, QObject* parent = 0);
3636
3737 QString id() const;
3838 QString name() const;
@@ -60,4 +60,4 @@ private:
6060 DeeListModel* m_results;
6161};
6262
63−#endif // FAKE_LENS_H
63+#endif // FAKE_SCOPE_H
tests/qmltests/plugins/Unity/fake_lenses.cpp+37−37
@@ -24,14 +24,14 @@
2424// Qt
2525#include <QTimer>
2626
27−Lenses::Lenses(QObject *parent)
27+Scopes::Scopes(QObject *parent)
2828: QAbstractListModel(parent)
2929, m_loaded(false)
3030, timer(this)
3131{
32− m_roles[Lenses::RoleLens] = "lens";
33− m_roles[Lenses::RoleId] = "id";
34− m_roles[Lenses::RoleVisible] = "visible";
32+ m_roles[Scopes::RoleScope] = "scope";
33+ m_roles[Scopes::RoleId] = "id";
34+ m_roles[Scopes::RoleVisible] = "visible";
3535
3636 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
3737 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
@@ -39,22 +39,22 @@ Lenses::Lenses(QObject *parent)
3939
4040 timer.setSingleShot(true);
4141 timer.setInterval(100);
42− QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateLenses()));
42+ QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateScopes()));
4343 load();
4444}
4545
46−Lenses::~Lenses()
46+Scopes::~Scopes()
4747{
4848}
4949
50−void Lenses::updateLenses()
50+void Scopes::updateScopes()
5151{
5252 clear();
53− addLens(new Lens("MockLens1", "People", true, this));
54− addLens(new Lens("MockLens2", "Music", false, this));
55− addLens(new Lens("MockLens3", "Home", true, this));
56− addLens(new Lens("MockLens4", "Applications", true, this));
57− addLens(new Lens("MockLens5", "Videos", true, this));
53+ addScope(new Scope("MockScope1", "People", true, this));
54+ addScope(new Scope("MockScope2", "Music", false, this));
55+ addScope(new Scope("MockScope3", "Home", true, this));
56+ addScope(new Scope("MockScope4", "Applications", true, this));
57+ addScope(new Scope("MockScope5", "Videos", true, this));
5858
5959 if (!m_loaded) {
6060 m_loaded = true;
@@ -62,13 +62,13 @@ void Lenses::updateLenses()
6262 }
6363}
6464
65−void Lenses::clear()
65+void Scopes::clear()
6666{
6767 timer.stop();
68− if (m_lenses.size() > 0) {
69− beginRemoveRows(QModelIndex(), 0, m_lenses.count()-1);
70− qDeleteAll(m_lenses);
71− m_lenses.clear();
68+ if (m_scopes.size() > 0) {
69+ beginRemoveRows(QModelIndex(), 0, m_scopes.count()-1);
70+ qDeleteAll(m_scopes);
71+ m_scopes.clear();
7272 endRemoveRows();
7373 }
7474
@@ -78,69 +78,69 @@ void Lenses::clear()
7878 }
7979}
8080
81−void Lenses::load()
81+void Scopes::load()
8282{
8383 timer.start();
8484}
8585
86−QHash<int, QByteArray> Lenses::roleNames() const
86+QHash<int, QByteArray> Scopes::roleNames() const
8787{
8888 return m_roles;
8989}
9090
91−int Lenses::rowCount(const QModelIndex&) const
91+int Scopes::rowCount(const QModelIndex&) const
9292{
93− return m_lenses.count();
93+ return m_scopes.count();
9494}
9595
96−QVariant Lenses::data(const QModelIndex& index, int role) const
96+QVariant Scopes::data(const QModelIndex& index, int role) const
9797{
98− if (!index.isValid() || index.row() >= m_lenses.size()) {
98+ if (!index.isValid() || index.row() >= m_scopes.size()) {
9999 return QVariant();
100100 }
101101
102− Lens* lens = m_lenses.at(index.row());
102+ Scope* scope = m_scopes.at(index.row());
103103
104− if (role == Lenses::RoleLens) {
105− return QVariant::fromValue(lens);
106− } else if (role == Lenses::RoleId) {
107− return QVariant::fromValue(lens->id());
108− } else if (role == Lenses::RoleVisible) {
109− return QVariant::fromValue(lens->visible());
104+ if (role == Scopes::RoleScope) {
105+ return QVariant::fromValue(scope);
106+ } else if (role == Scopes::RoleId) {
107+ return QVariant::fromValue(scope->id());
108+ } else if (role == Scopes::RoleVisible) {
109+ return QVariant::fromValue(scope->visible());
110110 } else {
111111 return QVariant();
112112 }
113113}
114114
115−QVariant Lenses::get(int row) const
115+QVariant Scopes::get(int row) const
116116{
117117 return data(QAbstractListModel::index(row), 0);
118118}
119119
120−QVariant Lenses::get(QString const&) const
120+QVariant Scopes::get(QString const&) const
121121{
122122 return QVariant();
123123}
124124
125−QModelIndex Lenses::parent(const QModelIndex&) const
125+QModelIndex Scopes::parent(const QModelIndex&) const
126126{
127127 return QModelIndex();
128128}
129129
130−bool Lenses::loaded() const
130+bool Scopes::loaded() const
131131{
132132 return m_loaded;
133133}
134134
135−int Lenses::count() const
135+int Scopes::count() const
136136{
137137 return rowCount();
138138}
139139
140−void Lenses::addLens(Lens* lens)
140+void Scopes::addScope(Scope* scope)
141141{
142142 int index = rowCount();
143143 beginInsertRows(QModelIndex(), index, index);
144− m_lenses.append(lens);
144+ m_scopes.append(scope);
145145 endInsertRows();
146146}
tests/qmltests/plugins/Unity/fake_lenses.h+12−12
@@ -16,8 +16,8 @@
1616 * Author: Nick Dedekind <nick.dedekind@canonical.com>
1717 */
1818
19−#ifndef FAKE_LENSES_H
20−#define FAKE_LENSES_H
19+#ifndef FAKE_SCOPES_H
20+#define FAKE_SCOPES_H
2121
2222// Local
2323#include "fake_lens.h"
@@ -27,7 +27,7 @@
2727#include <QList>
2828#include <QTimer>
2929
30−class Lenses : public QAbstractListModel
30+class Scopes : public QAbstractListModel
3131{
3232 Q_OBJECT
3333 Q_ENUMS(Roles)
@@ -35,11 +35,11 @@ class Lenses : public QAbstractListModel
3535 Q_PROPERTY(int count READ count NOTIFY countChanged)
3636
3737public:
38− explicit Lenses(QObject *parent = 0);
39− ~Lenses();
38+ explicit Scopes(QObject *parent = 0);
39+ ~Scopes();
4040
4141 enum Roles {
42− RoleLens,
42+ RoleScope,
4343 RoleId,
4444 RoleVisible
4545 };
@@ -47,9 +47,9 @@ public:
4747 Q_INVOKABLE int rowCount(const QModelIndex& parent = QModelIndex()) const;
4848
4949 Q_INVOKABLE QVariant get(int row) const;
50− Q_INVOKABLE QVariant get(const QString& lens_id) const;
50+ Q_INVOKABLE QVariant get(const QString& scope_id) const;
5151
52− Q_INVOKABLE void addLens(Lens* lens);
52+ Q_INVOKABLE void addScope(Scope* scope);
5353
5454 Q_INVOKABLE void clear();
5555 Q_INVOKABLE void load();
@@ -62,18 +62,18 @@ public:
6262 int count() const;
6363
6464Q_SIGNALS:
65− void activateLensRequested(const QString& lens_id);
65+ void activateScopeRequested(const QString& scope_id);
6666 void loadedChanged(bool);
6767 void countChanged();
6868
6969private Q_SLOTS:
70− void updateLenses();
70+ void updateScopes();
7171
7272private:
73− QList<Lens*> m_lenses;
73+ QList<Scope*> m_scopes;
7474 QHash<int, QByteArray> m_roles;
7575 bool m_loaded;
7676 QTimer timer;
7777};
7878
79−#endif // LENSES_H
79+#endif // SCOPES_H
tests/qmltests/plugins/Unity/fake_unity_plugin.cpp+2−2
@@ -37,8 +37,8 @@ void FakeUnityPlugin::registerTypes(const char *uri)
3737
3838 Q_ASSERT(uri == QLatin1String("Unity"));
3939
40− qmlRegisterType<Lenses>(uri, 0, 1, "Lenses");
41− qmlRegisterType<Lens>(uri, 0, 1, "Lens");
40+ qmlRegisterType<Scopes>(uri, 0, 1, "Scopes");
41+ qmlRegisterType<Scope>(uri, 0, 1, "Scope");
4242 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
4343 qmlRegisterType<CategoryFilter>(uri, 0, 1, "CategoryFilter");
4444 qmlRegisterType<LauncherModel>(uri, 0, 1, "LauncherModel");