Merge lp:~aacid/unity8/bottom_list_store_no_favorites into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Michael Zanetti
Approved revision: 1483
Merged at revision: 1497
Proposed branch: lp:~aacid/unity8/bottom_list_store_no_favorites
Merge into: lp:unity8
Diff against target: 93 lines (+43/-1)
4 files modified
qml/Dash/Dash.qml (+1/-1)
tests/mocks/Unity/fake_scopes.cpp (+12/-0)
tests/mocks/Unity/fake_scopes.h (+1/-0)
tests/qmltests/Dash/tst_Dash.qml (+29/-0)
To merge this branch: bzr merge lp:~aacid/unity8/bottom_list_store_no_favorites
Reviewer Review Type Date Requested Status
Michał Sawicz Needs Information
Michael Zanetti (community) Approve
Review via email: mp+244177@code.launchpad.net

Commit message

Manage Dash: Make store button work even if you have no favorites

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * Did you make sure that your branch does not contain spurious tags?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
Michael Zanetti (mzanetti) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
yes
 * Did CI run pass? If not, please explain why.
 * Did you make sure that the branch does not contain spurious tags?
yes

review: Approve
Revision history for this message
Michał Sawicz (saviq) wrote :

Can we have a test for this?

review: Needs Information
1484. By Albert Astals Cid

Add test

Revision history for this message
Albert Astals Cid (aacid) wrote :

Added test

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Dash/Dash.qml'
2--- qml/Dash/Dash.qml 2014-12-03 07:44:46 +0000
3+++ qml/Dash/Dash.qml 2014-12-10 09:07:28 +0000
4@@ -167,7 +167,7 @@
5 onStoreClicked: {
6 bottomEdgeController.enableAnimation = true;
7 bottomEdgeController.progress = 0;
8- dashContent.currentScope.performQuery("scope://com.canonical.scopes.clickstore");
9+ scopesList.scope.performQuery("scope://com.canonical.scopes.clickstore");
10 }
11 onRequestFavorite: {
12 scopes.setFavorite(scopeId, favorite);
13
14=== modified file 'tests/mocks/Unity/fake_scopes.cpp'
15--- tests/mocks/Unity/fake_scopes.cpp 2014-10-30 12:06:59 +0000
16+++ tests/mocks/Unity/fake_scopes.cpp 2014-12-10 09:07:28 +0000
17@@ -88,6 +88,18 @@
18 }
19 }
20
21+void Scopes::clearFavorites()
22+{
23+ if (m_scopes.size() > 0) {
24+ beginRemoveRows(QModelIndex(), 0, m_scopes.count()-1);
25+ Q_FOREACH(Scope *scope, m_scopes) {
26+ m_scopesOverview->setFavorite(scope, false);
27+ }
28+ m_scopes.clear();
29+ endRemoveRows();
30+ }
31+}
32+
33 void Scopes::load()
34 {
35 timer.start();
36
37=== modified file 'tests/mocks/Unity/fake_scopes.h'
38--- tests/mocks/Unity/fake_scopes.h 2014-10-22 13:59:54 +0000
39+++ tests/mocks/Unity/fake_scopes.h 2014-12-10 09:07:28 +0000
40@@ -46,6 +46,7 @@
41 Q_INVOKABLE void addScope(Scope* scope);
42
43 Q_INVOKABLE void clear();
44+ Q_INVOKABLE void clearFavorites();
45 Q_INVOKABLE void load();
46
47 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
48
49=== modified file 'tests/qmltests/Dash/tst_Dash.qml'
50--- tests/qmltests/Dash/tst_Dash.qml 2014-12-03 07:44:46 +0000
51+++ tests/qmltests/Dash/tst_Dash.qml 2014-12-10 09:07:28 +0000
52@@ -38,6 +38,10 @@
53 anchors.fill: parent
54 }
55
56+ SignalSpy {
57+ id: spy
58+ }
59+
60 UT.UnityTestCase {
61 name: "Dash"
62 when: windowShown
63@@ -262,5 +266,30 @@
64 currentScope.setSearchInProgress(false);
65 tryCompare(processingIndicator, "visible", false);
66 }
67+
68+ function test_manage_dash_store_no_favorites() {
69+ // Show the manage dash
70+ touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
71+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
72+ tryCompare(bottomEdgeController, "progress", 1);
73+
74+ // clear the favorite scopes
75+ scopes.clearFavorites();
76+ var dashContentList = findChild(dash, "dashContentList");
77+ tryCompare(dashContentList, "count", 0);
78+
79+ var scopesList = findChild(dash, "scopesList");
80+ spy.target = scopesList.scope;
81+ spy.signalName = "performQuery";
82+
83+ // Do a search
84+ var scopesListPageHeader = findChild(scopesList, "pageHeader");
85+ var searchButton = findChild(scopesListPageHeader, "store_header_button");
86+ mouseClick(searchButton, 0, 0);
87+
88+ spy.wait();
89+ compare(spy.signalArguments[0][0], "scope://com.canonical.scopes.clickstore");
90+ tryCompare(bottomEdgeController, "progress", 0);
91+ }
92 }
93 }

Subscribers

People subscribed via source and target branches