Merge lp:~cimi/unity8/fix-open-new-scope-from-tmp into lp:unity8

Proposed by Andrea Cimitan
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 1563
Merged at revision: 1616
Proposed branch: lp:~cimi/unity8/fix-open-new-scope-from-tmp
Merge into: lp:unity8
Prerequisite: lp:~aacid/unity8/testFor1316660
Diff against target: 420 lines (+130/-23)
14 files modified
debian/control (+2/-2)
qml/Dash/Dash.qml (+6/-8)
qml/Dash/DashContent.qml (+1/-2)
tests/mocks/Unity/CMakeLists.txt (+1/-1)
tests/mocks/Unity/fake_previewmodel.cpp (+15/-1)
tests/mocks/Unity/fake_previewmodel.h (+7/-1)
tests/mocks/Unity/fake_previewstack.cpp (+2/-2)
tests/mocks/Unity/fake_previewstack.h (+3/-1)
tests/mocks/Unity/fake_previewwidgetmodel.cpp (+1/-0)
tests/mocks/Unity/fake_scope.cpp (+5/-5)
tests/mocks/Unity/fake_scopes.cpp (+12/-0)
tests/mocks/Unity/fake_scopes.h (+5/-0)
tests/mocks/Unity/fake_scopesoverview.cpp (+1/-0)
tests/qmltests/Dash/tst_Dash.qml (+69/-0)
To merge this branch: bzr merge lp:~cimi/unity8/fix-open-new-scope-from-tmp
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Approve
Michał Sawicz Pending
Review via email: mp+249471@code.launchpad.net

This proposal supersedes a proposal from 2015-02-04.

Commit message

Fix temp scopes opening temp scopes, correctly close previously opened temp scope with its preview

Description of the change

* Are there any related MPs required for this MP to build/function as expected? Please list.
https://code.launchpad.net/~stolowski/unity-scopes-shell/fix-temp-scopes/+merge/248235
https://code.launchpad.net/~stolowski/unity-api/scopes-close-scope/+merge/248725
 * 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
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

I don't understand the MR, you're adding to fake_scopes three methods that you don't use and you're removing the code in closeScopes that checks that the scope you closed is indeed a scope that was opened.

Also what's the point of having the scopeThatOpenedScope variable now that you can simply use scopes.closeScope?

review: Needs Information
Revision history for this message
Andrea Cimitan (cimi) wrote : Posted in a previous version of this proposal

> I don't understand the MR, you're adding to fake_scopes three methods that you
> don't use

future proof, if we wanted to test those, since they added API for this branch

and you're removing the code in closeScopes that checks that the
> scope you closed is indeed a scope that was opened.
>
that code is broken... m_openScope is never updated

> Also what's the point of having the scopeThatOpenedScope variable now that you
> can simply use scopes.closeScope?

I can switch to that too... but didn't want to move far from the previous implementation

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

> > I don't understand the MR, you're adding to fake_scopes three methods that
> you
> > don't use
>
> future proof, if we wanted to test those, since they added API for this branch

Hmmm, no, the only added api for the branch is
Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope);
the others are private methods you'll never see

>
> and you're removing the code in closeScopes that checks that the
> > scope you closed is indeed a scope that was opened.
> >
> that code is broken... m_openScope is never updated

Broken where? after your changes? may be, then what about fixing it?

> > Also what's the point of having the scopeThatOpenedScope variable now that
> you
> > can simply use scopes.closeScope?
>
> I can switch to that too... but didn't want to move far from the previous
> implementation

Well, you made Pawel to add this new method and now you're not using it?

Also, why are you using
  dashTempScopeItem.scope.openScope(scopes.getScopeFromAll("MockScope9"));
?
Can you please make it work with a click that calls activate in the scope and thus ends up in Scope::activate that emits openScope?
That way we're properly exercising all the parts of the code

Revision history for this message
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal

You need to depend on the new unity-api version, bump the API requirement in tests/mocks/Unity/CMakeLists.txt and bump unity-scopes-impl dep in debian/control.

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

Please drop scopeThatOpenedScope since we don't need it anymore now that we can just close directly from Scopes

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

Seems like you don't need to store m_scopes in PreviewStack and you can just pass it down to the PreviewModel in the constructor, no?

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

You have declared
  unity::shell::scopes::ScopeInterface* findTempScope(QString const& id) const;
but not implemented it, just kill it?

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

Please mark closeScope in Scopes with override to mark it implements the declaration of the same function in the internface

