Merge lp:~cimi/unity8/fix-open-new-scope-from-tmp into lp:unity8
- fix-open-new-scope-from-tmp
- Merge into trunk
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 |
Related bugs: |
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:/
https:/
* 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
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
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 scopeThatOpened
> can simply use scopes.closeScope?
I can switch to that too... but didn't want to move far from the previous implementation
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1552
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
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(
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 scopeThatOpened
> 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
dashTempScope
?
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
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/
Albert Astals Cid (aacid) wrote : | # |
Please drop scopeThatOpened
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?
Albert Astals Cid (aacid) wrote : | # |
You have declared
unity:
but not implemented it, just kill it?
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
Andrea Cimitan (cimi) wrote : | # |
Done
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1557
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1558
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
Can you please turn
if (!m_tempScopes.
m_tempScopes
}
into just
m_tempScopes
It's a QSet after all, inserting won't produce a duplicate anyway
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
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1559
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
Somehow i missed a qml test failure, testPreview segfaults, please fix
- 1563. By Andrea Cimitan
-
Fix testPreview
Albert Astals Cid (aacid) wrote : | # |
It's good again
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1563
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'debian/control' |
2 | --- debian/control 2015-02-11 17:12:22 +0000 |
3 | +++ debian/control 2015-02-16 12:09:57 +0000 |
4 | @@ -27,7 +27,7 @@ |
5 | libqmenumodel-dev (>= 0.2.9), |
6 | libqt5xmlpatterns5-dev, |
7 | libsystemsettings-dev, |
8 | - libunity-api-dev (>= 7.95), |
9 | + libunity-api-dev (>= 7.96), |
10 | libusermetricsoutput1-dev, |
11 | libxcb1-dev, |
12 | pkg-config, |
13 | @@ -126,7 +126,7 @@ |
14 | unity-application-impl-4, |
15 | unity-notifications-impl-3, |
16 | unity-plugin-scopes | unity-scopes-impl, |
17 | - unity-scopes-impl-4, |
18 | + unity-scopes-impl-6, |
19 | unity8-fake-env | unity-application-impl, |
20 | ${misc:Depends}, |
21 | Breaks: unity8 (<< 7.86), |
22 | |
23 | === modified file 'qml/Dash/Dash.qml' |
24 | --- qml/Dash/Dash.qml 2015-01-12 08:31:10 +0000 |
25 | +++ qml/Dash/Dash.qml 2015-02-16 12:09:57 +0000 |
26 | @@ -122,7 +122,6 @@ |
27 | dash.setCurrentScope(scopeId, true, false); |
28 | } |
29 | onOpenScope: { |
30 | - scopeItem.scopeThatOpenedScope = currentScope; |
31 | scopeItem.scope = scope; |
32 | x = -width; |
33 | } |
34 | @@ -130,7 +129,7 @@ |
35 | UbuntuNumberAnimation { |
36 | onRunningChanged: { |
37 | if (!running && dashContent.x == 0) { |
38 | - scopeItem.scopeThatOpenedScope.closeScope(scopeItem.scope); |
39 | + scopes.closeScope(scopeItem.scope); |
40 | scopeItem.scope = null; |
41 | } |
42 | } |
43 | @@ -187,7 +186,6 @@ |
44 | onOpenScope: { |
45 | bottomEdgeController.enableAnimation = true; |
46 | bottomEdgeController.progress = 0; |
47 | - scopeItem.scopeThatOpenedScope = scopesList.scope; |
48 | scopeItem.scope = scope; |
49 | dashContent.x = -dashContent.width; |
50 | } |
51 | @@ -199,8 +197,7 @@ |
52 | } |
53 | } |
54 | |
55 | - DashBackground |
56 | - { |
57 | + DashBackground { |
58 | anchors.fill: scopeItem |
59 | visible: scopeItem.visible |
60 | } |
61 | @@ -209,8 +206,6 @@ |
62 | id: scopeItem |
63 | objectName: "dashTempScopeItem" |
64 | |
65 | - property var scopeThatOpenedScope: null |
66 | - |
67 | x: dashContent.x + width |
68 | y: dashContent.y |
69 | width: parent.width |
70 | @@ -229,7 +224,10 @@ |
71 | dashContent.gotoScope(scopeId); |
72 | } |
73 | onOpenScope: { |
74 | - dashContent.openScope(scope); |
75 | + scopeItem.closePreview(); |
76 | + var oldScope = scopeItem.scope; |
77 | + scopeItem.scope = scope; |
78 | + scopes.closeScope(oldScope); |
79 | } |
80 | } |
81 | } |
82 | |
83 | === modified file 'qml/Dash/DashContent.qml' |
84 | --- qml/Dash/DashContent.qml 2015-01-05 15:08:04 +0000 |
85 | +++ qml/Dash/DashContent.qml 2015-02-16 12:09:57 +0000 |
86 | @@ -84,8 +84,7 @@ |
87 | |
88 | set_current_index = undefined; |
89 | |
90 | - if (dashContentList.count > index) |
91 | - { |
92 | + if (dashContentList.count > index) { |
93 | dashContentList.currentIndex = index |
94 | |
95 | if (reset) { |
96 | |
97 | === modified file 'tests/mocks/Unity/CMakeLists.txt' |
98 | --- tests/mocks/Unity/CMakeLists.txt 2015-02-04 13:22:27 +0000 |
99 | +++ tests/mocks/Unity/CMakeLists.txt 2015-02-16 12:09:57 +0000 |
100 | @@ -6,7 +6,7 @@ |
101 | add_subdirectory(DashCommunicator) |
102 | |
103 | pkg_search_module(GOBJECT gobject-2.0 REQUIRED) |
104 | -pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=5) |
105 | +pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=6) |
106 | |
107 | include_directories( |
108 | ${CMAKE_CURRENT_BINARY_DIR} |
109 | |
110 | === modified file 'tests/mocks/Unity/fake_previewmodel.cpp' |
111 | --- tests/mocks/Unity/fake_previewmodel.cpp 2014-08-11 09:57:29 +0000 |
112 | +++ tests/mocks/Unity/fake_previewmodel.cpp 2015-02-16 12:09:57 +0000 |
113 | @@ -22,18 +22,23 @@ |
114 | #include "fake_previewmodel.h" |
115 | |
116 | // local |
117 | +#include "fake_scope.h" |
118 | +#include "fake_scopes.h" |
119 | #include "fake_previewwidgetmodel.h" |
120 | |
121 | // Qt |
122 | #include <QDebug> |
123 | |
124 | -PreviewModel::PreviewModel(QObject* parent) |
125 | +PreviewModel::PreviewModel(QObject* parent, Scope* scope) |
126 | : unity::shell::scopes::PreviewModelInterface(parent) |
127 | , m_loaded(true) |
128 | + , m_scope(scope) |
129 | { |
130 | // we have one column by default |
131 | PreviewWidgetModel* columnModel = new PreviewWidgetModel(this); |
132 | m_previewWidgetModels.append(columnModel); |
133 | + connect(this, SIGNAL(triggered(QString const&, QString const&, QVariantMap const&)), |
134 | + this, SLOT(triggeredSlot(QString const&, QString const&, QVariantMap const&))); |
135 | } |
136 | |
137 | void PreviewModel::setWidgetColumnCount(int count) |
138 | @@ -80,3 +85,12 @@ |
139 | Q_EMIT loadedChanged(); |
140 | } |
141 | } |
142 | + |
143 | +void PreviewModel::triggeredSlot(QString const&, QString const&, QVariantMap const&) { |
144 | + if (m_scope) { |
145 | + Scopes *scopes = dynamic_cast<Scopes*>(m_scope->parent()); |
146 | + Scope* scope = scopes->getScopeFromAll("MockScope9"); |
147 | + scopes->addTempScope(scope); |
148 | + Q_EMIT m_scope->openScope(scope); |
149 | + } |
150 | +} |
151 | |
152 | === modified file 'tests/mocks/Unity/fake_previewmodel.h' |
153 | --- tests/mocks/Unity/fake_previewmodel.h 2014-08-11 09:57:29 +0000 |
154 | +++ tests/mocks/Unity/fake_previewmodel.h 2015-02-16 12:09:57 +0000 |
155 | @@ -25,12 +25,14 @@ |
156 | |
157 | class PreviewWidgetModel; |
158 | |
159 | +class Scope; |
160 | + |
161 | class PreviewModel : public unity::shell::scopes::PreviewModelInterface |
162 | { |
163 | Q_OBJECT |
164 | |
165 | public: |
166 | - explicit PreviewModel(QObject* parent = 0); |
167 | + explicit PreviewModel(QObject* parent = 0, Scope* scope = 0); |
168 | |
169 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; |
170 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; |
171 | @@ -42,9 +44,13 @@ |
172 | |
173 | Q_INVOKABLE void setLoaded(bool); // Only available for testing |
174 | |
175 | +private Q_SLOTS: |
176 | + void triggeredSlot(QString const&, QString const&, QVariantMap const&); |
177 | + |
178 | private: |
179 | QList<PreviewWidgetModel*> m_previewWidgetModels; |
180 | bool m_loaded; |
181 | + Scope* m_scope; |
182 | }; |
183 | |
184 | Q_DECLARE_METATYPE(PreviewModel*) |
185 | |
186 | === modified file 'tests/mocks/Unity/fake_previewstack.cpp' |
187 | --- tests/mocks/Unity/fake_previewstack.cpp 2014-05-19 11:10:58 +0000 |
188 | +++ tests/mocks/Unity/fake_previewstack.cpp 2015-02-16 12:09:57 +0000 |
189 | @@ -21,10 +21,10 @@ |
190 | #include "fake_previewmodel.h" |
191 | #include "fake_scope.h" |
192 | |
193 | -PreviewStack::PreviewStack(QObject* parent) |
194 | +PreviewStack::PreviewStack(QObject* parent, Scope *scope) |
195 | : unity::shell::scopes::PreviewStackInterface(parent) |
196 | { |
197 | - m_previews << new PreviewModel(this); |
198 | + m_previews << new PreviewModel(this, scope); |
199 | } |
200 | |
201 | PreviewStack::~PreviewStack() |
202 | |
203 | === modified file 'tests/mocks/Unity/fake_previewstack.h' |
204 | --- tests/mocks/Unity/fake_previewstack.h 2014-05-19 11:10:58 +0000 |
205 | +++ tests/mocks/Unity/fake_previewstack.h 2015-02-16 12:09:57 +0000 |
206 | @@ -25,12 +25,14 @@ |
207 | |
208 | class PreviewModel; |
209 | |
210 | +class Scope; |
211 | + |
212 | class PreviewStack : public unity::shell::scopes::PreviewStackInterface |
213 | { |
214 | Q_OBJECT |
215 | |
216 | public: |
217 | - explicit PreviewStack(QObject* parent = 0); |
218 | + explicit PreviewStack(QObject* parent = 0, Scope* scope = 0); |
219 | virtual ~PreviewStack(); |
220 | |
221 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; |
222 | |
223 | === modified file 'tests/mocks/Unity/fake_previewwidgetmodel.cpp' |
224 | --- tests/mocks/Unity/fake_previewwidgetmodel.cpp 2015-02-16 12:09:57 +0000 |
225 | +++ tests/mocks/Unity/fake_previewwidgetmodel.cpp 2015-02-16 12:09:57 +0000 |
226 | @@ -57,6 +57,7 @@ |
227 | QVariantMap attributes; |
228 | QVariantMap buttonData; |
229 | buttonData["label"] = "Button"; |
230 | + buttonData["id"] = "open_click"; |
231 | QVariantList buttons; |
232 | buttons << buttonData << buttonData << buttonData; |
233 | attributes["actions"] = QVariant::fromValue(buttons); |
234 | |
235 | === modified file 'tests/mocks/Unity/fake_scope.cpp' |
236 | --- tests/mocks/Unity/fake_scope.cpp 2014-12-15 12:39:00 +0000 |
237 | +++ tests/mocks/Unity/fake_scope.cpp 2015-02-16 12:09:57 +0000 |
238 | @@ -185,6 +185,7 @@ |
239 | if (result.toString() == "Result.2.2") { |
240 | Scopes *scopes = dynamic_cast<Scopes*>(parent()); |
241 | m_openScope = scopes->getScopeFromAll("MockScope9"); |
242 | + scopes->addTempScope(m_openScope); |
243 | Q_EMIT openScope(m_openScope); |
244 | } |
245 | } |
246 | @@ -198,7 +199,7 @@ |
247 | } else { |
248 | // This probably leaks, do we don't care |
249 | // it's a test after all |
250 | - return new PreviewStack; |
251 | + return new PreviewStack(this, this); |
252 | } |
253 | } |
254 | |
255 | @@ -208,11 +209,10 @@ |
256 | |
257 | void Scope::closeScope(unity::shell::scopes::ScopeInterface* scope) |
258 | { |
259 | - if (scope != m_openScope) { |
260 | - qDebug() << scope << m_openScope; |
261 | - qFatal("Scope::closeScope got wrong scope in closeScope"); |
262 | + Scopes *scopes = dynamic_cast<Scopes*>(parent()); |
263 | + if (scopes) { |
264 | + return scopes->closeScope(scope); |
265 | } |
266 | - m_openScope = nullptr; |
267 | } |
268 | |
269 | QString Scope::currentNavigationId() const |
270 | |
271 | === modified file 'tests/mocks/Unity/fake_scopes.cpp' |
272 | --- tests/mocks/Unity/fake_scopes.cpp 2014-12-16 09:03:37 +0000 |
273 | +++ tests/mocks/Unity/fake_scopes.cpp 2015-02-16 12:09:57 +0000 |
274 | @@ -23,6 +23,7 @@ |
275 | // TODO: Implement remaining pieces, like Categories (i.e. LensView now gives warnings) |
276 | |
277 | // Qt |
278 | +#include <QDebug> |
279 | #include <QTimer> |
280 | |
281 | Scopes::Scopes(QObject *parent) |
282 | @@ -177,6 +178,17 @@ |
283 | return m_scopesOverview; |
284 | } |
285 | |
286 | +void Scopes::addTempScope(unity::shell::scopes::ScopeInterface* scope) |
287 | +{ |
288 | + m_tempScopes.insert(scope); |
289 | +} |
290 | + |
291 | +void Scopes::closeScope(unity::shell::scopes::ScopeInterface* scope) |
292 | +{ |
293 | + Q_ASSERT(m_tempScopes.contains(scope)); |
294 | + m_tempScopes.remove(scope); |
295 | +} |
296 | + |
297 | void Scopes::setFavorite(const QString& scopeId, bool favorite) |
298 | { |
299 | if (favorite) { |
300 | |
301 | === modified file 'tests/mocks/Unity/fake_scopes.h' |
302 | --- tests/mocks/Unity/fake_scopes.h 2014-12-10 09:07:14 +0000 |
303 | +++ tests/mocks/Unity/fake_scopes.h 2015-02-16 12:09:57 +0000 |
304 | @@ -26,6 +26,7 @@ |
305 | |
306 | // Qt |
307 | #include <QList> |
308 | +#include <QSet> |
309 | #include <QTimer> |
310 | |
311 | class ScopesOverview; |
312 | @@ -59,6 +60,9 @@ |
313 | Q_INVOKABLE void setFavorite(const QString& scopeId, bool favorite) override; |
314 | Q_INVOKABLE void moveFavoriteTo(const QString& scopeId, int index) override; |
315 | |
316 | + void addTempScope(unity::shell::scopes::ScopeInterface* scope); |
317 | + Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override; |
318 | + |
319 | // This is used as part of implementation of the other C++ code, not API |
320 | QList<Scope*> favScopes() const; |
321 | QList<Scope*> nonFavScopes() const; |
322 | @@ -70,6 +74,7 @@ |
323 | private: |
324 | QList<Scope*> m_scopes; // the favorite ones |
325 | QList<Scope*> m_allScopes; |
326 | + QSet<unity::shell::scopes::ScopeInterface*> m_tempScopes; |
327 | ScopesOverview *m_scopesOverview; |
328 | bool m_loaded; |
329 | QTimer timer; |
330 | |
331 | === modified file 'tests/mocks/Unity/fake_scopesoverview.cpp' |
332 | --- tests/mocks/Unity/fake_scopesoverview.cpp 2014-12-16 09:03:37 +0000 |
333 | +++ tests/mocks/Unity/fake_scopesoverview.cpp 2015-02-16 12:09:57 +0000 |
334 | @@ -48,6 +48,7 @@ |
335 | Q_EMIT gotoScope(result.toString()); |
336 | } else { |
337 | m_openScope = scopes->getScopeFromAll(result.toString()); |
338 | + scopes->addTempScope(m_openScope); |
339 | Q_EMIT openScope(m_openScope); |
340 | } |
341 | } |
342 | |
343 | === modified file 'tests/qmltests/Dash/tst_Dash.qml' |
344 | --- tests/qmltests/Dash/tst_Dash.qml 2015-01-09 10:42:42 +0000 |
345 | +++ tests/qmltests/Dash/tst_Dash.qml 2015-02-16 12:09:57 +0000 |
346 | @@ -428,5 +428,74 @@ |
347 | tryCompare(bottomEdgeController, "progress", 0); |
348 | tryCompare(dashContentList, "currentIndex", 1) |
349 | } |
350 | + |
351 | + function test_close_temp_scope_preview_opening_scope() { |
352 | + // Show the manage dash |
353 | + touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2)); |
354 | + var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController"); |
355 | + tryCompare(bottomEdgeController, "progress", 1); |
356 | + |
357 | + // Make sure stuff is loaded |
358 | + var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother"); |
359 | + var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList"); |
360 | + tryCompare(nonfavScopesListCategoryList, "currentIndex", 0); |
361 | + |
362 | + // Click on a non favorite scope |
363 | + mouseClick(nonfavScopesListCategoryList.currentItem); |
364 | + |
365 | + // Check the bottom edge (manage dash) is disabled from temp scope |
366 | + var overviewDragHandle = findChild(dash, "overviewDragHandle"); |
367 | + compare(overviewDragHandle.enabled, false); |
368 | + |
369 | + // Check temp scope is there |
370 | + var dashTempScopeItem = findChild(dash, "dashTempScopeItem"); |
371 | + tryCompare(dashTempScopeItem, "x", 0); |
372 | + tryCompare(dashTempScopeItem, "visible", true); |
373 | + |
374 | + // Check the manage dash is gone |
375 | + tryCompare(bottomEdgeController, "progress", 0); |
376 | + |
377 | + // Open preview |
378 | + var categoryListView = findChild(dashTempScopeItem, "categoryListView"); |
379 | + categoryListView.positionAtBeginning(); |
380 | + tryCompareFunction(function() { |
381 | + var cardGrid = findChild(dashTempScopeItem, "dashCategory0"); |
382 | + if (cardGrid != null) { |
383 | + var tile = findChild(cardGrid, "delegate0"); |
384 | + return tile != null; |
385 | + } |
386 | + return false; |
387 | + }, |
388 | + true); |
389 | + var tile = findChild(findChild(dashTempScopeItem, "dashCategory0"), "delegate0"); |
390 | + waitForRendering(tile); |
391 | + mouseClick(tile); |
392 | + var subPageLoader = findChild(dashTempScopeItem, "subPageLoader"); |
393 | + tryCompare(subPageLoader, "open", true); |
394 | + tryCompare(subPageLoader, "x", 0); |
395 | + tryCompare(findChild(dashTempScopeItem, "categoryListView"), "visible", false); |
396 | + var previewListRow0 = findChild(subPageLoader, "previewListRow0"); |
397 | + touchFlick(previewListRow0, previewListRow0.width / 2, units.gu(20), previewListRow0.width / 2, units.gu(1)); |
398 | + tryCompare(previewListRow0, "atYEnd", true); |
399 | + tryCompare(previewListRow0, "moving", false); |
400 | + var widget = findChild(subPageLoader, "widget-21"); |
401 | + var initialWidgetHeight = widget.height; |
402 | + var openButton = findChild(widget, "buttonopen_click"); |
403 | + mouseClick(openButton); |
404 | + |
405 | + tryCompare(subPageLoader, "open", false); |
406 | + tryCompare(subPageLoader, "x", subPageLoader.width); |
407 | + |
408 | + compare(dashTempScopeItem.scope.id, "MockScope9"); |
409 | + |
410 | + // Go back |
411 | + var dashTempScopeItemHeader = findChild(dashTempScopeItem, "scopePageHeader"); |
412 | + var backButton = findChild(findChild(dashTempScopeItemHeader, "innerPageHeader"), "customBackButton"); |
413 | + mouseClick(backButton); |
414 | + |
415 | + // Check temp scope is gone |
416 | + tryCompare(dashTempScopeItem, "x", dash.width); |
417 | + tryCompare(dashTempScopeItem, "visible", false); |
418 | + } |
419 | } |
420 | } |
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 scopeThatOpened Scope variable now that you can simply use scopes.closeScope?