Merge lp:~saviq/unity8/drop-filtergrid into lp:unity8

Proposed by Michał Sawicz
Status: Superseded
Proposed branch: lp:~saviq/unity8/drop-filtergrid
Merge into: lp:unity8
Diff against target: 855 lines (+112/-432)
15 files modified
.project (+1/-1)
.pydevproject (+1/-1)
qml/Components/FilterGrid.qml (+0/-124)
qml/Components/ResponsiveGridView.qml (+1/-1)
qml/Dash/CardCarousel.qml (+2/-1)
qml/Dash/CardGrid.qml (+21/-23)
qml/Dash/CardVerticalJournal.qml (+2/-21)
qml/Dash/DashRenderer.qml (+3/-12)
qml/Dash/GenericScopeView.qml (+52/-27)
tests/autopilot/unity8/shell/emulators/dash.py (+6/-3)
tests/autopilot/unity8/shell/tests/test_emulators.py (+5/-5)
tests/plugins/Dash/cardcreator/6.res (+1/-0)
tests/qmltests/CMakeLists.txt (+0/-1)
tests/qmltests/Components/tst_FilterGrid.qml (+0/-190)
tests/qmltests/Dash/tst_GenericScopeView.qml (+17/-22)
To merge this branch: bzr merge lp:~saviq/unity8/drop-filtergrid
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Leo Arias Pending
Albert Astals Cid Pending
Unity Team Pending
Review via email: mp+226336@code.launchpad.net

This proposal has been superseded by a proposal from 2014-07-11.

Commit message

Drop FilterGrid and refactor height animations in GenericScopeView.

Also implement forced category expansion.

Description of the change

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

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

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

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

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

To post a comment you must log in.
lp:~saviq/unity8/drop-filtergrid updated
1047. By Michał Sawicz

Merge lp:~saviq/unity8/cmake-pydev-fixes.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~saviq/unity8/drop-filtergrid updated
1048. By Michał Sawicz

Add tests for auto and forced expansion.

1049. By Michał Sawicz

Fix DashContent tests.

1050. By Michał Sawicz

Reduce cacheBuffer in CardGrid

1051. By Michał Sawicz

Drop unnecessary properties in CardCarousel

1052. By Michał Sawicz

Merge trunk.

1053. By Michał Sawicz

Improve test_set_current_scope_reset reliability.

1054. By Michał Sawicz

Merge cmake-pydev-fixes

1055. By Michał Sawicz

Pixel-align ScopesListView to avoid visual artifacts at card boundary.

1056. By Michał Sawicz

