Merge lp:~cimi/unity8/bug-1541967 into lp:unity8

Proposed by Andrea Cimitan
Status: Superseded
Proposed branch: lp:~cimi/unity8/bug-1541967
Merge into: lp:unity8
Diff against target: 719 lines (+83/-275)
17 files modified
debian/control (+2/-2)
qml/Dash/GenericScopeView.qml (+14/-42)
qml/Dash/PreviewView.qml (+26/-69)
qml/Dash/Previews/Preview.qml (+0/-4)
qml/Dash/Previews/PreviewExpandable.qml (+0/-1)
qml/Dash/Previews/PreviewRatingEdit.qml (+0/-1)
qml/Dash/Previews/PreviewWidget.qml (+0/-3)
qml/Dash/Previews/PreviewWidgetFactory.qml (+0/-4)
qml/Dash/ScopesList.qml (+1/-1)
tests/mocks/Unity/CMakeLists.txt (+1/-3)
tests/mocks/Unity/fake_previewstack.cpp (+0/-68)
tests/mocks/Unity/fake_previewstack.h (+0/-52)
tests/mocks/Unity/fake_scope.cpp (+7/-2)
tests/mocks/Unity/fake_scope.h (+3/-2)
tests/mocks/Unity/fake_unity_plugin.cpp (+1/-2)
tests/qmltests/CMakeLists.txt (+1/-1)
tests/qmltests/Dash/tst_PreviewView.qml (+27/-18)
To merge this branch: bzr merge lp:~cimi/unity8/bug-1541967
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Needs Fixing
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Needs Information
Review via email: mp+285333@code.launchpad.net

This proposal has been superseded by a proposal from 2016-02-19.

Commit message

Make the PreviewListView not interactive so it doesn't scroll

Description of the change

Make the previews not scrollable

 * Are there any related MPs required for this MP to build/function as expected? Please list.
n
 * Did you perform an exploratory manual test run of your code change and any related functionality?
y
 * Did you make sure that your branch does not contain spurious tags?
y
 * 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?
y

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2173
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/289/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/409/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/432
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/450
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/450
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/446
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/446/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/446/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/446
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/446/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/446/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/446
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/446/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/446/console

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/289/rebuild

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

Any reason that we don't fix this properly?

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Paweł Stołowski (stolowski) wrote :

> Any reason that we don't fix this properly?

Proper fix will be possible once I refactor shell plugin and scope interfaces to only expose one preview. WIP.

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

still have to fix the tests and test it with the silo before is ready for review. comments still welcome

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) 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
Andrea Cimitan (cimi) wrote :

> still have to fix the tests and test it with the silo before is ready for
> review. comments still welcome
test fixed, I need to bump debian stuff and test with the silo yet

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) 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
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
lp:~cimi/unity8/bug-1541967 updated
2204. By Andrea Cimitan

merged

2205. By Andrea Cimitan

Merged the other way around

Unmerged revisions

2205. By Andrea Cimitan

Merged the other way around

2204. By Andrea Cimitan

merged

2203. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

2202. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

2201. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