review: Needs Fixing
Revision history for this message
Andrea Cimitan (cimi) wrote :

Done

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Can you please turn

if (!m_tempScopes.contains(scope)) {
   m_tempScopes.insert(scope);
 }

into just
   m_tempScopes.insert(scope);

It's a QSet after all, inserting won't produce a duplicate anyway

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

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes, bug is fixed

 * Did CI run pass?
No the jenkins one because it needs new unity-api, ran locally and found nothing.

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

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Somehow i missed a qml test failure, testPreview segfaults, please fix

review: Needs Fixing
1563. By Andrea Cimitan

Fix testPreview

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

It's good again

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2015-02-11 17:12:22 +0000
+++ debian/control 2015-02-16 12:09:57 +0000
@@ -27,7 +27,7 @@
27 libqmenumodel-dev (>= 0.2.9),27 libqmenumodel-dev (>= 0.2.9),
28 libqt5xmlpatterns5-dev,28 libqt5xmlpatterns5-dev,
29 libsystemsettings-dev,29 libsystemsettings-dev,
30 libunity-api-dev (>= 7.95),30 libunity-api-dev (>= 7.96),
31 libusermetricsoutput1-dev,31 libusermetricsoutput1-dev,
32 libxcb1-dev,32 libxcb1-dev,
33 pkg-config,33 pkg-config,
@@ -126,7 +126,7 @@
126 unity-application-impl-4,126 unity-application-impl-4,
127 unity-notifications-impl-3,127 unity-notifications-impl-3,
128 unity-plugin-scopes | unity-scopes-impl,128 unity-plugin-scopes | unity-scopes-impl,
129 unity-scopes-impl-4,129 unity-scopes-impl-6,
130 unity8-fake-env | unity-application-impl,130 unity8-fake-env | unity-application-impl,
131 ${misc:Depends},131 ${misc:Depends},
132Breaks: unity8 (<< 7.86),132Breaks: unity8 (<< 7.86),
133133
=== modified file 'qml/Dash/Dash.qml'
--- qml/Dash/Dash.qml 2015-01-12 08:31:10 +0000
+++ qml/Dash/Dash.qml 2015-02-16 12:09:57 +0000
@@ -122,7 +122,6 @@
122 dash.setCurrentScope(scopeId, true, false);122 dash.setCurrentScope(scopeId, true, false);
123 }123 }
124 onOpenScope: {124 onOpenScope: {
125 scopeItem.scopeThatOpenedScope = currentScope;
126 scopeItem.scope = scope;125 scopeItem.scope = scope;
127 x = -width;126 x = -width;
128 }127 }
@@ -130,7 +129,7 @@
130 UbuntuNumberAnimation {129 UbuntuNumberAnimation {
131 onRunningChanged: {130 onRunningChanged: {
132 if (!running && dashContent.x == 0) {131 if (!running && dashContent.x == 0) {
133 scopeItem.scopeThatOpenedScope.closeScope(scopeItem.scope);132 scopes.closeScope(scopeItem.scope);
134 scopeItem.scope = null;133 scopeItem.scope = null;
135 }134 }
136 }135 }
@@ -187,7 +186,6 @@
187 onOpenScope: {186 onOpenScope: {
188 bottomEdgeController.enableAnimation = true;187 bottomEdgeController.enableAnimation = true;
189 bottomEdgeController.progress = 0;188 bottomEdgeController.progress = 0;
190 scopeItem.scopeThatOpenedScope = scopesList.scope;
191 scopeItem.scope = scope;189 scopeItem.scope = scope;
192 dashContent.x = -dashContent.width;190 dashContent.x = -dashContent.width;
193 }191 }
@@ -199,8 +197,7 @@
199 }197 }
200 }198 }
201199
202 DashBackground200 DashBackground {
203 {
204 anchors.fill: scopeItem201 anchors.fill: scopeItem
205 visible: scopeItem.visible202 visible: scopeItem.visible
206 }203 }
@@ -209,8 +206,6 @@
209 id: scopeItem206 id: scopeItem
210 objectName: "dashTempScopeItem"207 objectName: "dashTempScopeItem"
211208
212 property var scopeThatOpenedScope: null
213
214 x: dashContent.x + width209 x: dashContent.x + width
215 y: dashContent.y210 y: dashContent.y
216 width: parent.width211 width: parent.width
@@ -229,7 +224,10 @@
229 dashContent.gotoScope(scopeId);224 dashContent.gotoScope(scopeId);
230 }225 }
231 onOpenScope: {226 onOpenScope: {
232 dashContent.openScope(scope);227 scopeItem.closePreview();
228 var oldScope = scopeItem.scope;
229 scopeItem.scope = scope;
230 scopes.closeScope(oldScope);
233 }231 }
234 }232 }
235 }233 }
236234
=== modified file 'qml/Dash/DashContent.qml'
--- qml/Dash/DashContent.qml 2015-01-05 15:08:04 +0000
+++ qml/Dash/DashContent.qml 2015-02-16 12:09:57 +0000
@@ -84,8 +84,7 @@
8484
85 set_current_index = undefined;85 set_current_index = undefined;
8686
87 if (dashContentList.count > index)87 if (dashContentList.count > index) {
88 {
89 dashContentList.currentIndex = index88 dashContentList.currentIndex = index
9089
91 if (reset) {90 if (reset) {
9291
=== modified file 'tests/mocks/Unity/CMakeLists.txt'
--- tests/mocks/Unity/CMakeLists.txt 2015-02-04 13:22:27 +0000
+++ tests/mocks/Unity/CMakeLists.txt 2015-02-16 12:09:57 +0000
@@ -6,7 +6,7 @@
6add_subdirectory(DashCommunicator)6add_subdirectory(DashCommunicator)
77
8pkg_search_module(GOBJECT gobject-2.0 REQUIRED)8pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
9pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=5)9pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=6)
1010
11include_directories(11include_directories(
12 ${CMAKE_CURRENT_BINARY_DIR}12 ${CMAKE_CURRENT_BINARY_DIR}
1313
=== modified file 'tests/mocks/Unity/fake_previewmodel.cpp'
--- tests/mocks/Unity/fake_previewmodel.cpp 2014-08-11 09:57:29 +0000
+++ tests/mocks/Unity/fake_previewmodel.cpp 2015-02-16 12:09:57 +0000
@@ -22,18 +22,23 @@
22#include "fake_previewmodel.h"22#include "fake_previewmodel.h"
2323
24// local24// local
25#include "fake_scope.h"
26#include "fake_scopes.h"
25#include "fake_previewwidgetmodel.h"27#include "fake_previewwidgetmodel.h"
2628
27// Qt29// Qt
28#include <QDebug>30#include <QDebug>
2931
30PreviewModel::PreviewModel(QObject* parent)32PreviewModel::PreviewModel(QObject* parent, Scope* scope)
31 : unity::shell::scopes::PreviewModelInterface(parent)33 : unity::shell::scopes::PreviewModelInterface(parent)
32 , m_loaded(true)34 , m_loaded(true)
35 , m_scope(scope)
33{36{
34 // we have one column by default37 // we have one column by default
35 PreviewWidgetModel* columnModel = new PreviewWidgetModel(this);38 PreviewWidgetModel* columnModel = new PreviewWidgetModel(this);
36 m_previewWidgetModels.append(columnModel);39 m_previewWidgetModels.append(columnModel);
40 connect(this, SIGNAL(triggered(QString const&, QString const&, QVariantMap const&)),
41 this, SLOT(triggeredSlot(QString const&, QString const&, QVariantMap const&)));
37}42}
3843
39void PreviewModel::setWidgetColumnCount(int count)44void PreviewModel::setWidgetColumnCount(int count)
@@ -80,3 +85,12 @@
80 Q_EMIT loadedChanged();85 Q_EMIT loadedChanged();
81 }86 }
82}87}
88
89void PreviewModel::triggeredSlot(QString const&, QString const&, QVariantMap const&) {
90 if (m_scope) {
91 Scopes *scopes = dynamic_cast<Scopes*>(m_scope->parent());
92 Scope* scope = scopes->getScopeFromAll("MockScope9");
93 scopes->addTempScope(scope);
94 Q_EMIT m_scope->openScope(scope);
95 }
96}
8397
=== modified file 'tests/mocks/Unity/fake_previewmodel.h'
--- tests/mocks/Unity/fake_previewmodel.h 2014-08-11 09:57:29 +0000
+++ tests/mocks/Unity/fake_previewmodel.h 2015-02-16 12:09:57 +0000
@@ -25,12 +25,14 @@
2525
26class PreviewWidgetModel;26class PreviewWidgetModel;
2727
28class Scope;
29
28class PreviewModel : public unity::shell::scopes::PreviewModelInterface30class PreviewModel : public unity::shell::scopes::PreviewModelInterface
29{31{
30 Q_OBJECT32 Q_OBJECT
3133
32public:34public:
33 explicit PreviewModel(QObject* parent = 0);35 explicit PreviewModel(QObject* parent = 0, Scope* scope = 0);
3436
35 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;37 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
36 int rowCount(const QModelIndex& parent = QModelIndex()) const override;38 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
@@ -42,9 +44,13 @@
4244
43 Q_INVOKABLE void setLoaded(bool); // Only available for testing45 Q_INVOKABLE void setLoaded(bool); // Only available for testing
4446
47private Q_SLOTS:
48 void triggeredSlot(QString const&, QString const&, QVariantMap const&);
49
45private:50private:
46 QList<PreviewWidgetModel*> m_previewWidgetModels;51 QList<PreviewWidgetModel*> m_previewWidgetModels;
47 bool m_loaded;52 bool m_loaded;
53 Scope* m_scope;
48};54};
4955
50Q_DECLARE_METATYPE(PreviewModel*)56Q_DECLARE_METATYPE(PreviewModel*)
5157
=== modified file 'tests/mocks/Unity/fake_previewstack.cpp'
--- tests/mocks/Unity/fake_previewstack.cpp 2014-05-19 11:10:58 +0000
+++ tests/mocks/Unity/fake_previewstack.cpp 2015-02-16 12:09:57 +0000
@@ -21,10 +21,10 @@
21#include "fake_previewmodel.h"21#include "fake_previewmodel.h"
22#include "fake_scope.h"22#include "fake_scope.h"
2323
24PreviewStack::PreviewStack(QObject* parent)24PreviewStack::PreviewStack(QObject* parent, Scope *scope)
25 : unity::shell::scopes::PreviewStackInterface(parent)25 : unity::shell::scopes::PreviewStackInterface(parent)
26{26{
27 m_previews << new PreviewModel(this);27 m_previews << new PreviewModel(this, scope);
28}28}
2929
30PreviewStack::~PreviewStack()30PreviewStack::~PreviewStack()
3131
=== modified file 'tests/mocks/Unity/fake_previewstack.h'
--- tests/mocks/Unity/fake_previewstack.h 2014-05-19 11:10:58 +0000
+++ tests/mocks/Unity/fake_previewstack.h 2015-02-16 12:09:57 +0000
@@ -25,12 +25,14 @@
2525
26class PreviewModel;26class PreviewModel;
2727
28class Scope;
29
28class PreviewStack : public unity::shell::scopes::PreviewStackInterface30class PreviewStack : public unity::shell::scopes::PreviewStackInterface
29{31{
30 Q_OBJECT32 Q_OBJECT
3133
32public:34public:
33 explicit PreviewStack(QObject* parent = 0);35 explicit PreviewStack(QObject* parent = 0, Scope* scope = 0);
34 virtual ~PreviewStack();36 virtual ~PreviewStack();
3537
36 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;38 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
3739
=== modified file 'tests/mocks/Unity/fake_previewwidgetmodel.cpp'
--- tests/mocks/Unity/fake_previewwidgetmodel.cpp 2015-02-16 12:09:57 +0000
+++ tests/mocks/Unity/fake_previewwidgetmodel.cpp 2015-02-16 12:09:57 +0000
@@ -57,6 +57,7 @@
57 QVariantMap attributes;57 QVariantMap attributes;
58 QVariantMap buttonData;58 QVariantMap buttonData;
59 buttonData["label"] = "Button";59 buttonData["label"] = "Button";
60 buttonData["id"] = "open_click";
60 QVariantList buttons;61 QVariantList buttons;
61 buttons << buttonData << buttonData << buttonData;62 buttons << buttonData << buttonData << buttonData;
62 attributes["actions"] = QVariant::fromValue(buttons);63 attributes["actions"] = QVariant::fromValue(buttons);
6364
=== modified file 'tests/mocks/Unity/fake_scope.cpp'
--- tests/mocks/Unity/fake_scope.cpp 2014-12-15 12:39:00 +0000
+++ tests/mocks/Unity/fake_scope.cpp 2015-02-16 12:09:57 +0000
@@ -185,6 +185,7 @@
185 if (result.toString() == "Result.2.2") {185 if (result.toString() == "Result.2.2") {
186 Scopes *scopes = dynamic_cast<Scopes*>(parent());186 Scopes *scopes = dynamic_cast<Scopes*>(parent());
187 m_openScope = scopes->getScopeFromAll("MockScope9");187 m_openScope = scopes->getScopeFromAll("MockScope9");
188 scopes->addTempScope(m_openScope);
188 Q_EMIT openScope(m_openScope);189 Q_EMIT openScope(m_openScope);
189 }190 }
190}191}
@@ -198,7 +199,7 @@
198 } else {199 } else {
199 // This probably leaks, do we don't care200 // This probably leaks, do we don't care
200 // it's a test after all201 // it's a test after all
201 return new PreviewStack;202 return new PreviewStack(this, this);
202 }203 }
203}204}
204205
@@ -208,11 +209,10 @@
208209
209void Scope::closeScope(unity::shell::scopes::ScopeInterface* scope)210void Scope::closeScope(unity::shell::scopes::ScopeInterface* scope)
210{211{
211 if (scope != m_openScope) {212 Scopes *scopes = dynamic_cast<Scopes*>(parent());
212 qDebug() << scope << m_openScope;213 if (scopes) {
213 qFatal("Scope::closeScope got wrong scope in closeScope");214 return scopes->closeScope(scope);
214 }215 }
215 m_openScope = nullptr;
216}216}
217217
218QString Scope::currentNavigationId() const218QString Scope::currentNavigationId() const
219219
=== modified file 'tests/mocks/Unity/fake_scopes.cpp'
--- tests/mocks/Unity/fake_scopes.cpp 2014-12-16 09:03:37 +0000
+++ tests/mocks/Unity/fake_scopes.cpp 2015-02-16 12:09:57 +0000
@@ -23,6 +23,7 @@
23// TODO: Implement remaining pieces, like Categories (i.e. LensView now gives warnings)23// TODO: Implement remaining pieces, like Categories (i.e. LensView now gives warnings)
2424
25// Qt25// Qt
26#include <QDebug>
26#include <QTimer>27#include <QTimer>
2728
28Scopes::Scopes(QObject *parent)29Scopes::Scopes(QObject *parent)
@@ -177,6 +178,17 @@
177 return m_scopesOverview;178 return m_scopesOverview;
178}179}
179180
181void Scopes::addTempScope(unity::shell::scopes::ScopeInterface* scope)
182{
183 m_tempScopes.insert(scope);
184}
185
186void Scopes::closeScope(unity::shell::scopes::ScopeInterface* scope)
187{
188 Q_ASSERT(m_tempScopes.contains(scope));
189 m_tempScopes.remove(scope);
190}
191
180void Scopes::setFavorite(const QString& scopeId, bool favorite)192void Scopes::setFavorite(const QString& scopeId, bool favorite)
181{193{
182 if (favorite) {194 if (favorite) {
183195
=== modified file 'tests/mocks/Unity/fake_scopes.h'
--- tests/mocks/Unity/fake_scopes.h 2014-12-10 09:07:14 +0000
+++ tests/mocks/Unity/fake_scopes.h 2015-02-16 12:09:57 +0000
@@ -26,6 +26,7 @@
2626
27// Qt27// Qt
28#include <QList>28#include <QList>
29#include <QSet>
29#include <QTimer>30#include <QTimer>
3031
31class ScopesOverview;32class ScopesOverview;
@@ -59,6 +60,9 @@
59 Q_INVOKABLE void setFavorite(const QString& scopeId, bool favorite) override;60 Q_INVOKABLE void setFavorite(const QString& scopeId, bool favorite) override;
60 Q_INVOKABLE void moveFavoriteTo(const QString& scopeId, int index) override;61 Q_INVOKABLE void moveFavoriteTo(const QString& scopeId, int index) override;
6162
63 void addTempScope(unity::shell::scopes::ScopeInterface* scope);
64 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
65
62 // This is used as part of implementation of the other C++ code, not API66 // This is used as part of implementation of the other C++ code, not API
63 QList<Scope*> favScopes() const;67 QList<Scope*> favScopes() const;
64 QList<Scope*> nonFavScopes() const;68 QList<Scope*> nonFavScopes() const;
@@ -70,6 +74,7 @@
70private:74private:
71 QList<Scope*> m_scopes; // the favorite ones75 QList<Scope*> m_scopes; // the favorite ones
72 QList<Scope*> m_allScopes;76 QList<Scope*> m_allScopes;
77 QSet<unity::shell::scopes::ScopeInterface*> m_tempScopes;
73 ScopesOverview *m_scopesOverview;78 ScopesOverview *m_scopesOverview;
74 bool m_loaded;79 bool m_loaded;
75 QTimer timer;80 QTimer timer;
7681
=== modified file 'tests/mocks/Unity/fake_scopesoverview.cpp'
--- tests/mocks/Unity/fake_scopesoverview.cpp 2014-12-16 09:03:37 +0000
+++ tests/mocks/Unity/fake_scopesoverview.cpp 2015-02-16 12:09:57 +0000
@@ -48,6 +48,7 @@
48 Q_EMIT gotoScope(result.toString());48 Q_EMIT gotoScope(result.toString());
49 } else {49 } else {
50 m_openScope = scopes->getScopeFromAll(result.toString());50 m_openScope = scopes->getScopeFromAll(result.toString());
51 scopes->addTempScope(m_openScope);
51 Q_EMIT openScope(m_openScope);52 Q_EMIT openScope(m_openScope);
52 }53 }
53}54}
5455
=== modified file 'tests/qmltests/Dash/tst_Dash.qml'
--- tests/qmltests/Dash/tst_Dash.qml 2015-01-09 10:42:42 +0000
+++ tests/qmltests/Dash/tst_Dash.qml 2015-02-16 12:09:57 +0000
@@ -428,5 +428,74 @@
428 tryCompare(bottomEdgeController, "progress", 0);428 tryCompare(bottomEdgeController, "progress", 0);
429 tryCompare(dashContentList, "currentIndex", 1)429 tryCompare(dashContentList, "currentIndex", 1)
430 }430 }
431
432 function test_close_temp_scope_preview_opening_scope() {
433 // Show the manage dash
434 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
435 var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
436 tryCompare(bottomEdgeController, "progress", 1);
437
438 // Make sure stuff is loaded
439 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
440 var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");
441 tryCompare(nonfavScopesListCategoryList, "currentIndex", 0);
442
443 // Click on a non favorite scope
444 mouseClick(nonfavScopesListCategoryList.currentItem);
445
446 // Check the bottom edge (manage dash) is disabled from temp scope
447 var overviewDragHandle = findChild(dash, "overviewDragHandle");
448 compare(overviewDragHandle.enabled, false);
449
450 // Check temp scope is there
451 var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
452 tryCompare(dashTempScopeItem, "x", 0);
453 tryCompare(dashTempScopeItem, "visible", true);
454
455 // Check the manage dash is gone
456 tryCompare(bottomEdgeController, "progress", 0);
457
458 // Open preview
459 var categoryListView = findChild(dashTempScopeItem, "categoryListView");
460 categoryListView.positionAtBeginning();
461 tryCompareFunction(function() {
462 var cardGrid = findChild(dashTempScopeItem, "dashCategory0");
463 if (cardGrid != null) {
464 var tile = findChild(cardGrid, "delegate0");
465 return tile != null;
466 }
467 return false;
468 },
469 true);
470 var tile = findChild(findChild(dashTempScopeItem, "dashCategory0"), "delegate0");
471 waitForRendering(tile);
472 mouseClick(tile);
473 var subPageLoader = findChild(dashTempScopeItem, "subPageLoader");
474 tryCompare(subPageLoader, "open", true);
475 tryCompare(subPageLoader, "x", 0);
476 tryCompare(findChild(dashTempScopeItem, "categoryListView"), "visible", false);
477 var previewListRow0 = findChild(subPageLoader, "previewListRow0");
478 touchFlick(previewListRow0, previewListRow0.width / 2, units.gu(20), previewListRow0.width / 2, units.gu(1));
479 tryCompare(previewListRow0, "atYEnd", true);
480 tryCompare(previewListRow0, "moving", false);
481 var widget = findChild(subPageLoader, "widget-21");
482 var initialWidgetHeight = widget.height;
483 var openButton = findChild(widget, "buttonopen_click");
484 mouseClick(openButton);
485
486 tryCompare(subPageLoader, "open", false);
487 tryCompare(subPageLoader, "x", subPageLoader.width);
488
489 compare(dashTempScopeItem.scope.id, "MockScope9");
490
491 // Go back
492 var dashTempScopeItemHeader = findChild(dashTempScopeItem, "scopePageHeader");
493 var backButton = findChild(findChild(dashTempScopeItemHeader, "innerPageHeader"), "customBackButton");
494 mouseClick(backButton);
495
496 // Check temp scope is gone
497 tryCompare(dashTempScopeItem, "x", dash.width);
498 tryCompare(dashTempScopeItem, "visible", false);
499 }
431 }500 }
432}501}

Subscribers

People subscribed via source and target branches