on xenial help sign in
Merge refactor-scopeitem.
commitd3039f63d5e039b285195adbebdd1c1a8d98dfde authorMichał Sawicz <michal.sawicz@canonical.com> dateSun 6 Jul 2014, 00:31 (12 years ago) parentbd64f9777d258e
12 files changed+225−240
qml/Components/BaseCarouselDelegate.qml+16 qml/Components/Carousel.qml+5−14 qml/Dash/CardCarousel.qml+3−3 qml/Dash/Dash.qml+15−12 qml/Dash/DashContent.qml+7−21 qml/Dash/GenericScopeView.qml+22−3 qml/Dash/PreviewListView.qml+3−3 qml/Dash/ScopeItem.qml−71 tests/qmltests/Components/tst_Carousel.qml+61−9 tests/qmltests/Dash/tst_DashContent.qml+2−88 tests/qmltests/Dash/tst_GenericScopeView.qml+90−15 tests/qmltests/tst_Shell.qml+1−1
qml/Components/BaseCarouselDelegate.qml+16
@@ -17,7 +17,23 @@
1717import QtQuick 2.0
1818import Ubuntu.Components 0.1
1919
20+/*!
21+ \brief Base delegate for use with the Carousel component
22+
23+ Use this as the base of your component in a Carousel, the properties
24+ will get updated and signals emitted accordingly.
25+*/
26+
2027Item {
28+ /// True if this item is currently "focused" in the carousel.
2129 property bool explicitlyScaled
30+
31+ /// Model data for this delegate.
2232 property var model
33+
34+ /// Will be emitted when the item is tapped.
35+ signal clicked
36+
37+ /// Will be emitted when the item is long-pressed.
38+ signal pressAndHold
2339}
qml/Components/Carousel.qml+5−14
@@ -52,16 +52,6 @@ Item {
5252 /// exposes the distance to the next row (only one row in carousel, so it's the topMargins)
5353 readonly property alias verticalSpacing: listView.verticalMargin
5454
55− /// Emitted when the user clicked on an item
56− /// @param index is the index of the clicked item
57− /// @param itemY is y of the clicked delegate
58− signal clicked(int index, real itemY)
59−
60− /// Emitted when the user pressed and held on an item
61− /// @param index is the index of the held item
62− /// @param itemY is y of the held delegate
63− signal pressAndHold(int index, real itemY)
64−
6555 implicitHeight: listView.tileHeight * selectedItemScaleFactor
6656 opacity: listView.highlightIndex === -1 ? 1 : 0.6
6757
@@ -167,7 +157,7 @@ Item {
167157 /* We're clicking the selected item and
168158 we're in the neighbourhood of radius 1 pixel from it.
169159 Let's emit the clicked signal. */
170− carousel.clicked(index, delegateItem.y)
160+ delegateItem.clicked()
171161 return
172162 }
173163
@@ -185,7 +175,7 @@ Item {
185175 /* We're pressAndHold the selected item and
186176 we're in the neighbourhood of radius 1 pixel from it.
187177 Let's emit the pressAndHold signal. */
188− carousel.pressAndHold(index, delegateItem.y);
178+ delegateItem.pressAndHold();
189179 return;
190180 }
191181
@@ -316,8 +306,9 @@ Item {
316306 }
317307
318308 onLoaded: {
319− item.explicitlyScaled = Qt.binding(function() { return explicitlyScaled; })
320− item.model = Qt.binding(function() { return model; })
309+ item.objectName = Qt.binding(function() { return "carouselDelegate" + index; });
310+ item.explicitlyScaled = Qt.binding(function() { return explicitlyScaled; });
311+ item.model = Qt.binding(function() { return model; });
321312 }
322313
323314 MouseArea {
qml/Dash/CardCarousel.qml+3−3
@@ -40,9 +40,6 @@ DashRenderer {
4040 cacheBuffer: 1404 // 18px * 13gu * 6
4141 model: cardCarousel.model
4242
43− onClicked: cardCarousel.clicked(index, null)
44− onPressAndHold: cardCarousel.pressAndHold(index)
45−
4643 property real fontScale: 1 / selectedItemScaleFactor
4744 property real headerHeight: cardTool.headerHeight / selectedItemScaleFactor
4845
@@ -53,6 +50,9 @@ DashRenderer {
5350 property var model
5451 enabled: false
5552
53+ function clicked() { cardCarousel.clicked(index, model.result) }
54+ function pressAndHold() { cardCarousel.pressAndHold(index, model.result) }
55+
5656 sourceComponent: cardTool.cardComponent
5757 onLoaded: {
5858 item.objectName = "carouselDelegate" + index;
qml/Dash/Dash.qml+15−12
@@ -26,8 +26,6 @@ Showable {
2626
2727 visible: shown
2828
29− property bool searchable: !dashContent.previewOpen && !scopeItem.previewOpen
30−
3129 property string showScopeOnLoaded: "clickscope"
3230 property real contentScale: 1.0
3331
@@ -103,7 +101,7 @@ Showable {
103101 }
104102 }
105103
106− ScopeItem {
104+ GenericScopeView {
107105 id: scopeItem
108106 anchors.left: dashContent.right
109107 width: parent.width
@@ -111,17 +109,22 @@ Showable {
111109 scale: dash.contentScale
112110 clip: scale != 1.0
113111 visible: scope != null
114− onBack: {
112+ hasBackAction: true
113+ isCurrent: visible
114+ onBackClicked: {
115115 closeOverlayScope();
116− }
117− onGotoScope: {
118− // TODO
119− console.log("gotoScope from an openScope scope is not implemented");
120− }
121− onOpenScope: {
122− // TODO
123− console.log("openScope from an openScope scope is not implemented");
116+ closePreview();
124117 }
125118
119+ Connections {
120+ target: scopeItem.scope
121+ onGotoScope: {
122+ // Note here scopeId is the signal parameter and not the loader property
123+ dashContent.gotoScope(scopeId);
124+ }
125+ onOpenScope: {
126+ dashContent.openScope(scope);
127+ }
128+ }
126129 }
127130}
qml/Dash/DashContent.qml+7−21
@@ -26,11 +26,11 @@ Item {
2626 property var model: null
2727 property var scopes: null
2828 readonly property alias currentIndex: dashContentList.currentIndex
29− property alias previewOpen: previewListView.open
3029
3130 signal scopeLoaded(string scopeId)
3231 signal gotoScope(string scopeId)
3332 signal openScope(var scope)
33+ signal closePreview()
3434
3535 // If we set the current scope index before the scopes have been added,
3636 // then we need to wait until the loaded signals gets emitted from the scopes
@@ -80,23 +80,16 @@ Item {
8080 dashContentList.currentItem.theScope.closeScope(scope)
8181 }
8282
83− function closePreview() {
84− previewListView.open = false;
85− }
86−
8783 Item {
8884 id: dashContentListHolder
8985
90− x: previewListView.open ? -width : 0
91− Behavior on x { UbuntuNumberAnimation { } }
92− width: parent.width
93− height: parent.height
86+ anchors.fill: parent
9487
9588 ListView {
9689 id: dashContentList
9790 objectName: "dashContentList"
9891
99− interactive: dashContent.scopes.loaded && !previewListView.open && currentItem && !currentItem.moving
92+ interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving
10093
10194 anchors.fill: parent
10295 model: dashContent.model
@@ -145,7 +138,6 @@ Item {
145138
146139 onLoaded: {
147140 item.objectName = scope.id
148− item.previewListView = previewListView;
149141 item.scope = Qt.binding(function() { return scope })
150142 item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })
151143 item.title = Qt.binding(function() { return dashContentList.model.get(index).title; })
@@ -161,19 +153,13 @@ Item {
161153 dashContent.openScope(scope);
162154 }
163155 }
156+ Connections {
157+ target: dashContent
158+ onClosePreview: if (item) item.closePreview()
159+ }
164160
165161 Component.onDestruction: active = false
166162 }
167163 }
168164 }
169−
170− PreviewListView {
171− id: previewListView
172− objectName: "dashContentPreviewList"
173− visible: x != width
174− scope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null
175− width: parent.width
176− height: parent.height
177− anchors.left: dashContentListHolder.right
178− }
179165}
qml/Dash/GenericScopeView.qml+22−3
@@ -29,7 +29,6 @@ FocusScope {
2929 property SortFilterProxyModel categories: categoryFilter
3030 property bool isCurrent: false
3131 property alias moving: categoryView.moving
32− property Item previewListView: null
3332 property string title
3433 property bool hasBackAction: false
3534 property bool enableHeightBehaviorOnNextCreation: false
@@ -58,6 +57,10 @@ FocusScope {
5857 categoryView.showHeader()
5958 }
6059
60+ function closePreview() {
61+ previewListView.open = false;
62+ }
63+
6164 Binding {
6265 target: scope
6366 property: "isActive"
@@ -107,7 +110,12 @@ FocusScope {
107110 ScopeListView {
108111 id: categoryView
109112 objectName: "categoryListView"
110− anchors.fill: parent
113+
114+ x: previewListView.open ? -width : 0
115+ Behavior on x { UbuntuNumberAnimation { } }
116+ width: parent.width
117+ height: parent.height
118+
111119 model: scopeView.categories
112120 forceNoClip: previewListView.open
113121
@@ -326,7 +334,7 @@ FocusScope {
326334 title: scopeView.title
327335 showBackButton: scopeView.hasBackAction
328336 searchEntryEnabled: true
329− searchInProgress: scopeView.scope.searchInProgress
337+ searchInProgress: scopeView.scope ? scopeView.scope.searchInProgress : false
330338 foregroundColor: scopeView.foregroundColor
331339 imageSource: scopeView.scope && scopeView.scope.customizations["page-header"] && scopeView.scope.customizations["page-header"]["logo"] || ""
332340
@@ -343,4 +351,15 @@ FocusScope {
343351 onBackClicked: scopeView.backClicked()
344352 }
345353 }
354+
355+ PreviewListView {
356+ id: previewListView
357+ objectName: "previewListView"
358+ visible: x != width
359+ scope: scopeView.scope
360+ width: parent.width
361+ height: parent.height
362+ anchors.left: categoryView.right
363+ }
364+
346365}
qml/Dash/PreviewListView.qml+3−3
@@ -33,9 +33,9 @@ Item {
3333
3434 PageHeader {
3535 id: header
36− objectName: root.objectName + "_pageHeader"
36+ objectName: "pageHeader"
3737 width: parent.width
38− title: scope.name
38+ title: scope ? scope.name : ""
3939 showBackButton: true
4040 searchEntryEnabled: false
4141
@@ -44,7 +44,7 @@ Item {
4444
4545 ListView {
4646 id: previewListView
47− objectName: root.objectName + "_listView"
47+ objectName: "listView"
4848 anchors {
4949 top: header.bottom
5050 bottom: parent.bottom
qml/Dash/ScopeItem.qmldeleted−71
@@ -1,71 +0,0 @@
1−/*
2− * Copyright (C) 2014 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−import Unity 0.2
20−import "../Components"
21−
22−Item {
23− id: root
24−
25− property alias scope: scopeView.scope
26− property alias previewOpen: previewListView.open
27−
28− signal back
29− signal gotoScope(string scopeId)
30− signal openScope(var scope)
31−
32− // TODO see how much code we can share
33− // between here and other Dash parts, it's starting to have
34− // too much duplicated code with the DashDepartments, etc
35−
36− Item {
37− id: scopeViewHolder
38−
39− x: previewListView.open ? -width : 0
40− Behavior on x { UbuntuNumberAnimation { } }
41− width: parent.width
42− height: parent.height
43−
44− GenericScopeView {
45− id: scopeView
46− width: parent.width
47− height: parent.height
48− isCurrent: scope != null
49− title: scope ? scope.name : ""
50− hasBackAction: true
51− previewListView: previewListView
52−
53− onBackClicked: root.back();
54−
55− Connections {
56− target: scopeView.isCurrent ? scope : null
57− onGotoScope: root.gotoScope(scopeId);
58− onOpenScope: root.openScope(scope);
59− }
60− }
61− }
62−
63− PreviewListView {
64− id: previewListView
65− visible: x != width
66− scope: root.scope
67− width: parent.width
68− height: parent.height
69− anchors.left: scopeViewHolder.right
70− }
71−}
tests/qmltests/Components/tst_Carousel.qml+61−9
@@ -27,21 +27,27 @@ Item {
2727 Carousel {
2828 anchors.fill: parent
2929 id: carousel
30− model: 40
3130
3231 property int createdDelegates: 0
3332 property int destroyedDelegates: 0
3433
35− itemComponent: BaseCarouselDelegate {
36− Rectangle {
37− anchors.fill: parent
38− border.color: "black"
39− color: "red"
40− Component.onCompleted: carousel.createdDelegates++
41− Component.onDestruction: carousel.destroyedDelegates++
34+ itemComponent: Component {
35+ BaseCarouselDelegate {
36+ Rectangle {
37+ anchors.fill: parent
38+ border.color: "black"
39+ color: "red"
40+ Component.onCompleted: carousel.createdDelegates++
41+ Component.onDestruction: carousel.destroyedDelegates++
42+ }
4243 }
4344 }
4445 }
46+
47+ SignalSpy {
48+ id: spy
49+ }
50+
4551 UT.UnityTestCase {
4652 id: root
4753 name: "Carousel"
@@ -51,6 +57,8 @@ Item {
5157 property int itemCount
5258 property real tileWidth
5359
60+ property Item listView: findChild(carousel, "listView")
61+
5462 property real contentWidth: itemCount * tileWidth
5563 // following variables are copied from Carousel.qml
5664 // I'm not using the variables directly from there, as then tileWidth and others would be affected as well
@@ -60,11 +68,25 @@ Item {
6068 property real kGapEnd: kMiddleIndex * (1 - gapToEndPhase / gapToMiddlePhase)
6169 property real kXBeginningEnd: 1 / tileWidth + kMiddleIndex / gapToMiddlePhase
6270
71+ function init() {
72+ carousel.model = 40;
73+ waitForRendering(carousel)
74+ listView.positionViewAtBeginning();
75+ }
76+
77+ function cleanup() {
78+ carousel.model = 0;
79+ carousel.createdDelegates = 0;
80+ carousel.destroyedDelegates = 0;
81+ spy.target = null;
82+ spy.signalName = "";
83+ }
84+
6385 // This test needs to run first since it tests a corner case condition
6486 // to where the carousel is just being created
6587 // That is why it has a 1 in the name
6688 function test_1onlyNeededItemsCreated() {
67− tryCompare(carousel, "createdDelegates", 10);
89+ tryCompare(carousel, "createdDelegates", 9);
6890 compare(carousel.destroyedDelegates, 0);
6991 }
7092
@@ -243,5 +265,35 @@ Item {
243265 var x = carouselList.getXFromContinuousIndex(carousel.model - 1);
244266 verify(Math.abs(x - carouselList.contentX) < 1);
245267 }
268+
269+ function test_click() {
270+ var carouselList = findChild(carousel, "listView");
271+ tryCompareFunction(function() { return findChild(carouselList, "carouselDelegate3") ? true : false; }, true);
272+ var carouselItem = findChild(carousel, "carouselDelegate3")
273+ verify(carouselItem, "Could not find delegate");
274+ spy.signalName = "clicked";
275+ spy.target = carouselItem;
276+ mouseClick(carouselItem, carouselItem.width / 2, carouselItem.height / 2);
277+ tryCompare(carouselList, "moving", false);
278+ tryCompare(carouselItem, "explicitlyScaled", true);
279+ mouseClick(carouselItem, carouselItem.width / 2, carouselItem.height / 2);
280+ spy.wait();
281+ }
282+
283+ function test_pressAndHold() {
284+ var carouselList = findChild(carousel, "listView");
285+ tryCompareFunction(function() { return findChild(carouselList, "carouselDelegate3") ? true : false; }, true);
286+ var carouselItem = findChild(carousel, "carouselDelegate3")
287+ verify(carouselItem, "Could not find delegate");
288+ spy.signalName = "pressAndHold";
289+ spy.target = carouselItem;
290+ mouseClick(carouselItem, carouselItem.width / 2, carouselItem.height / 2);
291+ tryCompare(carouselList, "moving", false);
292+ tryCompare(carouselItem, "explicitlyScaled", true);
293+ mousePress(carouselItem, carouselItem.width / 2, carouselItem.height / 2);
294+ spy.wait();
295+ mouseRelease(carouselItem, carouselItem.width / 2, carouselItem.height / 2);
296+ }
297+
246298 }
247299}
tests/qmltests/Dash/tst_DashContent.qml+2−88
@@ -192,7 +192,8 @@ Item {
192192 function test_scope_mapping(data) {
193193 dashContent.setCurrentScopeAtIndex(data.index, true, false);
194194 tryCompareFunction(get_current_item_object_name, data.objectName)
195− var pageHeader = findChild(dashContent, "pageHeader");
195+ var scopeView = findChild(dashContent, data.objectName);
196+ var pageHeader = findChild(scopeView, "pageHeader");
196197 compare(pageHeader.title, scopesModel.getScope(data.index).name);
197198 }
198199
@@ -237,93 +238,6 @@ Item {
237238 tryCompareFunction(checkFlickMovingAndNotInteractive, true);
238239 }
239240
240− function openPreview() {
241− tryCompareFunction(function() {
242− var filterGrid = findChild(dashContent, "0");
243− if (filterGrid != null) {
244− var tile = findChild(filterGrid, "delegate0");
245− return tile != null;
246− }
247− return false;
248− },
249− true);
250− var tile = findChild(findChild(dashContent, "0"), "delegate0");
251− mouseClick(tile, tile.width / 2, tile.height / 2);
252− var previewListView = findChild(dashContent, "dashContentPreviewList");
253− tryCompare(previewListView, "open", true);
254− tryCompare(previewListView, "x", 0);
255− }
256−
257− function closePreview() {
258− var closePreviewMouseArea = findChild(dashContent, "pageHeader");
259− mouseClick(closePreviewMouseArea, units.gu(2), units.gu(2));
260−
261− var previewListView = findChild(dashContent, "dashContentPreviewList");
262− tryCompare(previewListView, "open", false);
263− }
264−
265− function test_previewOpenClose() {
266− var previewListView = findChild(dashContent, "dashContentPreviewList");
267− tryCompare(previewListView, "open", false);
268−
269− var categoryListView = findChild(dashContent, "categoryListView");
270− categoryListView.positionAtBeginning();
271−
272− openPreview();
273− closePreview();
274− }
275−
276− function test_showPreviewCarousel() {
277− tryCompareFunction(function() {
278− var scope = findChild(dashContent, "MockScope1 loader");
279− if (scope != null) {
280− var dashCategory1 = findChild(scope, "dashCategory1");
281− if (dashCategory1 != null) {
282− var tile = findChild(dashCategory1, "carouselDelegate1");
283− return tile != null;
284− }
285− }
286− return false;
287− },
288− true);
289−
290− var previewListView = findChild(dashContent, "dashContentPreviewList");
291− tryCompare(previewListView, "open", false);
292−
293− var scope = findChild(dashContent, "MockScope1 loader");
294− var dashCategory1 = findChild(scope, "dashCategory1");
295− var tile = findChild(dashCategory1, "carouselDelegate1");
296− mouseClick(tile, tile.width / 2, tile.height / 2);
297− tryCompare(previewListView, "open", true);
298− tryCompare(previewListView, "x", 0);
299−
300− closePreview();
301− }
302−
303− function test_previewCycle() {
304− var categoryListView = findChild(dashContent, "categoryListView");
305− categoryListView.positionAtBeginning();
306−
307− var previewListView = findChild(dashContent, "dashContentPreviewList");
308− tryCompare(previewListView, "open", false);
309− var previewListViewList = findChild(dashContent, "dashContentPreviewList_listView");
310−
311− openPreview();
312−
313− // flick to the next previews
314− tryCompare(previewListView, "count", 15);
315− for (var i = 1; i < previewListView.count; ++i) {
316− mouseFlick(previewListView, previewListView.width - units.gu(1),
317− previewListView.height / 2,
318− units.gu(2),
319− previewListView.height / 2);
320− tryCompare(previewListViewList, "moving", false);
321− tryCompare(previewListView.currentItem, "objectName", "previewItem" + i);
322−
323− }
324− closePreview();
325− }
326−
327241 function test_carouselAspectRatio() {
328242 tryCompareFunction(function() {
329243 var scope = findChild(dashContent, "MockScope1 loader");
tests/qmltests/Dash/tst_GenericScopeView.qml+90−15
@@ -44,16 +44,17 @@ Item {
4444 signal mainStageFocusedApplicationChanged()
4545 }
4646
47−
4847 GenericScopeView {
4948 id: genericScopeView
5049 anchors.fill: parent
51− previewListView: previewListView
5250
5351 UT.UnityTestCase {
52+ id: testCase
5453 name: "GenericScopeView"
5554 when: scopes.loaded && windowShown
5655
56+ property Item previewListView: findChild(genericScopeView, "previewListView")
57+
5758 function init() {
5859 genericScopeView.scope = scopes.getScope(2)
5960 shell.width = units.gu(120)
@@ -65,24 +66,24 @@ Item {
6566 tryCompare(genericScopeView.scope, "isActive", false)
6667 genericScopeView.isCurrent = true
6768 tryCompare(genericScopeView.scope, "isActive", true)
68− previewListView.open = true
69+ testCase.previewListView.open = true
6970 tryCompare(genericScopeView.scope, "isActive", false)
70− previewListView.open = false
71+ testCase.previewListView.open = false
7172 tryCompare(genericScopeView.scope, "isActive", true)
7273 genericScopeView.isCurrent = false
7374 tryCompare(genericScopeView.scope, "isActive", false)
7475 }
7576
7677 function test_showDash() {
77− previewListView.open = true;
78+ testCase.previewListView.open = true;
7879 scopes.getScope(2).showDash();
79− tryCompare(previewListView, "open", false);
80+ tryCompare(testCase.previewListView, "open", false);
8081 }
8182
8283 function test_hideDash() {
83− previewListView.open = true;
84+ testCase.previewListView.open = true;
8485 scopes.getScope(2).hideDash();
85− tryCompare(previewListView, "open", false);
86+ tryCompare(testCase.previewListView, "open", false);
8687 }
8788
8889 function test_searchQuery() {
@@ -176,20 +177,94 @@ Item {
176177 tryCompare(category, "filtered", true);
177178 }
178179
180+ function openPreview() {
181+ tryCompareFunction(function() {
182+ var filterGrid = findChild(genericScopeView, "0");
183+ if (filterGrid != null) {
184+ var tile = findChild(filterGrid, "delegate0");
185+ return tile != null;
186+ }
187+ return false;
188+ },
189+ true);
190+ var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
191+ mouseClick(tile, tile.width / 2, tile.height / 2);
192+ tryCompare(testCase.previewListView, "open", true);
193+ tryCompare(testCase.previewListView, "x", 0);
194+ }
195+
196+ function closePreview() {
197+ var closePreviewMouseArea = findChild(genericScopeView, "pageHeader");
198+ mouseClick(closePreviewMouseArea, units.gu(2), units.gu(2));
199+
200+ tryCompare(testCase.previewListView, "open", false);
201+ }
202+
203+ function test_previewOpenClose() {
204+ tryCompare(testCase.previewListView, "open", false);
205+
206+ var categoryListView = findChild(genericScopeView, "categoryListView");
207+ categoryListView.positionAtBeginning();
208+
209+ openPreview();
210+ closePreview();
211+ }
212+
213+ function test_showPreviewCarousel() {
214+ tryCompareFunction(function() {
215+ var dashCategory1 = findChild(genericScopeView, "dashCategory1");
216+ if (dashCategory1 != null) {
217+ var tile = findChild(dashCategory1, "carouselDelegate1");
218+ return tile != null;
219+ }
220+ return false;
221+ },
222+ true);
223+
224+ tryCompare(testCase.previewListView, "open", false);
225+
226+ var dashCategory1 = findChild(genericScopeView, "dashCategory1");
227+ var tile = findChild(dashCategory1, "carouselDelegate1");
228+ mouseClick(tile, tile.width / 2, tile.height / 2);
229+ tryCompare(tile, "explicitlyScaled", true);
230+ mouseClick(tile, tile.width / 2, tile.height / 2);
231+ tryCompare(testCase.previewListView, "open", true);
232+ tryCompare(testCase.previewListView, "x", 0);
233+
234+ closePreview();
235+ }
236+
237+ function test_previewCycle() {
238+ var categoryListView = findChild(genericScopeView, "categoryListView");
239+ categoryListView.positionAtBeginning();
240+
241+ tryCompare(testCase.previewListView, "open", false);
242+ var previewListViewList = findChild(previewListView, "listView");
243+
244+ openPreview();
245+
246+ // flick to the next previews
247+ tryCompare(testCase.previewListView, "count", 15);
248+ for (var i = 1; i < testCase.previewListView.count; ++i) {
249+ mouseFlick(testCase.previewListView, testCase.previewListView.width - units.gu(1),
250+ testCase.previewListView.height / 2,
251+ units.gu(2),
252+ testCase.previewListView.height / 2);
253+ tryCompare(previewListViewList, "moving", false);
254+ tryCompare(testCase.previewListView.currentItem, "objectName", "previewItem" + i);
255+
256+ }
257+ closePreview();
258+ }
259+
179260 function test_haeder_logo() {
180261 genericScopeView.scope = scopes.getScope(3);
181262
182263 var image = findChild(genericScopeView, "titleImage");
183264 verify(image, "Could not find the title image");
184265 compare(image.source, Qt.resolvedUrl("../Components/tst_PageHeader/logo-ubuntu-orange.svg"), "Title image has the wrong source");
266+
185267 }
186268 }
187269 }
188−
189− PreviewListView {
190− id: previewListView
191− anchors.fill: parent
192− visible: false
193− scope: genericScopeView.scope
194− }
195270}
tests/qmltests/tst_Shell.qml+1−1
@@ -104,7 +104,7 @@ Item {
104104 killApps(ApplicationManager);
105105
106106 var dashContent = findChild(shell, "dashContent");
107− dashContent.previewOpen = false;
107+ dashContent.closePreview();
108108
109109 var dashHome = findChild(shell, "clickscope loader");
110110 swipeUntilScopeViewIsReached(dashHome);