Fix autopilot test.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed file 'tests/autopilot/.project' => '.project'
2--- tests/autopilot/.project 2013-11-18 12:05:58 +0000
3+++ .project 2014-07-11 07:35:07 +0000
4@@ -1,6 +1,6 @@
5 <?xml version="1.0" encoding="UTF-8"?>
6 <projectDescription>
7- <name>Unity8 Autopilot</name>
8+ <name>Unity8</name>
9 <comment></comment>
10 <projects>
11 </projects>
12
13=== renamed file 'tests/autopilot/.pydevproject' => '.pydevproject'
14--- tests/autopilot/.pydevproject 2013-11-18 12:05:58 +0000
15+++ .pydevproject 2014-07-11 07:35:07 +0000
16@@ -1,7 +1,7 @@
17 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
18 <?eclipse-pydev version="1.0"?><pydev_project>
19 <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
20-<path>/Unity8 Autopilot</path>
21+<path>/Unity8/tests/autopilot</path>
22 </pydev_pathproperty>
23 <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
24 <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
25
26=== removed file 'qml/Components/FilterGrid.qml'
27--- qml/Components/FilterGrid.qml 2014-05-23 13:52:36 +0000
28+++ qml/Components/FilterGrid.qml 1970-01-01 00:00:00 +0000
29@@ -1,124 +0,0 @@
30-/*
31- * Copyright (C) 2013 Canonical, Ltd.
32- *
33- * This program is free software; you can redistribute it and/or modify
34- * it under the terms of the GNU General Public License as published by
35- * the Free Software Foundation; version 3.
36- *
37- * This program is distributed in the hope that it will be useful,
38- * but WITHOUT ANY WARRANTY; without even the implied warranty of
39- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40- * GNU General Public License for more details.
41- *
42- * You should have received a copy of the GNU General Public License
43- * along with this program. If not, see <http://www.gnu.org/licenses/>.
44- */
45-
46-import QtQuick 2.0
47-import Ubuntu.Components 0.1
48-import Utils 0.1
49-import "../Components"
50-
51-/*
52- A ResponsiveGridView that can optionally have the number of rows being displayed
53- reduced to collapsedRowCount, in which case a button saying "View all (123)"
54- will be shown at the bottom. If clicked, FilterGrid will them expand vertically
55- to display all rows.
56- */
57-Item {
58- id: root
59-
60- /* Whether, when collapsed, a button should be displayed enabling the user to expand
61- the grid to its full size. */
62- readonly property bool expandable: model.count > rowsWhenCollapsed * iconTileGrid.columns
63-
64- property var model: null
65-
66- /* Maximum number of rows to be show when filter=true. */
67- property int collapsedRowCount: 2
68- property int uncollapsedRowCount: Math.ceil(model.count / columns)
69- /* Never show more rows than model would fill up. */
70- readonly property int rowsWhenCollapsed: Math.min(collapsedRowCount, uncollapsedRowCount)
71- readonly property int collapsedHeight: iconTileGrid.contentHeightForRows(rowsWhenCollapsed)
72- readonly property int uncollapsedHeight: iconTileGrid.contentHeightForRows(uncollapsedRowCount)
73-
74- property alias minimumHorizontalSpacing: iconTileGrid.minimumHorizontalSpacing
75- property alias maximumNumberOfColumns: iconTileGrid.maximumNumberOfColumns
76- property alias columns: iconTileGrid.columns
77- property alias delegateWidth: iconTileGrid.delegateWidth
78- property alias delegateHeight: iconTileGrid.delegateHeight
79- property alias verticalSpacing: iconTileGrid.verticalSpacing
80- readonly property alias margins: iconTileGrid.margins
81- property alias delegate: iconTileGrid.delegate
82- property alias cellWidth: iconTileGrid.cellWidth
83- property alias cellHeight: iconTileGrid.cellHeight
84- property alias displayMarginBeginning: iconTileGrid.displayMarginBeginning
85- property alias displayMarginEnd: iconTileGrid.displayMarginEnd
86- readonly property alias originY: iconTileGrid.originY
87- readonly property alias flicking: iconTileGrid.flicking
88- readonly property alias moving: iconTileGrid.moving
89- readonly property alias pressDelay: iconTileGrid.pressDelay
90- property alias highlightIndex: iconTileGrid.highlightIndex
91- readonly property alias currentItem: iconTileGrid.currentItem
92- readonly property alias filtered: d.filter
93-
94- QtObject {
95- id: d
96- // We do have filter and collapsed properties because we need to decouple
97- // the real filtering with the animation since the closing animation
98- // i.e. setFilter(false. true) we still need to not be filtering until
99- // the animation finishes otherwise we hide the items when the animation
100- // is still running
101- property bool filter: true
102- property bool collapsed: true
103- }
104-
105- height: d.collapsed ? root.collapsedHeight : root.uncollapsedHeight
106- clip: filterAnimation.running
107-
108- Behavior on height {
109- id: heightBehaviour
110- enabled: false
111- NumberAnimation {
112- id: filterAnimation
113- // Duration and easing here match the ListViewWithPageHeader::m_contentYAnimation
114- // otherwise since both animations can run at the same time you'll get
115- // some visual weirdness.
116- duration: 200
117- easing.type: Easing.InOutQuad
118- onRunningChanged: {
119- if (!running) {
120- d.filter = d.collapsed;
121- }
122- heightBehaviour.enabled = false;
123- }
124- }
125- }
126-
127- function setFilter(filter, animate) {
128- heightBehaviour.enabled = animate;
129- d.collapsed = filter;
130- if (!animate || !filter) {
131- d.filter = filter;
132- }
133- }
134-
135- ResponsiveGridView {
136- id: iconTileGrid
137-
138- anchors { left: parent.left; right: parent.right }
139- height: totalContentHeight
140- interactive: false
141-
142- minimumHorizontalSpacing: units.gu(0.5)
143- maximumNumberOfColumns: 6
144- delegateWidth: units.gu(11)
145- delegateHeight: units.gu(9.5)
146- verticalSpacing: units.gu(2)
147-
148- model: LimitProxyModel {
149- model: root.model
150- limit: d.filter ? rowsWhenCollapsed * iconTileGrid.columns : -1
151- }
152- }
153-}
154
155=== modified file 'qml/Components/ResponsiveGridView.qml'
156--- qml/Components/ResponsiveGridView.qml 2014-05-15 14:50:23 +0000
157+++ qml/Components/ResponsiveGridView.qml 2014-07-11 07:35:07 +0000
158@@ -47,7 +47,7 @@
159 readonly property alias currentItem: gridView.currentItem
160
161 function contentHeightForRows(rows) {
162- return rows * cellHeight + verticalSpacing
163+ return rows * cellHeight;
164 }
165
166 GridView {
167
168=== modified file 'qml/Dash/CardCarousel.qml'
169--- qml/Dash/CardCarousel.qml 2014-07-09 19:44:02 +0000
170+++ qml/Dash/CardCarousel.qml 2014-07-11 07:35:07 +0000
171@@ -27,7 +27,8 @@
172 property alias selectedItemScaleFactor: carousel.selectedItemScaleFactor
173 property alias tileAspectRatio: carousel.tileAspectRatio
174
175- height: carousel.implicitHeight + units.gu(6)
176+ expandedHeight: carousel.implicitHeight + units.gu(6)
177+ collapsedHeight: expandedHeight
178
179 Carousel {
180 id: carousel
181
182=== renamed file 'qml/Dash/CardFilterGrid.qml' => 'qml/Dash/CardGrid.qml'
183--- qml/Dash/CardFilterGrid.qml 2014-07-08 08:30:46 +0000
184+++ qml/Dash/CardGrid.qml 2014-07-11 07:35:07 +0000
185@@ -18,33 +18,31 @@
186 import "../Components"
187
188 DashRenderer {
189- id: genericFilterGrid
190-
191- expandable: filterGrid.expandable
192- collapsedHeight: filterGrid.collapsedHeight
193- uncollapsedHeight: filterGrid.uncollapsedHeight
194- originY: filterGrid.originY
195- height: filterGrid.height
196- filtered: filterGrid.filtered
197-
198- function setFilter(filter, animate) {
199- filterGrid.setFilter(filter, animate)
200+ id: root
201+
202+ readonly property int collapsedRows: {
203+ if (!cardTool || !cardTool.template || typeof cardTool.template["collapsed-rows"] != "number") return 2;
204+ return cardTool.template["collapsed-rows"];
205 }
206
207- FilterGrid {
208- id: filterGrid
209- width: genericFilterGrid.width
210+ expandedHeight: grid.totalContentHeight
211+ collapsedHeight: Math.min(grid.contentHeightForRows(collapsedRows), expandedHeight)
212+ originY: grid.originY
213+
214+ ResponsiveGridView {
215+ id: grid
216+ anchors.fill: parent
217 minimumHorizontalSpacing: units.gu(1)
218 delegateWidth: cardTool.cardWidth
219 delegateHeight: cardTool.cardHeight
220 verticalSpacing: units.gu(1)
221- model: genericFilterGrid.model
222- collapsedRowCount: Math.min(2, cardTool && cardTool.template && cardTool.template["collapsed-rows"] || 2)
223- displayMarginBeginning: genericFilterGrid.displayMarginBeginning
224- displayMarginEnd: genericFilterGrid.displayMarginEnd
225+ model: root.model
226+ displayMarginBeginning: root.displayMarginBeginning
227+ displayMarginEnd: root.displayMarginEnd
228+ interactive: false
229 delegate: Item {
230- width: filterGrid.cellWidth
231- height: filterGrid.cellHeight
232+ width: grid.cellWidth
233+ height: grid.cellHeight
234 Loader {
235 id: loader
236 sourceComponent: cardTool.cardComponent
237@@ -58,12 +56,12 @@
238 item.template = Qt.binding(function() { return cardTool.template; });
239 item.components = Qt.binding(function() { return cardTool.components; });
240 item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
241- item.scopeStyle = genericFilterGrid.scopeStyle;
242+ item.scopeStyle = root.scopeStyle;
243 }
244 Connections {
245 target: loader.item
246- onClicked: genericFilterGrid.clicked(index, result)
247- onPressAndHold: genericFilterGrid.pressAndHold(index)
248+ onClicked: root.clicked(index, result)
249+ onPressAndHold: root.pressAndHold(index)
250 }
251 }
252 }
253
254=== modified file 'qml/Dash/CardVerticalJournal.qml'
255--- qml/Dash/CardVerticalJournal.qml 2014-07-09 19:44:02 +0000
256+++ qml/Dash/CardVerticalJournal.qml 2014-07-11 07:35:07 +0000
257@@ -23,33 +23,14 @@
258
259 readonly property double collapseLimit: units.gu(35)
260
261- uncollapsedHeight: cardVerticalJournal.implicitHeight
262- collapsedHeight: Math.min(collapseLimit, cardVerticalJournal.implicitHeight)
263- expandable: uncollapsedHeight > collapseLimit
264+ expandedHeight: Math.max(cardVerticalJournal.implicitHeight, minHeight)
265+ collapsedHeight: Math.max(Math.min(collapseLimit, cardVerticalJournal.implicitHeight), minHeight)
266
267 // This minHeight is used as bootstrapper for the height. Vertical Journal
268 // is special by the fact that it doesn't know how to calculate its implicit height unless we give it
269 // enough height that it can start creating its children so we make sure it has enough height for that
270 // in case the model is non empty
271 readonly property double minHeight: root.model.count >= 1 ? cardVerticalJournal.rowSpacing + 1 : 0
272- height: filtered ? Math.max(collapsedHeight, minHeight) : uncollapsedHeight
273-
274- Behavior on height {
275- id: heightBehaviour
276- enabled: false
277- animation: UbuntuNumberAnimation {
278- onRunningChanged: {
279- if (!running) {
280- heightBehaviour.enabled = false
281- }
282- }
283- }
284- }
285-
286- function setFilter(filter, animate) {
287- heightBehaviour.enabled = animate;
288- filtered = filter;
289- }
290
291 ResponsiveVerticalJournal {
292 id: cardVerticalJournal
293
294=== modified file 'qml/Dash/DashRenderer.qml'
295--- qml/Dash/DashRenderer.qml 2014-07-08 08:30:46 +0000
296+++ qml/Dash/DashRenderer.qml 2014-07-11 07:35:07 +0000
297@@ -17,15 +17,9 @@
298 import QtQuick 2.0
299
300 Item {
301- // Can the item be expanded?
302- property bool expandable: false
303-
304- // In case it can be expanded, is it filtered
305- property bool filtered: true
306-
307- property int collapsedHeight: height
308-
309- property int uncollapsedHeight: height
310+ property int collapsedHeight
311+
312+ property int expandedHeight
313
314 property int displayMarginBeginning: 0
315
316@@ -50,7 +44,4 @@
317 /// Emitted when the user pressed and held on an item
318 /// @param index is the index of the held item
319 signal pressAndHold(int index)
320-
321- function setFilter(filter, animate) {
322- }
323 }
324
325=== modified file 'qml/Dash/GenericScopeView.qml'
326--- qml/Dash/GenericScopeView.qml 2014-07-09 19:44:02 +0000
327+++ qml/Dash/GenericScopeView.qml 2014-07-11 07:35:07 +0000
328@@ -128,11 +128,21 @@
329 highlightWhenPressed: false
330 showDivider: false
331
332- readonly property bool expandable: rendererLoader.item ? rendererLoader.item.expandable : false
333- readonly property bool filtered: rendererLoader.item ? rendererLoader.item.filtered : true
334+ readonly property bool expandable: {
335+ if (categoryView.model.count === 1) return false;
336+ if (cardTool.template && cardTool.template["collapsed-rows"] === 0) return false;
337+ if (item && item.expandedHeight > item.collapsedHeight) return true;
338+ return false;
339+ }
340+ property bool expanded: false
341 readonly property string category: categoryId
342 readonly property var item: rendererLoader.item
343
344+ function expand(expand, animate) {
345+ heightBehaviour.enabled = animate;
346+ expanded = expand;
347+ }
348+
349 CardTool {
350 id: cardTool
351 objectName: "cardTool"
352@@ -142,6 +152,18 @@
353 viewWidth: parent.width
354 }
355
356+ onExpandableChanged: {
357+ // This can happen with the VJ that doesn't know how height it will be on creation
358+ // so doesn't set expandable until a bit too late for onLoaded
359+ if (expandable) {
360+ var shouldExpand = baseItem.category === categoryView.expandedCategoryId;
361+ baseItem.expand(shouldExpand, false /*animate*/);
362+ }
363+ }
364+
365+ onHeightChanged: rendererLoader.updateDelegateCreationRange();
366+ onYChanged: rendererLoader.updateDelegateCreationRange();
367+
368 Loader {
369 id: rendererLoader
370 anchors {
371@@ -151,13 +173,27 @@
372 topMargin: hasSectionHeader ? 0 : units.gu(2)
373 }
374
375+ Behavior on height {
376+ id: heightBehaviour
377+ enabled: false
378+ animation: UbuntuNumberAnimation {
379+ onRunningChanged: {
380+ if (!running) {
381+ heightBehaviour.enabled = false
382+ }
383+ }
384+ }
385+ }
386+
387+ height: baseItem.expandable && !baseItem.expanded ? item.collapsedHeight : item.expandedHeight
388+
389 source: {
390 switch (cardTool.categoryLayout) {
391 case "carousel": return "CardCarousel.qml";
392 case "vertical-journal": return "CardVerticalJournal.qml";
393 case "running-apps": return "Apps/RunningApplicationsGrid.qml";
394 case "grid":
395- default: return "CardFilterGrid.qml";
396+ default: return "CardGrid.qml";
397 }
398 }
399
400@@ -176,9 +212,9 @@
401 }
402 item.objectName = Qt.binding(function() { return categoryId })
403 item.scopeStyle = scopeView.scopeStyle;
404- if (item.expandable) {
405- var shouldFilter = categoryId != categoryView.expandedCategoryId;
406- item.setFilter(shouldFilter, false /*animate*/);
407+ if (baseItem.expandable) {
408+ var shouldExpand = categoryId === categoryView.expandedCategoryId;
409+ baseItem.expand(shouldExpand, false /*animate*/);
410 }
411 updateDelegateCreationRange();
412 item.cardTool = cardTool;
413@@ -211,14 +247,6 @@
414 previewListView.currentIndex = index;
415 previewListView.open = true
416 }
417- onExpandableChanged: {
418- // This can happen with the VJ that doesn't know how height it will be on creation
419- // so doesn't set expandable until a bit too late for onLoaded
420- if (rendererLoader.item.expandable) {
421- var shouldFilter = baseItem.category != categoryView.expandedCategoryId;
422- rendererLoader.item.setFilter(shouldFilter, false /*animate*/);
423- }
424- }
425 }
426 Connections {
427 target: categoryView
428@@ -227,17 +255,17 @@
429 }
430 function collapseAllButExpandedCategory() {
431 var item = rendererLoader.item;
432- if (item.expandable) {
433- var shouldFilter = categoryId != categoryView.expandedCategoryId;
434- if (shouldFilter != item.filter) {
435+ if (baseItem.expandable) {
436+ var shouldExpand = categoryId === categoryView.expandedCategoryId;
437+ if (shouldExpand != baseItem.expanded) {
438 // If the filter animation will be seen start it, otherwise, just flip the switch
439- var shrinkingVisible = shouldFilter && y + item.collapsedHeight < categoryView.height;
440- var growingVisible = !shouldFilter && y + height < categoryView.height;
441- if (!previewListView.open || !shouldFilter) {
442+ var shrinkingVisible = !shouldExpand && y + item.collapsedHeight < categoryView.height;
443+ var growingVisible = shouldExpand && y + height < categoryView.height;
444+ if (!previewListView.open || shouldExpand) {
445 var animate = shrinkingVisible || growingVisible;
446- item.setFilter(shouldFilter, animate)
447- if (!shouldFilter && !previewListView.open) {
448- categoryView.maximizeVisibleArea(index, item.uncollapsedHeight);
449+ baseItem.expand(shouldExpand, animate)
450+ if (shouldExpand && !previewListView.open) {
451+ categoryView.maximizeVisibleArea(index, item.expandedHeight);
452 }
453 }
454 }
455@@ -304,9 +332,6 @@
456 z: -1
457 }
458 }
459-
460- onHeightChanged: rendererLoader.updateDelegateCreationRange();
461- onYChanged: rendererLoader.updateDelegateCreationRange();
462 }
463
464 sectionProperty: "name"
465@@ -318,7 +343,7 @@
466 textColor: scopeStyle ? scopeStyle.foreground : "grey"
467 image: {
468 if (delegate && delegate.expandable)
469- return delegate.filtered ? "graphics/header_handlearrow.png" : "graphics/header_handlearrow2.png"
470+ return delegate.expanded ? "graphics/header_handlearrow2.png" : "graphics/header_handlearrow.png"
471 return "";
472 }
473 onClicked: {
474
475=== modified file 'tests/autopilot/unity8/shell/emulators/dash.py'
476--- tests/autopilot/unity8/shell/emulators/dash.py 2014-07-09 18:31:52 +0000
477+++ tests/autopilot/unity8/shell/emulators/dash.py 2014-07-11 07:35:07 +0000
478@@ -40,7 +40,7 @@
479
480 def get_applications_grid(self):
481 get_grid = self.get_scope('clickscope').wait_select_single(
482- 'CardFilterGrid', objectName='local')
483+ 'CardGrid', objectName='local')
484 return get_grid
485
486 def get_application_icon(self, text):
487@@ -196,9 +196,12 @@
488 category_element = self._get_category_element(category)
489 application_cards = category_element.select_many('AbstractButton')
490
491- # sort by y, x
492+ # sort by y, x, filter those out of view
493+ categoryBottom = category_element.globalRect.y \
494+ + category_element.height
495 application_cards = sorted(
496- application_cards,
497+ (card for card in application_cards
498+ if card.globalRect.y < categoryBottom),
499 key=lambda card: (card.globalRect.y, card.globalRect.x))
500
501 result = []
502
503=== modified file 'tests/autopilot/unity8/shell/tests/test_emulators.py'
504--- tests/autopilot/unity8/shell/tests/test_emulators.py 2014-07-09 13:16:20 +0000
505+++ tests/autopilot/unity8/shell/tests/test_emulators.py 2014-07-11 07:35:07 +0000
506@@ -191,9 +191,9 @@
507 def _get_number_of_application_slots(self, category):
508 category_element = self.applications_scope._get_category_element(
509 category)
510- grid = category_element.select_single('CardFilterGrid')
511- filtergrid = grid.select_single('FilterGrid')
512- if (grid.filtered):
513- return filtergrid.collapsedRowCount * filtergrid.columns
514+ cardgrid = category_element.select_single('CardGrid')
515+ if (category_element.expanded):
516+ return cardgrid.select_single('QQuickGridView').count
517 else:
518- return filtergrid.uncollapsedRowCount * filtergrid.columns
519+ return cardgrid.collapsedRows \
520+ * cardgrid.select_single('ResponsiveGridView').columns
521
522=== modified file 'tests/plugins/Dash/cardcreator/6.res'
523--- tests/plugins/Dash/cardcreator/6.res 2014-07-08 09:50:44 +0000
524+++ tests/plugins/Dash/cardcreator/6.res 2014-07-11 07:35:07 +0000
525@@ -5,6 +5,7 @@
526 property var cardData;
527 property var artShapeBorderSource: undefined;
528 property real fontScale: 1.0;
529+ property var scopeStyle: null;
530 property int headerAlignment: Text.AlignLeft;
531 property int fixedHeaderHeight: -1;
532 property size fixedArtShapeSize: Qt.size(-1, -1);
533
534=== modified file 'tests/qmltests/CMakeLists.txt'
535--- tests/qmltests/CMakeLists.txt 2014-07-09 19:44:14 +0000
536+++ tests/qmltests/CMakeLists.txt 2014-07-11 07:35:07 +0000
537@@ -24,7 +24,6 @@
538 add_qml_test(Components Carousel)
539 add_qml_test(Components DraggingArea)
540 add_qml_test(Components EdgeDemoOverlay)
541-add_qml_test(Components FilterGrid)
542 add_qml_test(Components LazyImage)
543 add_qml_test(Components Rating)
544 add_qml_test(Components ResponsiveFlowView)
545
546=== removed file 'tests/qmltests/Components/tst_FilterGrid.qml'
547--- tests/qmltests/Components/tst_FilterGrid.qml 2014-05-01 14:25:18 +0000
548+++ tests/qmltests/Components/tst_FilterGrid.qml 1970-01-01 00:00:00 +0000
549@@ -1,190 +0,0 @@
550-/*
551- * Copyright 2013 Canonical Ltd.
552- *
553- * This program is free software; you can redistribute it and/or modify
554- * it under the terms of the GNU General Public License as published by
555- * the Free Software Foundation; version 3.
556- *
557- * This program is distributed in the hope that it will be useful,
558- * but WITHOUT ANY WARRANTY; without even the implied warranty of
559- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
560- * GNU General Public License for more details.
561- *
562- * You should have received a copy of the GNU General Public License
563- * along with this program. If not, see <http://www.gnu.org/licenses/>.
564- */
565-
566-import QtQuick 2.0
567-import QtTest 1.0
568-import "../../../qml/Components"
569-import Ubuntu.Components.ListItems 0.1 as ListItem
570-import Ubuntu.Components 0.1
571-import Unity.Test 0.1 as UT
572-import Utils 0.1
573-
574-/*
575- You should see 6 green squares (from "A" to "F") and a button "View all (12)".
576- Once you press that button other 6 green squares (from "G" to "L") should show up.
577-*/
578-Rectangle {
579- width: gridRect.width + controls.width
580- height: units.gu(50)
581- color: "white"
582-
583- Column {
584- id: controls
585- width: units.gu(30)
586- height: parent.height
587- anchors.top: parent.top
588- anchors.right: parent.right
589- ListItem.ValueSelector {
590- id: collapsedRowCountSelector
591- text: "collapsedRowCount"
592- values: [1,2,3,4]
593- selectedIndex: 1
594- }
595- Row {
596- spacing: units.gu(1)
597- Label { anchors.verticalCenter: parent.verticalCenter
598- text: "Filter" }
599- CheckBox {
600- id: filterCheckBox
601- checked: true
602- onCheckedChanged: filterGrid.setFilter(checked, false /*animate*/)
603- }
604- }
605- }
606-
607- ListModel {
608- id: fakeModel
609- ListElement { name: "A" }
610- ListElement { name: "B" }
611- ListElement { name: "C" }
612- ListElement { name: "D" }
613- ListElement { name: "E" }
614- ListElement { name: "F" }
615- ListElement { name: "G" }
616- ListElement { name: "H" }
617- ListElement { name: "I" }
618- ListElement { name: "J" }
619- ListElement { name: "K" }
620- ListElement { name: "L" }
621- }
622-
623- ListModel {
624- id: fakeModelTwoItems
625- ListElement { name: "A" }
626- ListElement { name: "B" }
627- }
628-
629- ListModel {
630- id: fakeModelFourItems
631- ListElement { name: "A" }
632- ListElement { name: "B" }
633- ListElement { name: "C" }
634- ListElement { name: "D" }
635- }
636-
637- Rectangle {
638- id: gridRect
639- width: units.gu(30)
640- height: parent.height
641- color: "grey"
642- anchors.top: parent.top
643- anchors.left: parent.left
644-
645- FilterGrid {
646- id: filterGrid
647- anchors.fill: parent
648- model: fakeModel
649- maximumNumberOfColumns: 3
650- collapsedRowCount:
651- collapsedRowCountSelector.values[collapsedRowCountSelector.selectedIndex]
652- minimumHorizontalSpacing: units.gu(1)
653- delegateWidth: units.gu(6)
654- delegateHeight: units.gu(6)
655- verticalSpacing: units.gu(1)
656-
657- delegate: Rectangle {
658- // So that it can be identified by countVisibleDelegates()
659- property bool isGridDelegate: true
660-
661- color: "green"
662- width: units.gu(6)
663- height: units.gu(6)
664- Text {
665- anchors.centerIn: parent
666- text: name
667- }
668- }
669- }
670- }
671-
672- UT.UnityTestCase {
673- name: "FilterGrid"
674- when: windowShown
675-
676- function init() {
677- filterGrid.model = fakeModel
678- }
679-
680- function cleanup() {
681- filterCheckBox.checked = true
682- collapsedRowCountSelector.selectedIndex = 1
683- }
684-
685- function test_turningFilterOffShowsAllElements() {
686- tryCompareFunction(countVisibleDelegates, 6)
687-
688- filterCheckBox.checked = false
689-
690- tryCompareFunction(countVisibleDelegates, 12)
691- }
692-
693- function test_collapsedRowCount() {
694- for (var i = 0; i < 4; ++i) {
695- collapsedRowCountSelector.selectedIndex = i
696- // We have 3 elements per row.
697- // row count == index + 1
698- tryCompareFunction(countVisibleDelegates, 3*(i+1))
699- }
700- }
701-
702- function test_modelSizeAffectsCollapsedRowCount_data() {
703- return [
704- { tag: "2 items, collapsedRows 1", model: fakeModelTwoItems, collapsedRowCountIndex: 0,
705- rowsWhenCollapsed: 1, visibleDelegates: 2 },
706- { tag: "2 items, collapsedRows 2", model: fakeModelTwoItems, collapsedRowCountIndex: 1,
707- rowsWhenCollapsed: 1, visibleDelegates: 2 },
708- { tag: "4 items, collapsedRows 1", model: fakeModelFourItems, collapsedRowCountIndex: 0,
709- rowsWhenCollapsed: 1, visibleDelegates: 3 },
710- { tag: "4 items, collapsedRows 2", model: fakeModelFourItems, collapsedRowCountIndex: 1,
711- rowsWhenCollapsed: 2, visibleDelegates: 4 },
712- ]
713- }
714-
715- function test_modelSizeAffectsCollapsedRowCount(data) {
716- filterGrid.model = data.model
717- collapsedRowCountSelector.selectedIndex = data.collapsedRowCountIndex
718-
719- tryCompare(filterGrid, "rowsWhenCollapsed", data.rowsWhenCollapsed)
720- tryCompareFunction(countVisibleDelegates, data.visibleDelegates)
721- }
722-
723- function countVisibleDelegates() {
724- return __countVisibleDelegates(filterGrid.visibleChildren, 0)
725- }
726-
727- function __countVisibleDelegates(objList, total) {
728- for (var i = 0; i < objList.length; ++i) {
729- var child = objList[i];
730- if (child.isGridDelegate !== undefined) {
731- ++total;
732- } else {
733- total = __countVisibleDelegates(child.visibleChildren, total)
734- }
735- }
736- return total
737- }
738- }
739-}
740
741=== modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml'
742--- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-07-09 19:44:02 +0000
743+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-07-11 07:35:07 +0000
744@@ -59,6 +59,7 @@
745 genericScopeView.scope = scopes.getScope(2)
746 shell.width = units.gu(120)
747 genericScopeView.categoryView.positionAtBeginning();
748+ waitForRendering(genericScopeView.categoryView);
749 tryCompare(genericScopeView.categoryView, "contentY", 0)
750 }
751
752@@ -105,8 +106,6 @@
753 }
754
755 function test_filter_expand_collapse() {
756- // wait for the item to be there
757- waitForRendering(genericScopeView);
758 tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader0") != null; }, true);
759
760 var header = findChild(genericScopeView, "dashSectionHeader0")
761@@ -114,18 +113,18 @@
762
763 waitForRendering(header);
764 verify(category.expandable);
765- verify(category.filtered);
766+ verify(!category.expanded);
767
768 var initialHeight = category.height;
769 var middleHeight;
770 mouseClick(header, header.width / 2, header.height / 2);
771 tryCompareFunction(function() { middleHeight = category.height; return category.height > initialHeight; }, true);
772- tryCompare(category, "filtered", false);
773+ tryCompare(category, "expanded", true);
774 tryCompareFunction(function() { return category.height > middleHeight; }, true);
775
776 mouseClick(header, header.width / 2, header.height / 2);
777 verify(category.expandable);
778- tryCompare(category, "filtered", true);
779+ tryCompare(category, "expanded", false);
780 }
781
782 function test_filter_expand_expand_collapse() {
783@@ -137,51 +136,47 @@
784
785 var header2 = findChild(genericScopeView, "dashSectionHeader2")
786 var category2 = findChild(genericScopeView, "dashCategory2")
787- var category2FilterGrid = category2.children[1].children[2];
788- verify(UT.Util.isInstanceOf(category2FilterGrid, "CardFilterGrid"));
789
790 waitForRendering(header2);
791 verify(category2.expandable);
792- verify(category2.filtered);
793+ verify(!category2.expanded);
794
795 mouseClick(header2, header2.width / 2, header2.height / 2);
796- tryCompare(category2, "filtered", false);
797- tryCompare(category2FilterGrid, "filtered", false);
798+ tryCompare(category2, "expanded", true);
799
800 categoryListView.positionAtBeginning();
801
802 var header0 = findChild(genericScopeView, "dashSectionHeader0")
803 var category0 = findChild(genericScopeView, "dashCategory0")
804 mouseClick(header0, header0.width / 2, header0.height / 2);
805- tryCompare(category0, "filtered", false);
806- tryCompare(category2, "filtered", true);
807- tryCompare(category2FilterGrid, "filtered", true);
808+ tryCompare(category0, "expanded", true);
809+ tryCompare(category2, "expanded", false);
810 mouseClick(header0, header0.width / 2, header0.height / 2);
811- tryCompare(category0, "filtered", true);
812- tryCompare(category2, "filtered", true);
813+ tryCompare(category0, "expanded", false);
814+ tryCompare(category2, "expanded", false);
815 }
816
817 function test_narrow_delegate_ranges_expand() {
818 tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory0") != undefined; }, true);
819 var category = findChild(genericScopeView, "dashCategory0")
820- tryCompare(category, "filtered", true);
821+ tryCompare(category, "expanded", false);
822
823 shell.width = units.gu(20)
824 var categoryListView = findChild(genericScopeView, "categoryListView");
825 categoryListView.contentY = units.gu(20);
826 var header0 = findChild(genericScopeView, "dashSectionHeader0")
827 mouseClick(header0, header0.width / 2, header0.height / 2);
828- tryCompare(category, "filtered", false);
829+ tryCompare(category, "expanded", true);
830 tryCompareFunction(function() { return category.item.height == genericScopeView.height - category.item.displayMarginBeginning - category.item.displayMarginEnd; }, true);
831 mouseClick(header0, header0.width / 2, header0.height / 2);
832- tryCompare(category, "filtered", true);
833+ tryCompare(category, "expanded", false);
834 }
835
836 function openPreview() {
837 tryCompareFunction(function() {
838- var filterGrid = findChild(genericScopeView, "0");
839- if (filterGrid != null) {
840- var tile = findChild(filterGrid, "delegate0");
841+ var cardGrid = findChild(genericScopeView, "0");
842+ if (cardGrid != null) {
843+ var tile = findChild(cardGrid, "delegate0");
844 return tile != null;
845 }
846 return false;
847@@ -257,7 +252,7 @@
848 closePreview();
849 }
850
851- function test_haeder_logo() {
852+ function test_header_logo() {
853 genericScopeView.scope = scopes.getScope(3);
854
855 var image = findChild(genericScopeView, "titleImage");

Subscribers

People subscribed via source and target branches