Merge lp:~unity-team/unity8/two_see_more_bugfix into lp:unity8
- two_see_more_bugfix
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Andrea Cimitan |
Approved revision: | 1193 |
Merged at revision: | 1272 |
Proposed branch: | lp:~unity-team/unity8/two_see_more_bugfix |
Merge into: | lp:unity8 |
Diff against target: |
738 lines (+322/-184) 10 files modified
plugins/Dash/listviewwithpageheader.cpp (+11/-1) plugins/Dash/listviewwithpageheader.h (+2/-0) qml/Dash/GenericScopeView.qml (+74/-29) tests/mocks/Unity/fake_categories.cpp (+100/-141) tests/mocks/Unity/fake_categories.h (+7/-12) tests/mocks/Unity/fake_resultsmodel.cpp (+9/-0) tests/mocks/Unity/fake_resultsmodel.h (+3/-0) tests/mocks/Unity/fake_scope.cpp (+17/-0) tests/mocks/Unity/fake_scope.h (+2/-0) tests/qmltests/Dash/tst_GenericScopeView.qml (+97/-1) |
To merge this branch: | bzr merge lp:~unity-team/unity8/two_see_more_bugfix |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Andrea Cimitan (community) | Approve | ||
Albert Astals Cid (community) | contains my code | Abstain | |
Michael Zanetti (community) | Needs Fixing | ||
Review via email:
|
This proposal supersedes a proposal from 2014-08-19.
Commit message
Dash: Fix issue when expanding a category and collapsing another one at the same time.
We need to first run the shrink+grow animations in the two category items, and later, if needed run the maximizeVisibleArea in the one we expanded.
It does not fix *everything* related to seeAll growing/shrinking + maximization, it may need some rethinking/
Description of the change
* Are there any related MPs required for this MP to build/function as expected?
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
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1182
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1183
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1183
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1184
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1185
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1186
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1187
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michael Zanetti (mzanetti) wrote : | # |
Some minor things inline, seems to work fine.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michał Sawicz (saviq) wrote : | # |
Fixeded.
- 1188. By Michał Sawicz
-
Drop Q_PROPERTY
- 1189. By Michał Sawicz
-
We already have a seeAllButton property.
- 1190. By Michał Sawicz
-
I said we have it already.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1190
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michael Zanetti (mzanetti) wrote : | # |
seems to fail a test now :/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michał Sawicz (saviq) wrote : | # |
> seems to fail a test now :/
Yeah, and I can't reproduce locally. Albert, back to you...
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) : | # |
- 1191. By Albert Astals Cid
-
Try to make LVWPH to behave consistently
doubles are not fun
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1191
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : | # |
The crash in testDashContent is fixed by https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1191
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Andrea Cimitan (cimi) wrote : | # |
Minor things around spacing
A question more for the backend: is it possible to have same categoryId? (in case someone badly implements a scope) We are checking for the id string now, rather the obj
- 1192. By Albert Astals Cid
-
spacing and (C) year
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : | # |
> A question more for the backend: is it possible to have same categoryId? (in
> case someone badly implements a scope) We are checking for the id string now,
> rather the obj
Yes, we used to check for id not too long ago, but was [wrongly] changed in r1212 http://
I say wrognly changed because keeping the pointer to the delegate means that if you scroll a lot in the list and the delegate gets destroyed, when you come back it'll be a different delegate pointer.
- 1193. By Albert Astals Cid
-
Typo
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Andrea Cimitan (cimi) wrote : | # |
* Did you perform an exploratory manual test run of the code change and any related functionality?
Tested this branch through other dependants, works fine
* Did CI run pass? If not, please explain why.
Auto.. ehm. :)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1192
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'plugins/Dash/listviewwithpageheader.cpp' | |||
2 | --- plugins/Dash/listviewwithpageheader.cpp 2014-09-01 10:45:25 +0000 | |||
3 | +++ plugins/Dash/listviewwithpageheader.cpp 2014-09-18 10:05:43 +0000 | |||
4 | @@ -409,6 +409,16 @@ | |||
5 | 409 | } | 409 | } |
6 | 410 | } | 410 | } |
7 | 411 | 411 | ||
8 | 412 | int ListViewWithPageHeader::firstCreatedIndex() const | ||
9 | 413 | { | ||
10 | 414 | return m_firstVisibleIndex; | ||
11 | 415 | } | ||
12 | 416 | |||
13 | 417 | int ListViewWithPageHeader::createdItemCount() const | ||
14 | 418 | { | ||
15 | 419 | return m_visibleItems.count(); | ||
16 | 420 | } | ||
17 | 421 | |||
18 | 412 | QQuickItem *ListViewWithPageHeader::item(int modelIndex) const | 422 | QQuickItem *ListViewWithPageHeader::item(int modelIndex) const |
19 | 413 | { | 423 | { |
20 | 414 | ListItem *item = itemAtIndex(modelIndex); | 424 | ListItem *item = itemAtIndex(modelIndex); |
21 | @@ -520,7 +530,7 @@ | |||
22 | 520 | // (but the header was not shown by it's own position) | 530 | // (but the header was not shown by it's own position) |
23 | 521 | // or the header is partially shown and we are not doing a maximizeVisibleArea either | 531 | // or the header is partially shown and we are not doing a maximizeVisibleArea either |
24 | 522 | const bool scrolledUp = m_previousContentY > contentY(); | 532 | const bool scrolledUp = m_previousContentY > contentY(); |
26 | 523 | const bool notRebounding = contentY() + height() < contentHeight(); | 533 | const bool notRebounding = qRound(contentY() + height()) < qRound(contentHeight()); |
27 | 524 | const bool notShownByItsOwn = contentY() + diff >= m_headerItem->y() + m_headerItem->height(); | 534 | const bool notShownByItsOwn = contentY() + diff >= m_headerItem->y() + m_headerItem->height(); |
28 | 525 | const bool maximizeVisibleAreaRunning = m_contentYAnimation->isRunning() && contentYAnimationType == ContentYAnimationMaximizeVisibleArea; | 535 | const bool maximizeVisibleAreaRunning = m_contentYAnimation->isRunning() && contentYAnimationType == ContentYAnimationMaximizeVisibleArea; |
29 | 526 | 536 | ||
30 | 527 | 537 | ||
31 | === modified file 'plugins/Dash/listviewwithpageheader.h' | |||
32 | --- plugins/Dash/listviewwithpageheader.h 2014-09-01 10:45:25 +0000 | |||
33 | +++ plugins/Dash/listviewwithpageheader.h 2014-09-18 10:05:43 +0000 | |||
34 | @@ -86,6 +86,8 @@ | |||
35 | 86 | 86 | ||
36 | 87 | Q_INVOKABLE void positionAtBeginning(); | 87 | Q_INVOKABLE void positionAtBeginning(); |
37 | 88 | Q_INVOKABLE void showHeader(); | 88 | Q_INVOKABLE void showHeader(); |
38 | 89 | Q_INVOKABLE int firstCreatedIndex() const; | ||
39 | 90 | Q_INVOKABLE int createdItemCount() const; | ||
40 | 89 | Q_INVOKABLE QQuickItem *item(int modelIndex) const; | 91 | Q_INVOKABLE QQuickItem *item(int modelIndex) const; |
41 | 90 | 92 | ||
42 | 91 | // The index has to be created for this to try to do something | 93 | // The index has to be created for this to try to do something |
43 | 92 | 94 | ||
44 | === modified file 'qml/Dash/GenericScopeView.qml' | |||
45 | --- qml/Dash/GenericScopeView.qml 2014-09-08 14:15:01 +0000 | |||
46 | +++ qml/Dash/GenericScopeView.qml 2014-09-18 10:05:43 +0000 | |||
47 | @@ -47,6 +47,10 @@ | |||
48 | 47 | 47 | ||
49 | 48 | signal backClicked() | 48 | signal backClicked() |
50 | 49 | 49 | ||
51 | 50 | onScopeChanged: { | ||
52 | 51 | floatingSeeLess.companionBase = null; | ||
53 | 52 | } | ||
54 | 53 | |||
55 | 50 | function positionAtBeginning() { | 54 | function positionAtBeginning() { |
56 | 51 | categoryView.positionAtBeginning() | 55 | categoryView.positionAtBeginning() |
57 | 52 | } | 56 | } |
58 | @@ -152,11 +156,54 @@ | |||
59 | 152 | forceNoClip: subPageLoader.open | 156 | forceNoClip: subPageLoader.open |
60 | 153 | pixelAligned: true | 157 | pixelAligned: true |
61 | 154 | 158 | ||
63 | 155 | property Item expandedCategoryItem: null | 159 | property string expandedCategoryId: "" |
64 | 160 | property int runMaximizeAfterSizeChanges: 0 | ||
65 | 156 | 161 | ||
66 | 157 | readonly property bool pageHeaderTotallyVisible: scopeView.showPageHeader && | 162 | readonly property bool pageHeaderTotallyVisible: scopeView.showPageHeader && |
67 | 158 | ((headerItemShownHeight == 0 && categoryView.contentY <= categoryView.originY) || (headerItemShownHeight == pageHeaderLoader.item.height)) | 163 | ((headerItemShownHeight == 0 && categoryView.contentY <= categoryView.originY) || (headerItemShownHeight == pageHeaderLoader.item.height)) |
68 | 159 | 164 | ||
69 | 165 | onExpandedCategoryIdChanged: { | ||
70 | 166 | var firstCreated = firstCreatedIndex(); | ||
71 | 167 | var shrinkingAny = false; | ||
72 | 168 | var shrinkHeightDifference = 0; | ||
73 | 169 | for (var i = 0; i < createdItemCount(); ++i) { | ||
74 | 170 | var baseItem = item(firstCreated + i); | ||
75 | 171 | if (baseItem.expandable) { | ||
76 | 172 | var shouldExpand = baseItem.category === expandedCategoryId; | ||
77 | 173 | if (shouldExpand != baseItem.expanded) { | ||
78 | 174 | var animate = false; | ||
79 | 175 | if (!subPageLoader.open) { | ||
80 | 176 | var animateShrinking = !shouldExpand && baseItem.y + baseItem.item.collapsedHeight + baseItem.seeAllButton.height < categoryView.height; | ||
81 | 177 | var animateGrowing = shouldExpand && baseItem.y + baseItem.height < categoryView.height; | ||
82 | 178 | animate = shrinkingAny || animateShrinking || animateGrowing; | ||
83 | 179 | } | ||
84 | 180 | |||
85 | 181 | if (!shouldExpand) { | ||
86 | 182 | shrinkingAny = true; | ||
87 | 183 | shrinkHeightDifference = baseItem.item.expandedHeight - baseItem.item.collapsedHeight; | ||
88 | 184 | } | ||
89 | 185 | |||
90 | 186 | if (shouldExpand && !subPageLoader.open) { | ||
91 | 187 | if (!shrinkingAny) { | ||
92 | 188 | categoryView.maximizeVisibleArea(firstCreated + i, baseItem.item.expandedHeight + baseItem.seeAllButton.height); | ||
93 | 189 | } else { | ||
94 | 190 | // If the space that shrinking is smaller than the one we need to grow we'll call maximizeVisibleArea | ||
95 | 191 | // after the shrink/grow animation ends | ||
96 | 192 | var growHeightDifference = baseItem.item.expandedHeight - baseItem.item.collapsedHeight; | ||
97 | 193 | if (growHeightDifference > shrinkHeightDifference) { | ||
98 | 194 | runMaximizeAfterSizeChanges = 2; | ||
99 | 195 | } else { | ||
100 | 196 | runMaximizeAfterSizeChanges = 0; | ||
101 | 197 | } | ||
102 | 198 | } | ||
103 | 199 | } | ||
104 | 200 | |||
105 | 201 | baseItem.expand(shouldExpand, animate); | ||
106 | 202 | } | ||
107 | 203 | } | ||
108 | 204 | } | ||
109 | 205 | } | ||
110 | 206 | |||
111 | 160 | delegate: ListItems.Base { | 207 | delegate: ListItems.Base { |
112 | 161 | id: baseItem | 208 | id: baseItem |
113 | 162 | objectName: "dashCategory" + category | 209 | objectName: "dashCategory" + category |
114 | @@ -194,7 +241,7 @@ | |||
115 | 194 | // This can happen with the VJ that doesn't know how height it will be on creation | 241 | // This can happen with the VJ that doesn't know how height it will be on creation |
116 | 195 | // so doesn't set expandable until a bit too late for onLoaded | 242 | // so doesn't set expandable until a bit too late for onLoaded |
117 | 196 | if (expandable) { | 243 | if (expandable) { |
119 | 197 | var shouldExpand = baseItem === categoryView.expandedCategoryItem; | 244 | var shouldExpand = baseItem.category === categoryView.expandedCategoryId; |
120 | 198 | baseItem.expand(shouldExpand, false /*animate*/); | 245 | baseItem.expand(shouldExpand, false /*animate*/); |
121 | 199 | } | 246 | } |
122 | 200 | } | 247 | } |
123 | @@ -215,9 +262,23 @@ | |||
124 | 215 | id: heightBehaviour | 262 | id: heightBehaviour |
125 | 216 | enabled: false | 263 | enabled: false |
126 | 217 | animation: UbuntuNumberAnimation { | 264 | animation: UbuntuNumberAnimation { |
127 | 265 | duration: UbuntuAnimation.FastDuration | ||
128 | 218 | onRunningChanged: { | 266 | onRunningChanged: { |
129 | 219 | if (!running) { | 267 | if (!running) { |
130 | 220 | heightBehaviour.enabled = false | 268 | heightBehaviour.enabled = false |
131 | 269 | if (categoryView.runMaximizeAfterSizeChanges > 0) { | ||
132 | 270 | categoryView.runMaximizeAfterSizeChanges--; | ||
133 | 271 | if (categoryView.runMaximizeAfterSizeChanges == 0) { | ||
134 | 272 | var firstCreated = categoryView.firstCreatedIndex(); | ||
135 | 273 | for (var i = 0; i < categoryView.createdItemCount(); ++i) { | ||
136 | 274 | var baseItem = categoryView.item(firstCreated + i); | ||
137 | 275 | if (baseItem.category === categoryView.expandedCategoryId) { | ||
138 | 276 | categoryView.maximizeVisibleArea(firstCreated + i, baseItem.item.expandedHeight + baseItem.seeAllButton.height); | ||
139 | 277 | break; | ||
140 | 278 | } | ||
141 | 279 | } | ||
142 | 280 | } | ||
143 | 281 | } | ||
144 | 221 | } | 282 | } |
145 | 222 | } | 283 | } |
146 | 223 | } | 284 | } |
147 | @@ -245,7 +306,7 @@ | |||
148 | 245 | item.objectName = Qt.binding(function() { return categoryId }) | 306 | item.objectName = Qt.binding(function() { return categoryId }) |
149 | 246 | item.scopeStyle = scopeView.scopeStyle; | 307 | item.scopeStyle = scopeView.scopeStyle; |
150 | 247 | if (baseItem.expandable) { | 308 | if (baseItem.expandable) { |
152 | 248 | var shouldExpand = baseItem === categoryView.expandedCategoryItem; | 309 | var shouldExpand = baseItem.category === categoryView.expandedCategoryId; |
153 | 249 | baseItem.expand(shouldExpand, false /*animate*/); | 310 | baseItem.expand(shouldExpand, false /*animate*/); |
154 | 250 | } | 311 | } |
155 | 251 | updateDelegateCreationRange(); | 312 | updateDelegateCreationRange(); |
156 | @@ -282,27 +343,6 @@ | |||
157 | 282 | } | 343 | } |
158 | 283 | Connections { | 344 | Connections { |
159 | 284 | target: categoryView | 345 | target: categoryView |
160 | 285 | onExpandedCategoryItemChanged: { | ||
161 | 286 | collapseAllButExpandedCategory(); | ||
162 | 287 | } | ||
163 | 288 | function collapseAllButExpandedCategory() { | ||
164 | 289 | var item = rendererLoader.item; | ||
165 | 290 | if (baseItem.expandable) { | ||
166 | 291 | var shouldExpand = baseItem === categoryView.expandedCategoryItem; | ||
167 | 292 | if (shouldExpand != baseItem.expanded) { | ||
168 | 293 | // If the filter animation will be seen start it, otherwise, just flip the switch | ||
169 | 294 | var shrinkingVisible = !shouldExpand && y + item.collapsedHeight + seeAll.height < categoryView.height; | ||
170 | 295 | var growingVisible = shouldExpand && y + height < categoryView.height; | ||
171 | 296 | if (!subPageLoader.open || shouldExpand) { | ||
172 | 297 | var animate = shrinkingVisible || growingVisible; | ||
173 | 298 | baseItem.expand(shouldExpand, animate) | ||
174 | 299 | if (shouldExpand && !subPageLoader.open) { | ||
175 | 300 | categoryView.maximizeVisibleArea(index, item.expandedHeight + seeAll.height); | ||
176 | 301 | } | ||
177 | 302 | } | ||
178 | 303 | } | ||
179 | 304 | } | ||
180 | 305 | } | ||
181 | 306 | onOriginYChanged: rendererLoader.updateDelegateCreationRange(); | 346 | onOriginYChanged: rendererLoader.updateDelegateCreationRange(); |
182 | 307 | onContentYChanged: rendererLoader.updateDelegateCreationRange(); | 347 | onContentYChanged: rendererLoader.updateDelegateCreationRange(); |
183 | 308 | onHeightChanged: rendererLoader.updateDelegateCreationRange(); | 348 | onHeightChanged: rendererLoader.updateDelegateCreationRange(); |
184 | @@ -352,10 +392,11 @@ | |||
185 | 352 | height: seeAllLabel.visible ? seeAllLabel.font.pixelSize + units.gu(4) : 0 | 392 | height: seeAllLabel.visible ? seeAllLabel.font.pixelSize + units.gu(4) : 0 |
186 | 353 | 393 | ||
187 | 354 | onClicked: { | 394 | onClicked: { |
190 | 355 | if (categoryView.expandedCategoryItem !== baseItem) { | 395 | if (categoryView.expandedCategoryId !== baseItem.category) { |
191 | 356 | categoryView.expandedCategoryItem = baseItem; | 396 | categoryView.expandedCategoryId = baseItem.category; |
192 | 397 | floatingSeeLess.companionBase = baseItem; | ||
193 | 357 | } else { | 398 | } else { |
195 | 358 | categoryView.expandedCategoryItem = null; | 399 | categoryView.expandedCategoryId = ""; |
196 | 359 | } | 400 | } |
197 | 360 | } | 401 | } |
198 | 361 | 402 | ||
199 | @@ -455,7 +496,7 @@ | |||
200 | 455 | objectName: "floatingSeeLess" | 496 | objectName: "floatingSeeLess" |
201 | 456 | 497 | ||
202 | 457 | property Item companionTo: companionBase ? companionBase.seeAllButton : null | 498 | property Item companionTo: companionBase ? companionBase.seeAllButton : null |
204 | 458 | property Item companionBase: categoryView.expandedCategoryItem | 499 | property Item companionBase: null |
205 | 459 | property bool showBecausePosition: false | 500 | property bool showBecausePosition: false |
206 | 460 | property real yOffset: 0 | 501 | property real yOffset: 0 |
207 | 461 | 502 | ||
208 | @@ -467,7 +508,7 @@ | |||
209 | 467 | height: seeLessLabel.font.pixelSize + units.gu(4) | 508 | height: seeLessLabel.font.pixelSize + units.gu(4) |
210 | 468 | visible: companionTo && showBecausePosition | 509 | visible: companionTo && showBecausePosition |
211 | 469 | 510 | ||
213 | 470 | onClicked: categoryView.expandedCategoryItem = null; | 511 | onClicked: categoryView.expandedCategoryId = ""; |
214 | 471 | 512 | ||
215 | 472 | function updateVisibility() { | 513 | function updateVisibility() { |
216 | 473 | var companionPos = companionTo.mapToItem(floatingSeeLess, 0, 0); | 514 | var companionPos = companionTo.mapToItem(floatingSeeLess, 0, 0); |
217 | @@ -476,6 +517,10 @@ | |||
218 | 476 | var posToBase = floatingSeeLess.mapToItem(companionBase, 0, -yOffset).y; | 517 | var posToBase = floatingSeeLess.mapToItem(companionBase, 0, -yOffset).y; |
219 | 477 | yOffset = Math.max(0, companionBase.item.collapsedHeight - posToBase); | 518 | yOffset = Math.max(0, companionBase.item.collapsedHeight - posToBase); |
220 | 478 | yOffset = Math.min(yOffset, height); | 519 | yOffset = Math.min(yOffset, height); |
221 | 520 | |||
222 | 521 | if (!showBecausePosition && categoryView.expandedCategoryId === "") { | ||
223 | 522 | companionBase = null; | ||
224 | 523 | } | ||
225 | 479 | } | 524 | } |
226 | 480 | 525 | ||
227 | 481 | Label { | 526 | Label { |
228 | 482 | 527 | ||
229 | === modified file 'tests/mocks/Unity/fake_categories.cpp' | |||
230 | --- tests/mocks/Unity/fake_categories.cpp 2014-08-15 14:21:42 +0000 | |||
231 | +++ tests/mocks/Unity/fake_categories.cpp 2014-09-18 10:05:43 +0000 | |||
232 | @@ -29,25 +29,12 @@ | |||
233 | 29 | 29 | ||
234 | 30 | int Categories::rowCount(const QModelIndex& /*parent*/) const | 30 | int Categories::rowCount(const QModelIndex& /*parent*/) const |
235 | 31 | { | 31 | { |
237 | 32 | return m_category_count + m_specialCategories.count(); | 32 | return m_category_count; |
238 | 33 | } | 33 | } |
239 | 34 | 34 | ||
241 | 35 | void Categories::addSpecialCategory(QString const& categoryId, QString const& name, QString const& icon, QString const& rawTemplate, QObject* countObject) | 35 | void Categories::addSpecialCategory(QString const& /*categoryId*/, QString const& /*name*/, QString const& /*icon*/, QString const& /*rawTemplate*/, QObject* /*countObject*/) |
242 | 36 | { | 36 | { |
257 | 37 | CategoryData catData; | 37 | qFatal("Using un-implemented Categories::addSpecialCategory"); |
244 | 38 | catData.categoryId = categoryId; | ||
245 | 39 | catData.name = name; | ||
246 | 40 | catData.icon = icon; | ||
247 | 41 | catData.rawTemplate = rawTemplate; | ||
248 | 42 | catData.countObject = countObject; | ||
249 | 43 | |||
250 | 44 | beginInsertRows(QModelIndex(), 0, 0); | ||
251 | 45 | m_specialCategories.prepend(catData); | ||
252 | 46 | endInsertRows(); | ||
253 | 47 | |||
254 | 48 | if (countObject) { | ||
255 | 49 | connect(countObject, SIGNAL(countChanged()), this, SLOT(countChanged())); | ||
256 | 50 | } | ||
258 | 51 | } | 38 | } |
259 | 52 | 39 | ||
260 | 53 | bool Categories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */) | 40 | bool Categories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */) |
261 | @@ -55,23 +42,6 @@ | |||
262 | 55 | qFatal("Using un-implemented Categories::overrideCategoryJson"); | 42 | qFatal("Using un-implemented Categories::overrideCategoryJson"); |
263 | 56 | } | 43 | } |
264 | 57 | 44 | ||
265 | 58 | void Categories::countChanged() | ||
266 | 59 | { | ||
267 | 60 | QObject* countObject = sender(); | ||
268 | 61 | |||
269 | 62 | for (int i = 0; i < m_specialCategories.count(); ++i) { | ||
270 | 63 | const CategoryData &catData = m_specialCategories.at(i); | ||
271 | 64 | if (catData.countObject == countObject) { | ||
272 | 65 | QVector<int> roles; | ||
273 | 66 | roles.append(RoleCount); | ||
274 | 67 | |||
275 | 68 | QModelIndex changedIndex(index(i)); | ||
276 | 69 | dataChanged(changedIndex, changedIndex, roles); | ||
277 | 70 | break; | ||
278 | 71 | } | ||
279 | 72 | } | ||
280 | 73 | } | ||
281 | 74 | |||
282 | 75 | QVariant | 45 | QVariant |
283 | 76 | Categories::data(const QModelIndex& index, int role) const | 46 | Categories::data(const QModelIndex& index, int role) const |
284 | 77 | { | 47 | { |
285 | @@ -79,115 +49,74 @@ | |||
286 | 79 | return QVariant(); | 49 | return QVariant(); |
287 | 80 | } | 50 | } |
288 | 81 | 51 | ||
320 | 82 | ResultsModel *resultsModel = m_resultsModels[index.row()]; | 52 | ResultsModel *resultsModel = resultModel(index.row()); |
321 | 83 | if (!resultsModel) { | 53 | switch (role) { |
322 | 84 | resultsModel = new ResultsModel(15, index.row()); | 54 | case RoleCategoryId: |
323 | 85 | m_resultsModels[index.row()] = resultsModel; | 55 | return QString("%1").arg(index.row()); |
324 | 86 | } | 56 | case RoleName: |
325 | 87 | if (index.row() < m_specialCategories.count()) { | 57 | return QString("Category %1").arg(index.row()); |
326 | 88 | const CategoryData &catData = m_specialCategories.at(index.row()); | 58 | case RoleIcon: |
327 | 89 | switch (role) { | 59 | return "gtk-apply"; |
328 | 90 | case RoleCategoryId: | 60 | case RoleRawRendererTemplate: |
329 | 91 | return catData.categoryId; | 61 | qFatal("Using un-implemented RoleRawRendererTemplate Categories role"); |
330 | 92 | case RoleName: | 62 | return QVariant(); |
331 | 93 | return catData.name; | 63 | case RoleRenderer: |
332 | 94 | case RoleIcon: | 64 | { |
333 | 95 | return catData.icon; | 65 | QVariantMap map; |
334 | 96 | case RoleRawRendererTemplate: | 66 | if (index.row() % 2 == 0) { |
335 | 97 | return catData.rawTemplate; | 67 | map["category-layout"] = "grid"; |
336 | 98 | case RoleRenderer: | 68 | } else { |
337 | 99 | { | 69 | map["category-layout"] = "carousel"; |
338 | 100 | QVariantMap map; | 70 | } |
339 | 101 | if (index.row() % 2 == 0) { | 71 | if (index.row() == 18) { |
340 | 102 | map["category-layout"] = "grid"; | 72 | map["category-layout"] = "horizontal-list"; |
341 | 103 | } else { | 73 | } |
342 | 104 | map["category-layout"] = "carousel"; | 74 | if (index.row() == 19) { |
343 | 105 | map["overlay"] = true; | 75 | map["category-layout"] = "grid"; |
344 | 106 | } | 76 | map["collapsed-rows"] = 0; |
345 | 107 | map["card-size"] = "small"; | 77 | } |
346 | 108 | return map; | 78 | map["card-size"] = "small"; |
347 | 109 | } | 79 | |
348 | 110 | case RoleComponents: | 80 | map["category-layout"] = m_layouts.value(index.row(), map["category-layout"].toString()); |
349 | 111 | { | 81 | |
350 | 112 | QVariantMap map, artMap, attributeMap; | 82 | if (map["category-layout"] == "carousel") { |
351 | 83 | map["overlay"] = true; | ||
352 | 84 | } | ||
353 | 85 | |||
354 | 86 | return map; | ||
355 | 87 | } | ||
356 | 88 | case RoleComponents: | ||
357 | 89 | { | ||
358 | 90 | QVariantMap map, artMap, attributeMap; | ||
359 | 91 | if (index.row() % 2 != 0) { | ||
360 | 92 | artMap["aspect-ratio"] = QString("1.%1").arg(index.row()); | ||
361 | 93 | } else { | ||
362 | 113 | artMap["aspect-ratio"] = "1.0"; | 94 | artMap["aspect-ratio"] = "1.0"; |
440 | 114 | artMap["field"] = "art"; | 95 | } |
441 | 115 | map["art"] = artMap; | 96 | artMap["field"] = "art"; |
442 | 116 | map["title"] = "HOLA"; | 97 | map["art"] = artMap; |
443 | 117 | attributeMap["field"] = "attribute"; | 98 | map["title"] = "HOLA"; |
444 | 118 | map["attributes"] = attributeMap; | 99 | map["subtitle"] = "HOLA"; |
445 | 119 | return map; | 100 | attributeMap["field"] = "attribute"; |
446 | 120 | } | 101 | map["attributes"] = attributeMap; |
447 | 121 | case RoleHeaderLink: | 102 | return map; |
448 | 122 | return QString(); | 103 | } |
449 | 123 | case RoleResults: | 104 | case RoleHeaderLink: |
450 | 124 | return QVariant(); | 105 | { |
451 | 125 | case RoleCount: | 106 | QString res; |
452 | 126 | return catData.countObject->property("count"); | 107 | if (index.row() == 1 || index.row() == 4) { |
453 | 127 | default: | 108 | res = QString("scope://query/1"); |
454 | 128 | qFatal("Using un-implemented Categories role"); | 109 | } |
455 | 129 | return QVariant(); | 110 | res = m_headerLinks.value(index.row(), res); |
456 | 130 | } | 111 | return res; |
457 | 131 | } else { | 112 | } |
458 | 132 | switch (role) { | 113 | case RoleResults: |
459 | 133 | case RoleCategoryId: | 114 | return QVariant::fromValue(resultsModel); |
460 | 134 | return QString("%1").arg(index.row()); | 115 | case RoleCount: |
461 | 135 | case RoleName: | 116 | return resultsModel->rowCount(); |
462 | 136 | return QString("Category %1").arg(index.row()); | 117 | default: |
463 | 137 | case RoleIcon: | 118 | qFatal("Using un-implemented Categories role"); |
464 | 138 | return "gtk-apply"; | 119 | return QVariant(); |
388 | 139 | case RoleRawRendererTemplate: | ||
389 | 140 | qFatal("Using un-implemented RoleRawRendererTemplate Categories role"); | ||
390 | 141 | return QVariant(); | ||
391 | 142 | case RoleRenderer: | ||
392 | 143 | { | ||
393 | 144 | QVariantMap map; | ||
394 | 145 | if (index.row() % 2 == 0) { | ||
395 | 146 | map["category-layout"] = "grid"; | ||
396 | 147 | } else { | ||
397 | 148 | map["category-layout"] = "carousel"; | ||
398 | 149 | map["card-size"] = "medium"; | ||
399 | 150 | map["overlay"] = true; | ||
400 | 151 | } | ||
401 | 152 | if (index.row() == 18) { | ||
402 | 153 | map["category-layout"] = "horizontal-list"; | ||
403 | 154 | } | ||
404 | 155 | if (index.row() == 19) { | ||
405 | 156 | map["category-layout"] = "grid"; | ||
406 | 157 | map["collapsed-rows"] = 0; | ||
407 | 158 | } | ||
408 | 159 | map["card-size"] = "small"; | ||
409 | 160 | return map; | ||
410 | 161 | } | ||
411 | 162 | case RoleComponents: | ||
412 | 163 | { | ||
413 | 164 | QVariantMap map, artMap, attributeMap; | ||
414 | 165 | if (index.row() % 2 != 0) { | ||
415 | 166 | artMap["aspect-ratio"] = QString("1.%1").arg(index.row()); | ||
416 | 167 | } else { | ||
417 | 168 | artMap["aspect-ratio"] = "1.0"; | ||
418 | 169 | } | ||
419 | 170 | artMap["field"] = "art"; | ||
420 | 171 | map["art"] = artMap; | ||
421 | 172 | map["title"] = "HOLA"; | ||
422 | 173 | map["subtitle"] = "HOLA"; | ||
423 | 174 | attributeMap["field"] = "attribute"; | ||
424 | 175 | map["attributes"] = attributeMap; | ||
425 | 176 | return map; | ||
426 | 177 | } | ||
427 | 178 | case RoleHeaderLink: | ||
428 | 179 | if (index.row() == 1 || index.row() == 4) { | ||
429 | 180 | return QString("scope://query/1"); | ||
430 | 181 | } | ||
431 | 182 | return QString(); | ||
432 | 183 | case RoleResults: | ||
433 | 184 | return QVariant::fromValue(resultsModel); | ||
434 | 185 | case RoleCount: | ||
435 | 186 | return resultsModel->rowCount(); | ||
436 | 187 | default: | ||
437 | 188 | qFatal("Using un-implemented Categories role"); | ||
438 | 189 | return QVariant(); | ||
439 | 190 | } | ||
465 | 191 | } | 120 | } |
466 | 192 | } | 121 | } |
467 | 193 | 122 | ||
468 | @@ -196,3 +125,33 @@ | |||
469 | 196 | { | 125 | { |
470 | 197 | return data(index(row, 0), role); | 126 | return data(index(row, 0), role); |
471 | 198 | } | 127 | } |
472 | 128 | |||
473 | 129 | void Categories::setCount(int count) | ||
474 | 130 | { | ||
475 | 131 | if (m_category_count != count) { | ||
476 | 132 | beginResetModel(); // This is just for test setup so we can be lazy and reset | ||
477 | 133 | m_category_count = count; | ||
478 | 134 | endResetModel(); | ||
479 | 135 | } | ||
480 | 136 | } | ||
481 | 137 | |||
482 | 138 | ResultsModel* Categories::resultModel(int row) const | ||
483 | 139 | { | ||
484 | 140 | ResultsModel *result = m_resultsModels[row]; | ||
485 | 141 | if (!result) { | ||
486 | 142 | Categories *that = const_cast<Categories*>(this); | ||
487 | 143 | result = new ResultsModel(15, row, that); | ||
488 | 144 | m_resultsModels[row] = result; | ||
489 | 145 | } | ||
490 | 146 | return result; | ||
491 | 147 | } | ||
492 | 148 | |||
493 | 149 | void Categories::setLayout(int row, const QString &layout) | ||
494 | 150 | { | ||
495 | 151 | m_layouts[row] = layout; | ||
496 | 152 | } | ||
497 | 153 | |||
498 | 154 | void Categories::setHeaderLink(int row, const QString &headerLink) | ||
499 | 155 | { | ||
500 | 156 | m_headerLinks[row] = headerLink; | ||
501 | 157 | } | ||
502 | 199 | 158 | ||
503 | === modified file 'tests/mocks/Unity/fake_categories.h' | |||
504 | --- tests/mocks/Unity/fake_categories.h 2014-07-11 16:39:33 +0000 | |||
505 | +++ tests/mocks/Unity/fake_categories.h 2014-09-18 10:05:43 +0000 | |||
506 | @@ -39,22 +39,17 @@ | |||
507 | 39 | 39 | ||
508 | 40 | Q_INVOKABLE QVariant data(int row, int role) const; | 40 | Q_INVOKABLE QVariant data(int row, int role) const; |
509 | 41 | 41 | ||
512 | 42 | private Q_SLOTS: | 42 | // For testing purposes |
513 | 43 | void countChanged(); | 43 | Q_INVOKABLE void setCount(int count); |
514 | 44 | Q_INVOKABLE ResultsModel* resultModel(int row) const; | ||
515 | 45 | Q_INVOKABLE void setLayout(int row, const QString &layout); | ||
516 | 46 | Q_INVOKABLE void setHeaderLink(int row, const QString &headerLink); | ||
517 | 44 | 47 | ||
518 | 45 | private: | 48 | private: |
519 | 46 | mutable QHash<int, ResultsModel*> m_resultsModels; | 49 | mutable QHash<int, ResultsModel*> m_resultsModels; |
520 | 50 | QHash<int, QString> m_layouts; | ||
521 | 51 | QHash<int, QString> m_headerLinks; | ||
522 | 47 | int m_category_count; | 52 | int m_category_count; |
523 | 48 | |||
524 | 49 | struct CategoryData { | ||
525 | 50 | QString categoryId; | ||
526 | 51 | QString name; | ||
527 | 52 | QString icon; | ||
528 | 53 | QString rawTemplate; | ||
529 | 54 | QObject* countObject; | ||
530 | 55 | }; | ||
531 | 56 | |||
532 | 57 | QList<CategoryData> m_specialCategories; | ||
533 | 58 | }; | 53 | }; |
534 | 59 | 54 | ||
535 | 60 | #endif // FAKE_CATEGORIES_H | 55 | #endif // FAKE_CATEGORIES_H |
536 | 61 | 56 | ||
537 | === modified file 'tests/mocks/Unity/fake_resultsmodel.cpp' | |||
538 | --- tests/mocks/Unity/fake_resultsmodel.cpp 2014-08-13 16:06:40 +0000 | |||
539 | +++ tests/mocks/Unity/fake_resultsmodel.cpp 2014-09-18 10:05:43 +0000 | |||
540 | @@ -44,6 +44,15 @@ | |||
541 | 44 | qFatal("Calling un-implemented ResultsModel::setCategoryId"); | 44 | qFatal("Calling un-implemented ResultsModel::setCategoryId"); |
542 | 45 | } | 45 | } |
543 | 46 | 46 | ||
544 | 47 | void ResultsModel::setResultCount(int result_count) | ||
545 | 48 | { | ||
546 | 49 | if (m_result_count != result_count) { | ||
547 | 50 | beginResetModel(); // This is just for test setup so we can be lazy and reset | ||
548 | 51 | m_result_count = result_count; | ||
549 | 52 | endResetModel(); | ||
550 | 53 | } | ||
551 | 54 | } | ||
552 | 55 | |||
553 | 47 | int ResultsModel::rowCount(const QModelIndex& parent) const | 56 | int ResultsModel::rowCount(const QModelIndex& parent) const |
554 | 48 | { | 57 | { |
555 | 49 | Q_UNUSED(parent); | 58 | Q_UNUSED(parent); |
556 | 50 | 59 | ||
557 | === modified file 'tests/mocks/Unity/fake_resultsmodel.h' | |||
558 | --- tests/mocks/Unity/fake_resultsmodel.h 2014-08-11 09:57:29 +0000 | |||
559 | +++ tests/mocks/Unity/fake_resultsmodel.h 2014-09-18 10:05:43 +0000 | |||
560 | @@ -41,6 +41,9 @@ | |||
561 | 41 | /* setters */ | 41 | /* setters */ |
562 | 42 | void setCategoryId(QString const& id) override; | 42 | void setCategoryId(QString const& id) override; |
563 | 43 | 43 | ||
564 | 44 | // For testing purposes | ||
565 | 45 | Q_INVOKABLE void setResultCount(int result_count); | ||
566 | 46 | |||
567 | 44 | private: | 47 | private: |
568 | 45 | int m_result_count; | 48 | int m_result_count; |
569 | 46 | int m_categoryId; | 49 | int m_categoryId; |
570 | 47 | 50 | ||
571 | === modified file 'tests/mocks/Unity/fake_scope.cpp' | |||
572 | --- tests/mocks/Unity/fake_scope.cpp 2014-08-27 08:01:40 +0000 | |||
573 | +++ tests/mocks/Unity/fake_scope.cpp 2014-09-18 10:05:43 +0000 | |||
574 | @@ -145,6 +145,23 @@ | |||
575 | 145 | Q_EMIT favoriteChanged(); | 145 | Q_EMIT favoriteChanged(); |
576 | 146 | } | 146 | } |
577 | 147 | } | 147 | } |
578 | 148 | |||
579 | 149 | void Scope::setId(const QString &id) | ||
580 | 150 | { | ||
581 | 151 | if (id != m_id) { | ||
582 | 152 | m_id = id; | ||
583 | 153 | Q_EMIT idChanged(); | ||
584 | 154 | } | ||
585 | 155 | } | ||
586 | 156 | |||
587 | 157 | void Scope::setName(const QString &name) | ||
588 | 158 | { | ||
589 | 159 | if (name != m_name) { | ||
590 | 160 | m_name = name; | ||
591 | 161 | Q_EMIT nameChanged(); | ||
592 | 162 | } | ||
593 | 163 | } | ||
594 | 164 | |||
595 | 148 | void Scope::setSearchInProgress(const bool inProg) | 165 | void Scope::setSearchInProgress(const bool inProg) |
596 | 149 | { | 166 | { |
597 | 150 | if (inProg != m_searching) { | 167 | if (inProg != m_searching) { |
598 | 151 | 168 | ||
599 | === modified file 'tests/mocks/Unity/fake_scope.h' | |||
600 | --- tests/mocks/Unity/fake_scope.h 2014-08-12 12:09:49 +0000 | |||
601 | +++ tests/mocks/Unity/fake_scope.h 2014-09-18 10:05:43 +0000 | |||
602 | @@ -56,6 +56,8 @@ | |||
603 | 56 | void setFormFactor(const QString& form_factor) override; | 56 | void setFormFactor(const QString& form_factor) override; |
604 | 57 | void setActive(const bool) override; | 57 | void setActive(const bool) override; |
605 | 58 | void setFavorite(const bool) override; | 58 | void setFavorite(const bool) override; |
606 | 59 | Q_INVOKABLE void setId(const QString &id); // This is not invokable in the Interface, here for testing benefits | ||
607 | 60 | Q_INVOKABLE void setName(const QString &name); // This is not invokable in the Interface, here for testing benefits | ||
608 | 59 | Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits | 61 | Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits |
609 | 60 | 62 | ||
610 | 61 | Q_INVOKABLE void activate(QVariant const& result) override; | 63 | Q_INVOKABLE void activate(QVariant const& result) override; |
611 | 62 | 64 | ||
612 | === modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml' | |||
613 | --- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-26 19:25:41 +0000 | |||
614 | +++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-09-18 10:05:43 +0000 | |||
615 | @@ -1,5 +1,5 @@ | |||
616 | 1 | /* | 1 | /* |
618 | 2 | * Copyright 2013 Canonical Ltd. | 2 | * Copyright 2014 Canonical Ltd. |
619 | 3 | * | 3 | * |
620 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
621 | 5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
622 | @@ -43,6 +43,10 @@ | |||
623 | 43 | onLoadedChanged: if (loaded) genericScopeView.scope = scopes.getScope(2); | 43 | onLoadedChanged: if (loaded) genericScopeView.scope = scopes.getScope(2); |
624 | 44 | } | 44 | } |
625 | 45 | 45 | ||
626 | 46 | MockScope { | ||
627 | 47 | id: mockScope | ||
628 | 48 | } | ||
629 | 49 | |||
630 | 46 | SignalSpy { | 50 | SignalSpy { |
631 | 47 | id: spy | 51 | id: spy |
632 | 48 | } | 52 | } |
633 | @@ -92,6 +96,17 @@ | |||
634 | 92 | return findChild(genericScopeView, category); | 96 | return findChild(genericScopeView, category); |
635 | 93 | } | 97 | } |
636 | 94 | 98 | ||
637 | 99 | function scrollToEnd() | ||
638 | 100 | { | ||
639 | 101 | var categoryListView = findChild(genericScopeView, "categoryListView"); | ||
640 | 102 | waitForRendering(categoryListView); | ||
641 | 103 | while (!categoryListView.atYEnd) { | ||
642 | 104 | mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height - units.gu(8), | ||
643 | 105 | genericScopeView.width/2, genericScopeView.y) | ||
644 | 106 | tryCompare(categoryListView, "moving", false); | ||
645 | 107 | } | ||
646 | 108 | } | ||
647 | 109 | |||
648 | 95 | function test_isActive() { | 110 | function test_isActive() { |
649 | 96 | tryCompare(genericScopeView.scope, "isActive", false) | 111 | tryCompare(genericScopeView.scope, "isActive", false) |
650 | 97 | genericScopeView.isCurrent = true | 112 | genericScopeView.isCurrent = true |
651 | @@ -426,6 +441,87 @@ | |||
652 | 426 | compare(image.source, data.logo, "Title image has the wrong source"); | 441 | compare(image.source, data.logo, "Title image has the wrong source"); |
653 | 427 | } | 442 | } |
654 | 428 | 443 | ||
655 | 444 | function test_seeAllTwoCategoriesScenario1() { | ||
656 | 445 | mockScope.setId("mockScope"); | ||
657 | 446 | mockScope.setName("Mock Scope"); | ||
658 | 447 | mockScope.categories.setCount(2); | ||
659 | 448 | mockScope.categories.resultModel(0).setResultCount(50); | ||
660 | 449 | mockScope.categories.resultModel(1).setResultCount(15); | ||
661 | 450 | mockScope.categories.setLayout(0, "grid"); | ||
662 | 451 | mockScope.categories.setLayout(1, "grid"); | ||
663 | 452 | mockScope.categories.setHeaderLink(0, ""); | ||
664 | 453 | mockScope.categories.setHeaderLink(1, ""); | ||
665 | 454 | genericScopeView.scope = mockScope; | ||
666 | 455 | waitForRendering(genericScopeView.categoryView); | ||
667 | 456 | |||
668 | 457 | var category0 = findChild(genericScopeView, "dashCategory0") | ||
669 | 458 | var seeAll0 = findChild(category0, "seeAll") | ||
670 | 459 | |||
671 | 460 | waitForRendering(seeAll0); | ||
672 | 461 | verify(category0.expandable); | ||
673 | 462 | verify(!category0.expanded); | ||
674 | 463 | |||
675 | 464 | mouseClick(seeAll0, seeAll0.width / 2, seeAll0.height / 2); | ||
676 | 465 | verify(category0.expanded); | ||
677 | 466 | tryCompare(category0, "height", category0.item.expandedHeight + seeAll0.height); | ||
678 | 467 | tryCompare(genericScopeView.categoryView, "contentY", units.gu(13.5)); | ||
679 | 468 | |||
680 | 469 | scrollToEnd(); | ||
681 | 470 | |||
682 | 471 | tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory1") !== null; }, true); | ||
683 | 472 | var category1 = findChild(genericScopeView, "dashCategory1") | ||
684 | 473 | var seeAll1 = findChild(category1, "seeAll") | ||
685 | 474 | verify(category1.expandable); | ||
686 | 475 | verify(!category1.expanded); | ||
687 | 476 | |||
688 | 477 | mouseClick(seeAll1, seeAll1.width / 2, seeAll1.height / 2); | ||
689 | 478 | verify(!category0.expanded); | ||
690 | 479 | verify(category1.expanded); | ||
691 | 480 | tryCompare(category1, "height", category1.item.expandedHeight + seeAll1.height); | ||
692 | 481 | tryCompareFunction(function() { | ||
693 | 482 | return genericScopeView.categoryView.contentY + category1.y + category1.height | ||
694 | 483 | == genericScopeView.categoryView.contentHeight;} | ||
695 | 484 | , true); | ||
696 | 485 | } | ||
697 | 486 | |||
698 | 487 | function test_seeAllTwoCategoriesScenario2() { | ||
699 | 488 | mockScope.setId("mockScope"); | ||
700 | 489 | mockScope.setName("Mock Scope"); | ||
701 | 490 | mockScope.categories.setCount(2); | ||
702 | 491 | mockScope.categories.resultModel(0).setResultCount(15); | ||
703 | 492 | mockScope.categories.resultModel(1).setResultCount(50); | ||
704 | 493 | mockScope.categories.setLayout(0, "grid"); | ||
705 | 494 | mockScope.categories.setLayout(1, "grid"); | ||
706 | 495 | mockScope.categories.setHeaderLink(0, ""); | ||
707 | 496 | mockScope.categories.setHeaderLink(1, ""); | ||
708 | 497 | genericScopeView.scope = mockScope; | ||
709 | 498 | waitForRendering(genericScopeView.categoryView); | ||
710 | 499 | |||
711 | 500 | var category0 = findChild(genericScopeView, "dashCategory0") | ||
712 | 501 | var seeAll0 = findChild(category0, "seeAll") | ||
713 | 502 | |||
714 | 503 | waitForRendering(seeAll0); | ||
715 | 504 | verify(category0.expandable); | ||
716 | 505 | verify(!category0.expanded); | ||
717 | 506 | |||
718 | 507 | mouseClick(seeAll0, seeAll0.width / 2, seeAll0.height / 2); | ||
719 | 508 | verify(category0.expanded); | ||
720 | 509 | tryCompare(category0, "height", category0.item.expandedHeight + seeAll0.height); | ||
721 | 510 | |||
722 | 511 | scrollToEnd(); | ||
723 | 512 | |||
724 | 513 | var category1 = findChild(genericScopeView, "dashCategory1") | ||
725 | 514 | var seeAll1 = findChild(category1, "seeAll") | ||
726 | 515 | verify(category1.expandable); | ||
727 | 516 | verify(!category1.expanded); | ||
728 | 517 | |||
729 | 518 | mouseClick(seeAll1, seeAll1.width / 2, seeAll1.height / 2); | ||
730 | 519 | verify(!category0.expanded); | ||
731 | 520 | verify(category1.expanded); | ||
732 | 521 | tryCompare(category1, "height", category1.item.expandedHeight + seeAll1.height); | ||
733 | 522 | tryCompare(category1, "y", units.gu(5)); | ||
734 | 523 | } | ||
735 | 524 | |||
736 | 429 | function test_favorite_data() { | 525 | function test_favorite_data() { |
737 | 430 | return [ | 526 | return [ |
738 | 431 | { tag: "People", id: "MockScope1", favorite: true }, | 527 | { tag: "People", id: "MockScope1", favorite: true }, |
FAILED: Continuous integration, rev:1181 jenkins. qa.ubuntu. com/job/ unity8- ci/4035/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/3816 jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- utopic/ 1036 jenkins. qa.ubuntu. com/job/ unity8- utopic- amd64-ci/ 1129 jenkins. qa.ubuntu. com/job/ unity8- utopic- i386-ci/ 1129 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- mako/3681 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/5063 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/5063/ artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 11798
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: s-jenkins. ubuntu- ci:8080/ job/unity8- ci/4035/ rebuild
http://