2200. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2016-02-12 00:12:30 +0000
3+++ debian/control 2016-02-19 10:15:29 +0000
4@@ -29,7 +29,7 @@
5 libqt5xmlpatterns5-dev,
6 libsystemsettings-dev,
7 libudev-dev,
8- libunity-api-dev (>= 7.106),
9+ libunity-api-dev (>= 7.107),
10 libusermetricsoutput1-dev,
11 # Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop
12 libx11-dev[!armhf],
13@@ -134,7 +134,7 @@
14 unity-application-impl-13,
15 unity-notifications-impl-3,
16 unity-plugin-scopes | unity-scopes-impl,
17- unity-scopes-impl-9,
18+ unity-scopes-impl-11,
19 unity8-fake-env | unity-application-impl,
20 ${misc:Depends},
21 Breaks: unity8 (<< 7.86),
22
23=== modified file 'qml/Dash/GenericScopeView.qml'
24--- qml/Dash/GenericScopeView.qml 2016-02-04 13:36:51 +0000
25+++ qml/Dash/GenericScopeView.qml 2016-02-19 10:15:29 +0000
26@@ -47,7 +47,7 @@
27 style: scope ? scope.customizations : {}
28 }
29
30- readonly property bool processing: scope ? scope.searchInProgress || subPageLoader.processing : false
31+ readonly property bool processing: scope ? (scope.searchInProgress || scope.activationInProgress || subPageLoader.processing) : false
32
33 signal backClicked()
34
35@@ -73,49 +73,30 @@
36 }
37
38 property var maybePreviewResult;
39- property int maybePreviewIndex;
40- property var maybePreviewResultsModel;
41- property int maybePreviewLimitedCategoryItemCount;
42 property string maybePreviewCategoryId;
43
44 function clearMaybePreviewData() {
45 scopeView.maybePreviewResult = undefined;
46- scopeView.maybePreviewIndex = -1;
47- scopeView.maybePreviewResultsModel = undefined;
48- scopeView.maybePreviewLimitedCategoryItemCount = -1;
49 scopeView.maybePreviewCategoryId = "";
50 }
51
52- function itemClicked(index, result, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {
53+ function itemClicked(result, categoryId) {
54 scopeView.maybePreviewResult = result;
55- scopeView.maybePreviewIndex = index;
56- scopeView.maybePreviewResultsModel = resultsModel;
57- scopeView.maybePreviewLimitedCategoryItemCount = limitedCategoryItemCount;
58 scopeView.maybePreviewCategoryId = categoryId;
59
60 scope.activate(result, categoryId);
61 }
62
63- function itemPressedAndHeld(index, result, resultsModel, limitedCategoryItemCount, categoryId) {
64+ function itemPressedAndHeld(result, categoryId) {
65 clearMaybePreviewData();
66
67- openPreview(result, index, resultsModel, limitedCategoryItemCount, categoryId);
68+ openPreview(result, categoryId);
69 }
70
71- function openPreview(result, index, resultsModel, limitedCategoryItemCount, categoryId) {
72- var previewStack = scope.preview(result, categoryId);
73- if (previewStack) {
74- if (limitedCategoryItemCount > 0) {
75- previewLimitModel.model = resultsModel;
76- previewLimitModel.limit = limitedCategoryItemCount;
77- subPageLoader.model = previewLimitModel;
78- } else {
79- subPageLoader.model = resultsModel;
80- }
81- subPageLoader.initialIndex = -1;
82- subPageLoader.initialIndex = index;
83- subPageLoader.categoryId = categoryId;
84- subPageLoader.previewStack = previewStack;
85+ function openPreview(result, categoryId) {
86+ var previewModel = scope.preview(result, categoryId);
87+ if (previewModel) {
88+ subPageLoader.previewModel = previewModel;
89 subPageLoader.openSubPage("preview");
90 }
91 }
92@@ -166,9 +147,6 @@
93 onPreviewRequested: { // (QVariant const& result)
94 if (result === scopeView.maybePreviewResult) {
95 openPreview(result,
96- scopeView.maybePreviewIndex,
97- scopeView.maybePreviewResultsModel,
98- scopeView.maybePreviewLimitedCategoryItemCount,
99 scopeView.maybePreviewCategoryId);
100
101 clearMaybePreviewData();
102@@ -400,11 +378,11 @@
103 Connections {
104 target: rendererLoader.item
105 onClicked: { // (int index, var result, var item, var itemModel)
106- scopeView.itemClicked(index, result, itemModel, target.model, categoryItemCount(), baseItem.category);
107+ scopeView.itemClicked(result, baseItem.category);
108 }
109
110 onPressAndHold: { // (int index, var result, var itemModel)
111- scopeView.itemPressedAndHeld(index, result, target.model, categoryItemCount(), baseItem.category);
112+ scopeView.itemPressedAndHeld(result, baseItem.category);
113 }
114
115 function categoryItemCount() {
116@@ -779,13 +757,10 @@
117 property var scope: scopeView.scope
118 property var scopeStyle: scopeView.scopeStyle
119 property int initialIndex: -1
120- property var previewStack;
121- property string categoryId
122- property var model: null
123+ property var previewModel;
124
125 readonly property bool processing: item && item.processing || false
126 readonly property int count: item && item.count || 0
127- readonly property int currentIndex: item && item.currentIndex || 0
128 readonly property var currentItem: item && item.currentItem || null
129
130 property string subPage: ""
131@@ -800,7 +775,7 @@
132 }
133
134 source: switch(subPage) {
135- case "preview": return "PreviewListView.qml";
136+ case "preview": return "PreviewView.qml";
137 case "settings": return "ScopeSettingsPage.qml";
138 default: return "";
139 }
140@@ -810,11 +785,8 @@
141 item.scopeStyle = Qt.binding(function() { return subPageLoader.scopeStyle; } )
142 if (subPage == "preview") {
143 item.open = Qt.binding(function() { return subPageLoader.open; } )
144- item.initialIndex = Qt.binding(function() { return subPageLoader.initialIndex; } )
145- item.model = Qt.binding(function() { return subPageLoader.model; } )
146- item.categoryId = Qt.binding(function() { return subPageLoader.categoryId; } )
147- item.initialIndexPreviewStack = subPageLoader.previewStack;
148- subPageLoader.previewStack = null;
149+ item.previewModel = subPageLoader.previewModel;
150+ subPageLoader.previewModel = null;
151 }
152 open = true;
153 }
154
155=== renamed file 'qml/Dash/PreviewListView.qml' => 'qml/Dash/PreviewView.qml'
156--- qml/Dash/PreviewListView.qml 2015-10-26 08:53:52 +0000
157+++ qml/Dash/PreviewView.qml 2016-02-19 10:15:29 +0000
158@@ -23,20 +23,14 @@
159 Item {
160 id: root
161
162- property int initialIndex: -1
163- property var initialIndexPreviewStack: null
164+ property bool open: false
165 property var scope: null
166 property var scopeStyle: null
167- property string categoryId
168- property bool usedInitialIndex: false
169
170 property alias showSignatureLine: header.showSignatureLine
171
172- property alias open: previewListView.open
173- property alias model: previewListView.model
174- property alias currentIndex: previewListView.currentIndex
175- property alias currentItem: previewListView.currentItem
176- property alias count: previewListView.count
177+ property alias currentItem: previewLoader.item
178+ property var previewModel
179
180 readonly property bool processing: currentItem && (!currentItem.previewModel.loaded
181 || currentItem.previewModel.processingAction)
182@@ -55,73 +49,36 @@
183 onBackClicked: root.backClicked()
184 }
185
186- ListView {
187- id: previewListView
188- objectName: "listView"
189+ onOpenChanged: {
190+ if (!open) {
191+ // Cancel any pending preview requests or actions
192+ if (currentItem && currentItem.previewData !== undefined) {
193+ currentItem.previewData.cancelAction();
194+ }
195+ root.scope.cancelActivation();
196+ }
197+ }
198+
199+ Loader {
200+ id: previewLoader
201+ objectName: "loader"
202 anchors {
203 top: header.bottom
204 bottom: parent.bottom
205 left: parent.left
206 right: parent.right
207 }
208- orientation: ListView.Horizontal
209- highlightRangeMode: ListView.StrictlyEnforceRange
210- snapMode: ListView.SnapOneItem
211- boundsBehavior: Flickable.DragAndOvershootBounds
212- highlightMoveDuration: 250
213- flickDeceleration: units.gu(625)
214- maximumFlickVelocity: width * 5
215- cacheBuffer: 0
216-
217- property bool open: false
218-
219- onOpenChanged: {
220- if (!open) {
221- // Cancel any pending preview requests or actions
222- if (previewListView.currentItem && previewListView.currentItem.previewData !== undefined) {
223- previewListView.currentItem.previewData.cancelAction();
224- }
225- root.scope.cancelActivation();
226- model = undefined;
227- }
228- }
229-
230- onModelChanged: {
231- if (count > 0 && initialIndex >= 0 && !usedInitialIndex) {
232- usedInitialIndex = true;
233- previewListView.positionViewAtIndex(initialIndex, ListView.SnapPosition);
234- }
235- }
236-
237- delegate: Previews.Preview {
238+
239+ sourceComponent: Previews.Preview {
240 id: preview
241- objectName: "preview" + index
242- height: previewListView.height
243- width: previewListView.width
244-
245- isCurrent: ListView.isCurrentItem
246-
247- readonly property var previewStack: {
248- if (root.open) {
249- if (index === root.initialIndex) {
250- return root.initialIndexPreviewStack;
251- } else {
252- return root.scope.preview(result, root.categoryId);
253- }
254- } else {
255- return null;
256- }
257- }
258-
259- previewModel: {
260- if (previewStack) {
261- return previewStack.getPreviewModel(0);
262- } else {
263- return null;
264- }
265- }
266-
267- scopeStyle: root.scopeStyle
268+ objectName: "preview"
269+ height: previewLoader.height
270+ width: previewLoader.width
271+ }
272+
273+ onLoaded: {
274+ item.scopeStyle = Qt.binding(function() { return root.scopeStyle; });
275+ item.previewModel = Qt.binding(function() { return root.previewModel; });
276 }
277 }
278
279
280=== modified file 'qml/Dash/Previews/Preview.qml'
281--- qml/Dash/Previews/Preview.qml 2015-11-26 16:36:41 +0000
282+++ qml/Dash/Previews/Preview.qml 2016-02-19 10:15:29 +0000
283@@ -34,9 +34,6 @@
284 */
285 property var previewModel
286
287- //! \brief Should be set to true if this preview is currently displayed.
288- property bool isCurrent: false
289-
290 //! \brief The ScopeStyle component.
291 property var scopeStyle: null
292
293@@ -88,7 +85,6 @@
294 widgetId: model.widgetId
295 widgetType: model.type
296 widgetData: model.properties
297- isCurrentPreview: root.isCurrent
298 scopeStyle: root.scopeStyle
299 parentFlickable: column
300
301
302=== modified file 'qml/Dash/Previews/PreviewExpandable.qml'
303--- qml/Dash/Previews/PreviewExpandable.qml 2015-09-18 07:43:38 +0000
304+++ qml/Dash/Previews/PreviewExpandable.qml 2016-02-19 10:15:29 +0000
305@@ -84,7 +84,6 @@
306 widgetId: model.widgetId
307 widgetType: model.type
308 widgetData: model.properties
309- isCurrentPreview: root.isCurrentPreview
310 scopeStyle: root.scopeStyle
311 anchors {
312 left: parent.left
313
314=== modified file 'qml/Dash/Previews/PreviewRatingEdit.qml'
315--- qml/Dash/Previews/PreviewRatingEdit.qml 2016-01-20 17:59:53 +0000
316+++ qml/Dash/Previews/PreviewRatingEdit.qml 2016-02-19 10:15:29 +0000
317@@ -68,7 +68,6 @@
318
319 widgetId: root.widgetId
320 widgetData: root.widgetData
321- isCurrentPreview: root.isCurrentPreview
322 scopeStyle: root.scopeStyle
323
324 ratingValue: widgetData["rating"]
325
326=== modified file 'qml/Dash/Previews/PreviewWidget.qml'
327--- qml/Dash/Previews/PreviewWidget.qml 2015-11-26 16:36:41 +0000
328+++ qml/Dash/Previews/PreviewWidget.qml 2016-02-19 10:15:29 +0000
329@@ -19,9 +19,6 @@
330 /*! Interface for preview widgets. */
331
332 Item {
333- //! Specifies the preview widget being currently used or not
334- property bool isCurrentPreview: true
335-
336 //! The widget identifier
337 property string widgetId
338
339
340=== modified file 'qml/Dash/Previews/PreviewWidgetFactory.qml'
341--- qml/Dash/Previews/PreviewWidgetFactory.qml 2015-11-26 16:36:41 +0000
342+++ qml/Dash/Previews/PreviewWidgetFactory.qml 2016-02-19 10:15:29 +0000
343@@ -37,9 +37,6 @@
344 //! Should the widget show in expanded mode (For those that support it)
345 property bool expanded: widgetType !== "expandable" || widgetData["expanded"] === true
346
347- //! Set to true if the parent preview is displayed.
348- property bool isCurrentPreview: false
349-
350 //! Set margins width.
351 property real widgetMargins: status === Loader.Ready ? item.widgetMargins : units.gu(1)
352
353@@ -82,7 +79,6 @@
354 onLoaded: {
355 item.widgetId = Qt.binding(function() { return root.widgetId } )
356 item.widgetData = Qt.binding(function() { return root.widgetData } )
357- item.isCurrentPreview = Qt.binding(function() { return root.isCurrentPreview } )
358 item.expanded = Qt.binding(function() { return root.expanded } )
359 item.scopeStyle = Qt.binding(function() { return root.scopeStyle } )
360 item.parentFlickable = Qt.binding(function() { return root.parentFlickable } )
361
362=== modified file 'qml/Dash/ScopesList.qml'
363--- qml/Dash/ScopesList.qml 2015-10-26 08:53:52 +0000
364+++ qml/Dash/ScopesList.qml 2016-02-19 10:15:29 +0000
365@@ -24,7 +24,7 @@
366 property var scope: null
367
368 // Properties used by parent
369- readonly property bool processing: scope ? scope.searchInProgress : false
370+ readonly property bool processing: scope ? (scope.searchInProgress || scope.activationInProgress) : false
371
372 // Signals
373 signal backClicked()
374
375=== modified file 'tests/mocks/Unity/CMakeLists.txt'
376--- tests/mocks/Unity/CMakeLists.txt 2016-01-13 10:11:40 +0000
377+++ tests/mocks/Unity/CMakeLists.txt 2016-02-19 10:15:29 +0000
378@@ -8,7 +8,7 @@
379 add_subdirectory(Screens)
380
381 pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
382-pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=9)
383+pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=11)
384
385 include_directories(
386 ${CMAKE_CURRENT_BINARY_DIR}
387@@ -28,13 +28,11 @@
388 fake_navigation.cpp
389 fake_resultsmodel.cpp
390 fake_previewmodel.cpp
391- fake_previewstack.cpp
392 fake_previewwidgetmodel.cpp
393 fake_unity_plugin.cpp
394 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/CategoriesInterface.h
395 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/NavigationInterface.h
396 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewModelInterface.h
397- ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewStackInterface.h
398 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewWidgetModelInterface.h
399 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/ResultsModelInterface.h
400 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/ScopeInterface.h
401
402=== removed file 'tests/mocks/Unity/fake_previewstack.cpp'
403--- tests/mocks/Unity/fake_previewstack.cpp 2015-09-14 11:07:25 +0000
404+++ tests/mocks/Unity/fake_previewstack.cpp 1970-01-01 00:00:00 +0000
405@@ -1,68 +0,0 @@
406-/*
407- * Copyright (C) 2014 Canonical, Ltd.
408- *
409- * This program is free software; you can redistribute it and/or modify
410- * it under the terms of the GNU General Public License as published by
411- * the Free Software Foundation; version 3.
412- *
413- * This program is distributed in the hope that it will be useful,
414- * but WITHOUT ANY WARRANTY; without even the implied warranty of
415- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
416- * GNU General Public License for more details.
417- *
418- * You should have received a copy of the GNU General Public License
419- * along with this program. If not, see <http://www.gnu.org/licenses/>.
420- */
421-
422-// self
423-#include "fake_previewstack.h"
424-
425-// local
426-#include "fake_previewmodel.h"
427-#include "fake_scope.h"
428-
429-PreviewStack::PreviewStack(Scope *scope)
430- : unity::shell::scopes::PreviewStackInterface(nullptr)
431-{
432- m_previews << new PreviewModel(this, scope);
433-}
434-
435-PreviewStack::~PreviewStack()
436-{
437-}
438-
439-void PreviewStack::setWidgetColumnCount(int columnCount)
440-{
441- if (columnCount != 1) {
442- qFatal("PreviewStack::setWidgetColumnCount != 1 not implemented");
443- }
444-}
445-
446-int PreviewStack::widgetColumnCount() const
447-{
448- return 1;
449-}
450-
451-int PreviewStack::rowCount(const QModelIndex&) const
452-{
453- return m_previews.size();
454-}
455-
456-unity::shell::scopes::PreviewModelInterface* PreviewStack::getPreviewModel(int index) const
457-{
458- if (index >= m_previews.size()) {
459- return nullptr;
460- }
461-
462- return m_previews.at(index);
463-}
464-
465-QVariant PreviewStack::data(const QModelIndex& index, int role) const
466-{
467- switch (role) {
468- case RolePreviewModel:
469- return QVariant::fromValue(m_previews.at(index.row()));
470- default:
471- return QVariant();
472- }
473-}
474
475=== removed file 'tests/mocks/Unity/fake_previewstack.h'
476--- tests/mocks/Unity/fake_previewstack.h 2015-09-14 11:07:25 +0000
477+++ tests/mocks/Unity/fake_previewstack.h 1970-01-01 00:00:00 +0000
478@@ -1,52 +0,0 @@
479-/*
480- * Copyright (C) 2014 Canonical, Ltd.
481- *
482- * This program is free software; you can redistribute it and/or modify
483- * it under the terms of the GNU General Public License as published by
484- * the Free Software Foundation; version 3.
485- *
486- * This program is distributed in the hope that it will be useful,
487- * but WITHOUT ANY WARRANTY; without even the implied warranty of
488- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
489- * GNU General Public License for more details.
490- *
491- * You should have received a copy of the GNU General Public License
492- * along with this program. If not, see <http://www.gnu.org/licenses/>.
493- */
494-
495-
496-#ifndef FAKE_PREVIEWSTACK_H
497-#define FAKE_PREVIEWSTACK_H
498-
499-#include <unity/shell/scopes/PreviewStackInterface.h>
500-
501-#include <QSharedPointer>
502-#include <QVariantMap>
503-
504-class PreviewModel;
505-
506-class Scope;
507-
508-class PreviewStack : public unity::shell::scopes::PreviewStackInterface
509-{
510- Q_OBJECT
511-
512-public:
513- explicit PreviewStack(Scope* scope = 0);
514- virtual ~PreviewStack();
515-
516- QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
517- int rowCount(const QModelIndex& parent = QModelIndex()) const override;
518-
519- Q_INVOKABLE unity::shell::scopes::PreviewModelInterface* getPreviewModel(int index) const override;
520-
521- void setWidgetColumnCount(int columnCount) override;
522- int widgetColumnCount() const override;
523-
524-private:
525- QList<PreviewModel*> m_previews;
526-};
527-
528-Q_DECLARE_METATYPE(PreviewStack*)
529-
530-#endif // FAKE_PREVIEWSTACK_H
531
532=== modified file 'tests/mocks/Unity/fake_scope.cpp'
533--- tests/mocks/Unity/fake_scope.cpp 2015-10-14 12:46:35 +0000
534+++ tests/mocks/Unity/fake_scope.cpp 2016-02-19 10:15:29 +0000
535@@ -87,6 +87,11 @@
536 return m_searching;
537 }
538
539+bool Scope::activationInProgress() const
540+{
541+ return false;
542+}
543+
544 bool Scope::favorite() const
545 {
546 return m_favorite;
547@@ -194,14 +199,14 @@
548 }
549 }
550
551-PreviewStack* Scope::preview(QVariant const& result, QString const& /*categoryId*/)
552+PreviewModel* Scope::preview(QVariant const& result, QString const& /*categoryId*/)
553 {
554 Q_UNUSED(result);
555
556 if (m_returnNullPreview) {
557 return nullptr;
558 } else {
559- return new PreviewStack(this);
560+ return new PreviewModel(this);
561 }
562 }
563
564
565=== modified file 'tests/mocks/Unity/fake_scope.h'
566--- tests/mocks/Unity/fake_scope.h 2015-10-14 12:46:35 +0000
567+++ tests/mocks/Unity/fake_scope.h 2016-02-19 10:15:29 +0000
568@@ -20,7 +20,7 @@
569 #include <unity/shell/scopes/ScopeInterface.h>
570
571 #include "fake_categories.h"
572-#include "fake_previewstack.h"
573+#include "fake_previewmodel.h"
574
575 #include <QTimer>
576
577@@ -42,6 +42,7 @@
578 QString searchHint() const override;
579 QString shortcut() const override;
580 bool searchInProgress() const override;
581+ bool activationInProgress() const override;
582 bool favorite() const override;
583 unity::shell::scopes::CategoriesInterface* categories() const override;
584 QString searchQuery() const override;
585@@ -61,7 +62,7 @@
586 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits
587
588 Q_INVOKABLE void activate(QVariant const& result, QString const& categoryId) override;
589- Q_INVOKABLE PreviewStack* preview(QVariant const& result, QString const& categoryId) override;
590+ Q_INVOKABLE PreviewModel* preview(QVariant const& result, QString const& categoryId) override;
591 Q_INVOKABLE void cancelActivation() override;
592 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
593
594
595=== modified file 'tests/mocks/Unity/fake_unity_plugin.cpp'
596--- tests/mocks/Unity/fake_unity_plugin.cpp 2014-08-26 12:27:36 +0000
597+++ tests/mocks/Unity/fake_unity_plugin.cpp 2016-02-19 10:15:29 +0000
598@@ -47,10 +47,9 @@
599 qmlRegisterUncreatableType<unity::shell::scopes::SettingsModelInterface>(uri, 0, 2, "SettingsModel", "Can't create SettingsModel object in QML.");
600 qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML.");
601 qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML.");
602- qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance.");
603+ qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from Scope instance.");
604 qmlRegisterUncreatableType<ResultsModel>(uri, 0, 2, "ResultsModel", "Can't create ResultsModel object in QML.");
605 qmlRegisterType<ResultsModel>(uri, 0, 2, "FakeResultsModel");
606 qmlRegisterType<PreviewModel>(uri, 0, 2, "FakePreviewModel");
607 qmlRegisterUncreatableType<PreviewWidgetModel>(uri, 0, 2, "PreviewWidgetModel", "Can't create new PreviewWidgetModel in QML. Get them from PreviewModel instance.");
608- qmlRegisterUncreatableType<PreviewStack>(uri, 0, 2, "PreviewStack", "Can't create new PreviewStack in QML. Get them from Scope instance.");
609 }
610
611=== modified file 'tests/qmltests/CMakeLists.txt'
612--- tests/qmltests/CMakeLists.txt 2016-01-29 11:52:14 +0000
613+++ tests/qmltests/CMakeLists.txt 2016-02-19 10:15:29 +0000
614@@ -29,7 +29,7 @@
615 add_unity8_qmltest(Dash CardTool)
616 add_unity8_qmltest(Dash GenericScopeView)
617 add_unity8_qmltest(Dash DashPageHeader)
618-add_unity8_qmltest(Dash PreviewListView)
619+add_unity8_qmltest(Dash PreviewView)
620 add_unity8_qmltest(Dash/Previews Preview)
621 add_unity8_qmltest(Dash/Previews PreviewActions)
622 add_unity8_qmltest(Dash/Previews PreviewAudioPlayback)
623
624=== renamed file 'tests/qmltests/Dash/tst_PreviewListView.qml' => 'tests/qmltests/Dash/tst_PreviewView.qml'
625--- tests/qmltests/Dash/tst_PreviewListView.qml 2015-08-24 07:45:32 +0000
626+++ tests/qmltests/Dash/tst_PreviewView.qml 2016-02-19 10:15:29 +0000
627@@ -36,8 +36,8 @@
628 id: mockResultsModel
629 }
630
631- PreviewListView {
632- id: listView
633+ PreviewView {
634+ id: view
635 anchors.fill: parent
636 scope: mockScope
637 scopeStyle: ScopeStyle {
638@@ -45,12 +45,23 @@
639 }
640 }
641
642+ Item {
643+ Repeater {
644+ id: repeater
645+ model: mockResultsModel
646+ Item {
647+ property var previewModel: mockScope.preview(model.result, model.categoryId);
648+ }
649+ }
650+ }
651+
652+
653 UT.UnityTestCase {
654 id: testCase
655- name: "PreviewListView"
656+ name: "PreviewView"
657 when: windowShown
658
659- property MouseArea mouseArea: findChild(listView, "processingMouseArea")
660+ property MouseArea mouseArea: findChild(view, "processingMouseArea")
661
662 SignalSpy {
663 id: clickedSpy
664@@ -59,43 +70,41 @@
665 }
666
667 function init() {
668- listView.model = mockResultsModel;
669- listView.currentIndex = 1;
670- listView.open = true;
671+ view.open = true;
672+ view.previewModel = repeater.itemAt(0).previewModel
673 verify(testCase.mouseArea, "Can't find the processingMouseArea object.");
674 }
675
676 function cleanup() {
677- listView.open = false;
678- listView.model = null;
679+ view.open = false;
680 clickedSpy.clear();
681 }
682
683 function test_notProcessing() {
684 expectFail("", "processingMouseArea should not receive the click.");
685- mouseClick(listView);
686+ mouseClick(view);
687 clickedSpy.wait();
688 }
689
690 function test_processing() {
691- verify(listView.currentItem, "currentItem is not ready yet");
692- listView.currentItem.previewModel.setLoaded(false);
693-
694- tryCompare(listView, "processing", true);
695-
696- mouseClick(listView);
697+ verify(view.currentItem, "currentItem is not ready yet");
698+ view.currentItem.previewModel.setLoaded(false);
699+
700+ tryCompare(view, "processing", true);
701+
702+ mouseClick(view);
703 clickedSpy.wait();
704 }
705
706 function test_title() {
707- var header = findChild(listView, "innerPageHeader");
708+ var header = findChild(view, "innerPageHeader");
709 verify(header, "Could not find the preview header");
710
711 compare(header.config.title, "Mock Scope");
712 }
713
714 function test_header_style() {
715- var header = findChild(listView, "pageHeader");
716+ var header = findChild(view, "pageHeader");
717 verify(header, "Could not find the header");
718
719 var innerHeader = findChild(header, "innerPageHeader");

Subscribers

People subscribed via source and target branches