Merge lp:~saviq/unity8/card-visual-tweaks into lp:unity8
- card-visual-tweaks
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~saviq/unity8/card-visual-tweaks |
Merge into: | lp:unity8 |
Diff against target: |
2247 lines (+830/-318) 50 files modified
build.sh (+1/-0) cmake/modules/QmlTest.cmake (+2/-1) debian/control (+1/-0) plugins/Dash/CardAttributes.qml (+1/-1) plugins/Dash/CardCreator.js (+12/-10) plugins/Dash/listviewwithpageheader.cpp (+28/-7) plugins/Dash/listviewwithpageheader.h (+8/-0) qml/Dash/CardGrid.qml (+2/-1) qml/Dash/CardHorizontalList.qml (+1/-1) qml/Dash/CardTool.qml (+27/-19) qml/Dash/CardVerticalJournal.qml (+2/-1) qml/Dash/DashContent.qml (+1/-0) qml/Dash/DashRenderer.qml (+4/-0) qml/Dash/GenericScopeView.qml (+111/-22) qml/Dash/ScopeListView.qml (+1/-0) qml/Dash/ScopesOverviewAll.qml (+2/-0) qml/Dash/ScopesOverviewFavorites.qml (+1/-1) tests/autopilot/unity8/shell/emulators/dash.py (+2/-2) tests/mocks/Ubuntu/CMakeLists.txt (+1/-0) tests/mocks/Ubuntu/Connectivity/CMakeLists.txt (+10/-0) tests/mocks/Ubuntu/Connectivity/networking-status.cpp (+65/-0) tests/mocks/Ubuntu/Connectivity/networking-status.h (+73/-0) tests/mocks/Ubuntu/Connectivity/plugin.cpp (+46/-0) tests/mocks/Ubuntu/Connectivity/plugin.h (+35/-0) tests/mocks/Ubuntu/Connectivity/qmldir (+2/-0) 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/plugins/Dash/CMakeLists.txt (+3/-3) tests/plugins/Dash/cardcreator/1.res (+6/-5) tests/plugins/Dash/cardcreator/2.res (+7/-7) tests/plugins/Dash/cardcreator/3.res (+8/-8) tests/plugins/Dash/cardcreator/4.res (+8/-8) tests/plugins/Dash/cardcreator/5.res (+8/-8) tests/plugins/Dash/cardcreator/6.res (+6/-8) tests/plugins/Dash/cardcreator/7.res (+8/-8) tests/plugins/Dash/listviewwithpageheadertest.cpp (+39/-0) tests/plugins/Dash/listviewwithpageheadertest.qml (+1/-0) tests/plugins/Dash/listviewwithpageheadertestsection.qml (+1/-0) tests/plugins/Dash/listviewwithpageheadertestsectionexternalmodel.qml (+1/-0) tests/plugins/Ubuntu/Gestures/CMakeLists.txt (+1/-1) tests/qmltests/Components/CMakeLists.txt (+1/-1) tests/qmltests/Dash/CardHelpers.js (+1/-12) tests/qmltests/Dash/tst_Card.qml (+21/-0) tests/qmltests/Dash/tst_CardTool.qml (+29/-21) tests/qmltests/Dash/tst_Dash.qml (+1/-2) tests/qmltests/Dash/tst_GenericScopeView.qml (+103/-7) |
To merge this branch: | bzr merge lp:~saviq/unity8/card-visual-tweaks |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Alejandro J. Cura (community) | Needs Fixing | ||
Review via email: mp+233392@code.launchpad.net |
This proposal has been superseded by a proposal from 2014-09-11.
Commit message
Tweak card header to match the spec
- title is Medium only if subtitle is non-empty
- title is only centered if explicitly requested by the scope ("align": "center" in components), with only one allowed line
- subtitle is x-small
- highlighted attribute is Bold
- emblem is allowed non-square
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
All scopes that want center alignment need to adapt
* Did you perform an exploratory manual test run of your code change and any related functionality?
Y
* Did you make sure that your branch does not contain spurious tags?
Y
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
* If you changed the UI, has there been a design review?
This comes from design, see the referenced bugs.
- 1234. By Michał Sawicz
-
Bigger coverage.
- 1235. By Michał Sawicz
-
Unneeded layout assignment.
PS Jenkins bot (ps-jenkins) wrote : | # |
Alejandro J. Cura (alecu) wrote : | # |
Tested the debs produced by jenkins on mako, it looks much nicer overall, but the title is still centered by default.
I'm attaching a screenshot to show this.
Alejandro J. Cura (alecu) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1235
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://
Chris Wayne (cwayne) wrote : | # |
I've verified that this makes rectangular emblems look *much* better, but I'm still seeing the titles centered by default as well
- 1236. By Michał Sawicz
-
Fix title alignment test and binding, clean up old components from CardHelpers.js
- 1237. By Michał Sawicz
-
Fix typo
Michał Sawicz (saviq) wrote : | # |
Yeah, shouldn't have worked so late... Fixed the tests and alignment, as well as the single-line enforcing, even though I expect we won't be doing that in the end.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1237
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Chris Wayne (cwayne) wrote : | # |
Verified that emblems look better + Titles are now left-aligned as expected
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1237
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1238. By Michał Sawicz
-
Merge trunk.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1238
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://
Unmerged revisions
Preview Diff
1 | === modified file 'build.sh' | |||
2 | --- build.sh 2014-08-14 13:37:22 +0000 | |||
3 | +++ build.sh 2014-09-11 16:03:35 +0000 | |||
4 | @@ -51,6 +51,7 @@ | |||
5 | 51 | qtdeclarative5-ubuntu-settings-components \ | 51 | qtdeclarative5-ubuntu-settings-components \ |
6 | 52 | qtdeclarative5-ubuntu-telephony0.1 \ | 52 | qtdeclarative5-ubuntu-telephony0.1 \ |
7 | 53 | qtdeclarative5-ubuntu-thumbnailer0.1 \ | 53 | qtdeclarative5-ubuntu-thumbnailer0.1 \ |
8 | 54 | qml-module-ubuntu-connectivity \ | ||
9 | 54 | unity-notifications-impl \ | 55 | unity-notifications-impl \ |
10 | 55 | ubuntu-mobile-icons \ | 56 | ubuntu-mobile-icons \ |
11 | 56 | unity-scope-home \ | 57 | unity-scope-home \ |
12 | 57 | 58 | ||
13 | === modified file 'cmake/modules/QmlTest.cmake' | |||
14 | --- cmake/modules/QmlTest.cmake 2014-08-07 15:32:25 +0000 | |||
15 | +++ cmake/modules/QmlTest.cmake 2014-09-11 16:03:35 +0000 | |||
16 | @@ -131,7 +131,7 @@ | |||
17 | 131 | add_manual_qml_test(${SUBPATH} ${COMPONENT_NAME} ${ARGN}) | 131 | add_manual_qml_test(${SUBPATH} ${COMPONENT_NAME} ${ARGN}) |
18 | 132 | endmacro(add_qml_test_internal) | 132 | endmacro(add_qml_test_internal) |
19 | 133 | 133 | ||
21 | 134 | macro(add_binary_qml_test CLASS_NAME LD_PATH DEPS) | 134 | macro(add_binary_qml_test CLASS_NAME LD_PATH DEPS ENVVAR) |
22 | 135 | set(testCommand | 135 | set(testCommand |
23 | 136 | LD_LIBRARY_PATH=${LD_PATH} | 136 | LD_LIBRARY_PATH=${LD_PATH} |
24 | 137 | ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec | 137 | ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec |
25 | @@ -148,6 +148,7 @@ | |||
26 | 148 | endif() | 148 | endif() |
27 | 149 | set(xvfbtestCommand | 149 | set(xvfbtestCommand |
28 | 150 | ${LD_PRELOAD_PATH} | 150 | ${LD_PRELOAD_PATH} |
29 | 151 | ${ENVVAR} | ||
30 | 151 | LD_LIBRARY_PATH=${LD_PATH} | 152 | LD_LIBRARY_PATH=${LD_PATH} |
31 | 152 | xvfb-run --server-args "-screen 0 1024x768x24" --auto-servernum | 153 | xvfb-run --server-args "-screen 0 1024x768x24" --auto-servernum |
32 | 153 | ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec | 154 | ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec |
33 | 154 | 155 | ||
34 | === modified file 'debian/control' | |||
35 | --- debian/control 2014-09-03 07:58:32 +0000 | |||
36 | +++ debian/control 2014-09-11 16:03:35 +0000 | |||
37 | @@ -173,6 +173,7 @@ | |||
38 | 173 | libhardware2, | 173 | libhardware2, |
39 | 174 | libunity-core-6.0-9, | 174 | libunity-core-6.0-9, |
40 | 175 | pay-service, | 175 | pay-service, |
41 | 176 | qml-module-ubuntu-connectivity, | ||
42 | 176 | ${misc:Depends}, | 177 | ${misc:Depends}, |
43 | 177 | ${shlibs:Depends}, | 178 | ${shlibs:Depends}, |
44 | 178 | Provides: unity-launcher-impl, | 179 | Provides: unity-launcher-impl, |
45 | 179 | 180 | ||
46 | === modified file 'plugins/Dash/CardAttributes.qml' | |||
47 | --- plugins/Dash/CardAttributes.qml 2014-08-16 12:41:11 +0000 | |||
48 | +++ plugins/Dash/CardAttributes.qml 2014-09-11 16:03:35 +0000 | |||
49 | @@ -59,7 +59,7 @@ | |||
50 | 59 | text: "value" in modelData && modelData["value"] || ""; | 59 | text: "value" in modelData && modelData["value"] || ""; |
51 | 60 | elide: Text.ElideRight | 60 | elide: Text.ElideRight |
52 | 61 | maximumLineCount: 1 | 61 | maximumLineCount: 1 |
54 | 62 | font.weight: "style" in modelData && modelData["style"] == "highlighted" ? Font.DemiBold : Font.Light | 62 | font.weight: "style" in modelData && modelData["style"] === "highlighted" ? Font.Bold : Font.Light |
55 | 63 | fontSize: "small" | 63 | fontSize: "small" |
56 | 64 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale) | 64 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale) |
57 | 65 | color: grid.color | 65 | color: grid.color |
58 | 66 | 66 | ||
59 | === modified file 'plugins/Dash/CardCreator.js' | |||
60 | --- plugins/Dash/CardCreator.js 2014-08-29 08:19:53 +0000 | |||
61 | +++ plugins/Dash/CardCreator.js 2014-09-11 16:03:35 +0000 | |||
62 | @@ -84,7 +84,8 @@ | |||
63 | 84 | } \n\ | 84 | } \n\ |
64 | 85 | image: Image { \n\ | 85 | image: Image { \n\ |
65 | 86 | objectName: "artImage"; \n\ | 86 | objectName: "artImage"; \n\ |
67 | 87 | source: cardData && cardData["art"] || ""; \n\ | 87 | property bool doLoadSource: !NetworkingStatus.limitedBandwith; \n\ |
68 | 88 | source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; } \n\ | ||
69 | 88 | cache: true; \n\ | 89 | cache: true; \n\ |
70 | 89 | asynchronous: root.asynchronous; \n\ | 90 | asynchronous: root.asynchronous; \n\ |
71 | 90 | fillMode: Image.PreserveAspectCrop; \n\ | 91 | fillMode: Image.PreserveAspectCrop; \n\ |
72 | @@ -195,7 +196,8 @@ | |||
73 | 195 | objectName: "mascotImage"; \n\ | 196 | objectName: "mascotImage"; \n\ |
74 | 196 | anchors { %1 } \n\ | 197 | anchors { %1 } \n\ |
75 | 197 | readonly property int maxSize: Math.max(width, height) * 4; \n\ | 198 | readonly property int maxSize: Math.max(width, height) * 4; \n\ |
77 | 198 | source: cardData && cardData["mascot"] || ""; \n\ | 199 | property bool doLoadSource: !NetworkingStatus.limitedBandwith; \n\ |
78 | 200 | source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; } \n\ | ||
79 | 199 | width: units.gu(6); \n\ | 201 | width: units.gu(6); \n\ |
80 | 200 | height: units.gu(5.625); \n\ | 202 | height: units.gu(5.625); \n\ |
81 | 201 | sourceSize { width: maxSize; height: maxSize } \n\ | 203 | sourceSize { width: maxSize; height: maxSize } \n\ |
82 | @@ -215,18 +217,18 @@ | |||
83 | 215 | elide: Text.ElideRight; \n\ | 217 | elide: Text.ElideRight; \n\ |
84 | 216 | fontSize: "small"; \n\ | 218 | fontSize: "small"; \n\ |
85 | 217 | wrapMode: Text.Wrap; \n\ | 219 | wrapMode: Text.Wrap; \n\ |
87 | 218 | maximumLineCount: 2; \n\ | 220 | maximumLineCount: horizontalAlignment === Text.AlignHCenter ? 1 : 2; \n\ |
88 | 219 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\ | 221 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\ |
89 | 220 | color: %2; \n\ | 222 | color: %2; \n\ |
90 | 221 | visible: showHeader %3; \n\ | 223 | visible: showHeader %3; \n\ |
91 | 222 | text: root.title; \n\ | 224 | text: root.title; \n\ |
94 | 223 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; \n\ | 225 | font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; \n\ |
95 | 224 | horizontalAlignment: root.headerAlignment; \n\ | 226 | horizontalAlignment: root.titleAlignment; \n\ |
96 | 225 | }\n'; | 227 | }\n'; |
97 | 226 | 228 | ||
98 | 227 | // %1 is used as extra anchors of emblemIcon | 229 | // %1 is used as extra anchors of emblemIcon |
99 | 228 | // %2 is used as color of emblemIcon | 230 | // %2 is used as color of emblemIcon |
101 | 229 | var kEmblemIconCode = 'Icon { \n\ | 231 | var kEmblemIconCode = 'StatusIcon { \n\ |
102 | 230 | id: emblemIcon; \n\ | 232 | id: emblemIcon; \n\ |
103 | 231 | objectName: "emblemIcon"; \n\ | 233 | objectName: "emblemIcon"; \n\ |
104 | 232 | anchors { \n\ | 234 | anchors { \n\ |
105 | @@ -236,7 +238,6 @@ | |||
106 | 236 | } \n\ | 238 | } \n\ |
107 | 237 | source: cardData && cardData["emblem"] || ""; \n\ | 239 | source: cardData && cardData["emblem"] || ""; \n\ |
108 | 238 | color: %2; \n\ | 240 | color: %2; \n\ |
109 | 239 | width: height; \n\ | ||
110 | 240 | height: source != "" ? titleLabel.font.pixelSize : 0; \n\ | 241 | height: source != "" ? titleLabel.font.pixelSize : 0; \n\ |
111 | 241 | }\n'; | 242 | }\n'; |
112 | 242 | 243 | ||
113 | @@ -258,13 +259,12 @@ | |||
114 | 258 | anchors { %1 } \n\ | 259 | anchors { %1 } \n\ |
115 | 259 | anchors.topMargin: units.dp(2); \n\ | 260 | anchors.topMargin: units.dp(2); \n\ |
116 | 260 | elide: Text.ElideRight; \n\ | 261 | elide: Text.ElideRight; \n\ |
118 | 261 | fontSize: "small"; \n\ | 262 | fontSize: "x-small"; \n\ |
119 | 262 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\ | 263 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\ |
120 | 263 | color: %2; \n\ | 264 | color: %2; \n\ |
121 | 264 | visible: titleLabel.visible && titleLabel.text; \n\ | 265 | visible: titleLabel.visible && titleLabel.text; \n\ |
122 | 265 | text: cardData && cardData["subtitle"] || ""; \n\ | 266 | text: cardData && cardData["subtitle"] || ""; \n\ |
123 | 266 | font.weight: Font.Light; \n\ | 267 | font.weight: Font.Light; \n\ |
124 | 267 | horizontalAlignment: root.headerAlignment; \n\ | ||
125 | 268 | }\n'; | 268 | }\n'; |
126 | 269 | 269 | ||
127 | 270 | // %1 is used as anchors of attributesRow | 270 | // %1 is used as anchors of attributesRow |
128 | @@ -310,7 +310,7 @@ | |||
129 | 310 | property var artShapeBorderSource: undefined; \n\ | 310 | property var artShapeBorderSource: undefined; \n\ |
130 | 311 | property real fontScale: 1.0; \n\ | 311 | property real fontScale: 1.0; \n\ |
131 | 312 | property var scopeStyle: null; \n\ | 312 | property var scopeStyle: null; \n\ |
133 | 313 | property int headerAlignment: Text.AlignLeft; \n\ | 313 | property int titleAlignment: Text.AlignLeft; \n\ |
134 | 314 | property int fixedHeaderHeight: -1; \n\ | 314 | property int fixedHeaderHeight: -1; \n\ |
135 | 315 | property size fixedArtShapeSize: Qt.size(-1, -1); \n\ | 315 | property size fixedArtShapeSize: Qt.size(-1, -1); \n\ |
136 | 316 | readonly property string title: cardData && cardData["title"] || ""; \n\ | 316 | readonly property string title: cardData && cardData["title"] || ""; \n\ |
137 | @@ -655,6 +655,8 @@ | |||
138 | 655 | function createCardComponent(parent, template, components) { | 655 | function createCardComponent(parent, template, components) { |
139 | 656 | var imports = 'import QtQuick 2.2; \n\ | 656 | var imports = 'import QtQuick 2.2; \n\ |
140 | 657 | import Ubuntu.Components 1.1; \n\ | 657 | import Ubuntu.Components 1.1; \n\ |
141 | 658 | import Ubuntu.Settings.Components 0.1; \n\ | ||
142 | 659 | import Ubuntu.Connectivity 1.0; \n\ | ||
143 | 658 | import Dash 0.1;\n\ | 660 | import Dash 0.1;\n\ |
144 | 659 | import Utils 0.1;\n'; | 661 | import Utils 0.1;\n'; |
145 | 660 | var card = cardString(template, components); | 662 | var card = cardString(template, components); |
146 | 661 | 663 | ||
147 | === modified file 'plugins/Dash/listviewwithpageheader.cpp' | |||
148 | --- plugins/Dash/listviewwithpageheader.cpp 2014-09-01 10:45:25 +0000 | |||
149 | +++ plugins/Dash/listviewwithpageheader.cpp 2014-09-11 16:03:35 +0000 | |||
150 | @@ -104,8 +104,6 @@ | |||
151 | 104 | #pragma GCC diagnostic pop | 104 | #pragma GCC diagnostic pop |
152 | 105 | // #include <private/qquickrectangle_p.h> | 105 | // #include <private/qquickrectangle_p.h> |
153 | 106 | 106 | ||
154 | 107 | static const qreal bufferRatio = 0.5; | ||
155 | 108 | |||
156 | 109 | qreal ListViewWithPageHeader::ListItem::height() const | 107 | qreal ListViewWithPageHeader::ListItem::height() const |
157 | 110 | { | 108 | { |
158 | 111 | return m_item->height() + (m_sectionItem ? m_sectionItem->height() : 0); | 109 | return m_item->height() + (m_sectionItem ? m_sectionItem->height() : 0); |
159 | @@ -158,6 +156,7 @@ | |||
160 | 158 | , m_forceNoClip(false) | 156 | , m_forceNoClip(false) |
161 | 159 | , m_inLayout(false) | 157 | , m_inLayout(false) |
162 | 160 | , m_inContentHeightKeepHeaderShown(false) | 158 | , m_inContentHeightKeepHeaderShown(false) |
163 | 159 | , m_cacheBuffer(0) | ||
164 | 161 | { | 160 | { |
165 | 162 | m_clipItem = new QQuickItem(contentItem()); | 161 | m_clipItem = new QQuickItem(contentItem()); |
166 | 163 | // m_clipItem = new QQuickRectangle(contentItem()); | 162 | // m_clipItem = new QQuickRectangle(contentItem()); |
167 | @@ -335,6 +334,20 @@ | |||
168 | 335 | return m_headerItemShownHeight; | 334 | return m_headerItemShownHeight; |
169 | 336 | } | 335 | } |
170 | 337 | 336 | ||
171 | 337 | qreal ListViewWithPageHeader::cacheBuffer() const | ||
172 | 338 | { | ||
173 | 339 | return m_cacheBuffer; | ||
174 | 340 | } | ||
175 | 341 | |||
176 | 342 | void ListViewWithPageHeader::setCacheBuffer(qreal cacheBuffer) | ||
177 | 343 | { | ||
178 | 344 | if (cacheBuffer != m_cacheBuffer) { | ||
179 | 345 | m_cacheBuffer = cacheBuffer; | ||
180 | 346 | Q_EMIT cacheBufferChanged(); | ||
181 | 347 | polish(); | ||
182 | 348 | } | ||
183 | 349 | } | ||
184 | 350 | |||
185 | 338 | void ListViewWithPageHeader::positionAtBeginning() | 351 | void ListViewWithPageHeader::positionAtBeginning() |
186 | 339 | { | 352 | { |
187 | 340 | if (m_delegateModel->count() <= 0) | 353 | if (m_delegateModel->count() <= 0) |
188 | @@ -356,8 +369,7 @@ | |||
189 | 356 | // Create the subsequent items | 369 | // Create the subsequent items |
190 | 357 | int modelIndex = 1; | 370 | int modelIndex = 1; |
191 | 358 | qreal pos = item->y() + item->height(); | 371 | qreal pos = item->y() + item->height(); |
194 | 359 | const qreal buffer = height() * bufferRatio; | 372 | const qreal bufferTo = height() + m_cacheBuffer; |
193 | 360 | const qreal bufferTo = height() + buffer; | ||
195 | 361 | while (modelIndex < m_delegateModel->count() && pos <= bufferTo) { | 373 | while (modelIndex < m_delegateModel->count() && pos <= bufferTo) { |
196 | 362 | if (!(item = createItem(modelIndex, false))) | 374 | if (!(item = createItem(modelIndex, false))) |
197 | 363 | break; | 375 | break; |
198 | @@ -409,6 +421,16 @@ | |||
199 | 409 | } | 421 | } |
200 | 410 | } | 422 | } |
201 | 411 | 423 | ||
202 | 424 | Q_INVOKABLE int ListViewWithPageHeader::firstCreatedIndex() const | ||
203 | 425 | { | ||
204 | 426 | return m_firstVisibleIndex; | ||
205 | 427 | } | ||
206 | 428 | |||
207 | 429 | Q_INVOKABLE int ListViewWithPageHeader::createdItemCount() const | ||
208 | 430 | { | ||
209 | 431 | return m_visibleItems.count(); | ||
210 | 432 | } | ||
211 | 433 | |||
212 | 412 | QQuickItem *ListViewWithPageHeader::item(int modelIndex) const | 434 | QQuickItem *ListViewWithPageHeader::item(int modelIndex) const |
213 | 413 | { | 435 | { |
214 | 414 | ListItem *item = itemAtIndex(modelIndex); | 436 | ListItem *item = itemAtIndex(modelIndex); |
215 | @@ -593,11 +615,10 @@ | |||
216 | 593 | return; | 615 | return; |
217 | 594 | } | 616 | } |
218 | 595 | 617 | ||
219 | 596 | const qreal buffer = height() * bufferRatio; | ||
220 | 597 | const qreal from = contentY(); | 618 | const qreal from = contentY(); |
221 | 598 | const qreal to = from + height(); | 619 | const qreal to = from + height(); |
224 | 599 | const qreal bufferFrom = from - buffer; | 620 | const qreal bufferFrom = from - m_cacheBuffer; |
225 | 600 | const qreal bufferTo = to + buffer; | 621 | const qreal bufferTo = to + m_cacheBuffer; |
226 | 601 | 622 | ||
227 | 602 | bool added = addVisibleItems(from, to, false); | 623 | bool added = addVisibleItems(from, to, false); |
228 | 603 | bool removed = removeNonVisibleItems(bufferFrom, bufferTo); | 624 | bool removed = removeNonVisibleItems(bufferFrom, bufferTo); |
229 | 604 | 625 | ||
230 | === modified file 'plugins/Dash/listviewwithpageheader.h' | |||
231 | --- plugins/Dash/listviewwithpageheader.h 2014-09-01 10:45:25 +0000 | |||
232 | +++ plugins/Dash/listviewwithpageheader.h 2014-09-11 16:03:35 +0000 | |||
233 | @@ -54,6 +54,7 @@ | |||
234 | 54 | Q_PROPERTY(bool forceNoClip READ forceNoClip WRITE setForceNoClip NOTIFY forceNoClipChanged) | 54 | Q_PROPERTY(bool forceNoClip READ forceNoClip WRITE setForceNoClip NOTIFY forceNoClipChanged) |
235 | 55 | Q_PROPERTY(int stickyHeaderHeight READ stickyHeaderHeight NOTIFY stickyHeaderHeightChanged) | 55 | Q_PROPERTY(int stickyHeaderHeight READ stickyHeaderHeight NOTIFY stickyHeaderHeightChanged) |
236 | 56 | Q_PROPERTY(qreal headerItemShownHeight READ headerItemShownHeight NOTIFY headerItemShownHeightChanged) | 56 | Q_PROPERTY(qreal headerItemShownHeight READ headerItemShownHeight NOTIFY headerItemShownHeightChanged) |
237 | 57 | Q_PROPERTY(qreal cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) | ||
238 | 57 | 58 | ||
239 | 58 | friend class ListViewWithPageHeaderTest; | 59 | friend class ListViewWithPageHeaderTest; |
240 | 59 | friend class ListViewWithPageHeaderTestSection; | 60 | friend class ListViewWithPageHeaderTestSection; |
241 | @@ -84,8 +85,13 @@ | |||
242 | 84 | int stickyHeaderHeight() const; | 85 | int stickyHeaderHeight() const; |
243 | 85 | qreal headerItemShownHeight() const; | 86 | qreal headerItemShownHeight() const; |
244 | 86 | 87 | ||
245 | 88 | qreal cacheBuffer() const; | ||
246 | 89 | void setCacheBuffer(qreal cacheBuffer); | ||
247 | 90 | |||
248 | 87 | Q_INVOKABLE void positionAtBeginning(); | 91 | Q_INVOKABLE void positionAtBeginning(); |
249 | 88 | Q_INVOKABLE void showHeader(); | 92 | Q_INVOKABLE void showHeader(); |
250 | 93 | Q_INVOKABLE int firstCreatedIndex() const; | ||
251 | 94 | Q_INVOKABLE int createdItemCount() const; | ||
252 | 89 | Q_INVOKABLE QQuickItem *item(int modelIndex) const; | 95 | Q_INVOKABLE QQuickItem *item(int modelIndex) const; |
253 | 90 | 96 | ||
254 | 91 | // The index has to be created for this to try to do something | 97 | // The index has to be created for this to try to do something |
255 | @@ -103,6 +109,7 @@ | |||
256 | 103 | void forceNoClipChanged(); | 109 | void forceNoClipChanged(); |
257 | 104 | void stickyHeaderHeightChanged(); | 110 | void stickyHeaderHeightChanged(); |
258 | 105 | void headerItemShownHeightChanged(); | 111 | void headerItemShownHeightChanged(); |
259 | 112 | void cacheBufferChanged(); | ||
260 | 106 | 113 | ||
261 | 107 | protected: | 114 | protected: |
262 | 108 | void componentComplete() override; | 115 | void componentComplete() override; |
263 | @@ -197,6 +204,7 @@ | |||
264 | 197 | bool m_forceNoClip; | 204 | bool m_forceNoClip; |
265 | 198 | bool m_inLayout; | 205 | bool m_inLayout; |
266 | 199 | bool m_inContentHeightKeepHeaderShown; | 206 | bool m_inContentHeightKeepHeaderShown; |
267 | 207 | qreal m_cacheBuffer; | ||
268 | 200 | 208 | ||
269 | 201 | // Qt 5.0 doesn't like releasing the items just after itemCreated | 209 | // Qt 5.0 doesn't like releasing the items just after itemCreated |
270 | 202 | // so we delay the releasing until the next updatePolish | 210 | // so we delay the releasing until the next updatePolish |
271 | 203 | 211 | ||
272 | === modified file 'qml/Dash/CardGrid.qml' | |||
273 | --- qml/Dash/CardGrid.qml 2014-07-29 08:57:29 +0000 | |||
274 | +++ qml/Dash/CardGrid.qml 2014-09-11 16:03:35 +0000 | |||
275 | @@ -55,6 +55,7 @@ | |||
276 | 55 | delegate: Item { | 55 | delegate: Item { |
277 | 56 | width: grid.cellWidth | 56 | width: grid.cellWidth |
278 | 57 | height: grid.cellHeight | 57 | height: grid.cellHeight |
279 | 58 | visible: y + height >= root.visibleRangeBegin && y <= root.visibleRangeEnd | ||
280 | 58 | Loader { | 59 | Loader { |
281 | 59 | id: loader | 60 | id: loader |
282 | 60 | sourceComponent: cardTool.cardComponent | 61 | sourceComponent: cardTool.cardComponent |
283 | @@ -68,7 +69,7 @@ | |||
284 | 68 | item.cardData = Qt.binding(function() { return model; }); | 69 | item.cardData = Qt.binding(function() { return model; }); |
285 | 69 | item.template = Qt.binding(function() { return cardTool.template; }); | 70 | item.template = Qt.binding(function() { return cardTool.template; }); |
286 | 70 | item.components = Qt.binding(function() { return cardTool.components; }); | 71 | item.components = Qt.binding(function() { return cardTool.components; }); |
288 | 71 | item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; }); | 72 | item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; }); |
289 | 72 | item.scopeStyle = root.scopeStyle; | 73 | item.scopeStyle = root.scopeStyle; |
290 | 73 | } | 74 | } |
291 | 74 | Connections { | 75 | Connections { |
292 | 75 | 76 | ||
293 | === modified file 'qml/Dash/CardHorizontalList.qml' | |||
294 | --- qml/Dash/CardHorizontalList.qml 2014-08-15 14:21:42 +0000 | |||
295 | +++ qml/Dash/CardHorizontalList.qml 2014-09-11 16:03:35 +0000 | |||
296 | @@ -49,7 +49,7 @@ | |||
297 | 49 | item.cardData = Qt.binding(function() { return model; }); | 49 | item.cardData = Qt.binding(function() { return model; }); |
298 | 50 | item.template = Qt.binding(function() { return cardTool.template; }); | 50 | item.template = Qt.binding(function() { return cardTool.template; }); |
299 | 51 | item.components = Qt.binding(function() { return cardTool.components; }); | 51 | item.components = Qt.binding(function() { return cardTool.components; }); |
301 | 52 | item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; }); | 52 | item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; }); |
302 | 53 | item.scopeStyle = root.scopeStyle; | 53 | item.scopeStyle = root.scopeStyle; |
303 | 54 | } | 54 | } |
304 | 55 | Connections { | 55 | Connections { |
305 | 56 | 56 | ||
306 | === modified file 'qml/Dash/CardTool.qml' | |||
307 | --- qml/Dash/CardTool.qml 2014-09-08 14:11:57 +0000 | |||
308 | +++ qml/Dash/CardTool.qml 2014-09-11 16:03:35 +0000 | |||
309 | @@ -131,21 +131,26 @@ | |||
310 | 131 | property size artShapeSize: cardLoader.item ? cardLoader.item.artShapeSize : 0 | 131 | property size artShapeSize: cardLoader.item ? cardLoader.item.artShapeSize : 0 |
311 | 132 | 132 | ||
312 | 133 | /*! | 133 | /*! |
314 | 134 | \brief Desired alignment of header components. | 134 | \brief Desired alignment of title |
315 | 135 | */ | 135 | */ |
329 | 136 | readonly property int headerAlignment: { | 136 | readonly property int titleAlignment: { |
330 | 137 | var subtitle = components["subtitle"]; | 137 | if (template["card-layout"] === "horizontal" |
331 | 138 | var price = components["price"]; | 138 | || typeof components["title"] !== "object" |
332 | 139 | var summary = components["summary"]; | 139 | || components["title"]["align"] !== "center") return Text.AlignLeft; |
333 | 140 | 140 | ||
334 | 141 | var hasSubtitle = subtitle && (typeof subtitle === "string" || subtitle["field"]) | 141 | var keys = ["mascot", "emblem", "subtitle", "attributes", "summary"]; |
335 | 142 | var hasPrice = price && (typeof price === "string" || subtitle["field"]); | 142 | |
336 | 143 | var hasSummary = summary && (typeof summary === "string" || summary["field"]) | 143 | for (var key in keys) { |
337 | 144 | 144 | key = keys[key]; | |
338 | 145 | var isOnlyTextComponent = !hasSubtitle && !hasPrice && !hasSummary; | 145 | try { |
339 | 146 | if (!isOnlyTextComponent) return Text.AlignLeft; | 146 | if (typeof components[key] === "string" |
340 | 147 | 147 | || typeof components[key]["field"] === "string") return Text.AlignLeft; | |
341 | 148 | return (template["card-layout"] === "horizontal") ? Text.AlignLeft : Text.AlignHCenter; | 148 | } catch (e) { |
342 | 149 | continue; | ||
343 | 150 | } | ||
344 | 151 | } | ||
345 | 152 | |||
346 | 153 | return Text.AlignHCenter; | ||
347 | 149 | } | 154 | } |
348 | 150 | 155 | ||
349 | 151 | QtObject { | 156 | QtObject { |
350 | @@ -169,16 +174,19 @@ | |||
351 | 169 | 174 | ||
352 | 170 | Item { | 175 | Item { |
353 | 171 | id: attributesModel | 176 | id: attributesModel |
355 | 172 | property int numOfAttributes: { | 177 | property int numOfAttributes: 0 |
356 | 178 | property var model: [] | ||
357 | 179 | property bool hasAttributes: { | ||
358 | 173 | var attributes = components["attributes"]; | 180 | var attributes = components["attributes"]; |
360 | 174 | if ((attributes != undefined) && attributes["field"]) { | 181 | var hasAttributesFlag = (attributes != undefined) && attributes["field"]; |
361 | 182 | |||
362 | 183 | if (hasAttributesFlag) { | ||
363 | 175 | if (attributes["max-count"]) { | 184 | if (attributes["max-count"]) { |
365 | 176 | return attributes["max-count"]; | 185 | numOfAttributes = attributes["max-count"]; |
366 | 177 | } | 186 | } |
367 | 178 | } | 187 | } |
369 | 179 | return 0; | 188 | return hasAttributesFlag |
370 | 180 | } | 189 | } |
371 | 181 | property var model: [] | ||
372 | 182 | 190 | ||
373 | 183 | onNumOfAttributesChanged: { | 191 | onNumOfAttributesChanged: { |
374 | 184 | model = [] | 192 | model = [] |
375 | 185 | 193 | ||
376 | === modified file 'qml/Dash/CardVerticalJournal.qml' | |||
377 | --- qml/Dash/CardVerticalJournal.qml 2014-07-29 08:57:29 +0000 | |||
378 | +++ qml/Dash/CardVerticalJournal.qml 2014-09-11 16:03:35 +0000 | |||
379 | @@ -49,6 +49,7 @@ | |||
380 | 49 | id: loader | 49 | id: loader |
381 | 50 | sourceComponent: cardTool.cardComponent | 50 | sourceComponent: cardTool.cardComponent |
382 | 51 | width: cardTool.cardWidth | 51 | width: cardTool.cardWidth |
383 | 52 | visible: y + height >= root.visibleRangeBegin && y <= root.visibleRangeEnd | ||
384 | 52 | onLoaded: { | 53 | onLoaded: { |
385 | 53 | item.objectName = "delegate" + index; | 54 | item.objectName = "delegate" + index; |
386 | 54 | item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; }); | 55 | item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; }); |
387 | @@ -56,7 +57,7 @@ | |||
388 | 56 | item.cardData = Qt.binding(function() { return model; }); | 57 | item.cardData = Qt.binding(function() { return model; }); |
389 | 57 | item.template = Qt.binding(function() { return cardTool.template; }); | 58 | item.template = Qt.binding(function() { return cardTool.template; }); |
390 | 58 | item.components = Qt.binding(function() { return cardTool.components; }); | 59 | item.components = Qt.binding(function() { return cardTool.components; }); |
392 | 59 | item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; }); | 60 | item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; }); |
393 | 60 | item.scopeStyle = root.scopeStyle; | 61 | item.scopeStyle = root.scopeStyle; |
394 | 61 | } | 62 | } |
395 | 62 | Connections { | 63 | Connections { |
396 | 63 | 64 | ||
397 | === modified file 'qml/Dash/DashContent.qml' | |||
398 | --- qml/Dash/DashContent.qml 2014-08-27 15:35:52 +0000 | |||
399 | +++ qml/Dash/DashContent.qml 2014-09-11 16:03:35 +0000 | |||
400 | @@ -177,6 +177,7 @@ | |||
401 | 177 | dashContent.scopeLoaded(item.scope.id) | 177 | dashContent.scopeLoaded(item.scope.id) |
402 | 178 | item.paginationCount = Qt.binding(function() { return dashContentList.count } ) | 178 | item.paginationCount = Qt.binding(function() { return dashContentList.count } ) |
403 | 179 | item.paginationIndex = Qt.binding(function() { return dashContentList.currentIndex } ) | 179 | item.paginationIndex = Qt.binding(function() { return dashContentList.currentIndex } ) |
404 | 180 | item.holdingList = dashContentList; | ||
405 | 180 | } | 181 | } |
406 | 181 | Connections { | 182 | Connections { |
407 | 182 | target: isCurrent ? scope : null | 183 | target: isCurrent ? scope : null |
408 | 183 | 184 | ||
409 | === modified file 'qml/Dash/DashRenderer.qml' | |||
410 | --- qml/Dash/DashRenderer.qml 2014-07-29 08:57:29 +0000 | |||
411 | +++ qml/Dash/DashRenderer.qml 2014-09-11 16:03:35 +0000 | |||
412 | @@ -27,6 +27,10 @@ | |||
413 | 27 | 27 | ||
414 | 28 | property int displayMarginEnd: 0 | 28 | property int displayMarginEnd: 0 |
415 | 29 | 29 | ||
416 | 30 | property int visibleRangeBegin: 0 | ||
417 | 31 | |||
418 | 32 | property int visibleRangeEnd: 0 | ||
419 | 33 | |||
420 | 30 | property real originY: 0 | 34 | property real originY: 0 |
421 | 31 | 35 | ||
422 | 32 | // The model to renderer | 36 | // The model to renderer |
423 | 33 | 37 | ||
424 | === modified file 'qml/Dash/GenericScopeView.qml' | |||
425 | --- qml/Dash/GenericScopeView.qml 2014-09-08 14:15:01 +0000 | |||
426 | +++ qml/Dash/GenericScopeView.qml 2014-09-11 16:03:35 +0000 | |||
427 | @@ -38,6 +38,7 @@ | |||
428 | 38 | property int paginationCount: 0 | 38 | property int paginationCount: 0 |
429 | 39 | property int paginationIndex: 0 | 39 | property int paginationIndex: 0 |
430 | 40 | property alias pageHeaderTotallyVisible: categoryView.pageHeaderTotallyVisible | 40 | property alias pageHeaderTotallyVisible: categoryView.pageHeaderTotallyVisible |
431 | 41 | property var holdingList: null | ||
432 | 41 | 42 | ||
433 | 42 | property var scopeStyle: ScopeStyle { | 43 | property var scopeStyle: ScopeStyle { |
434 | 43 | style: scope ? scope.customizations : {} | 44 | style: scope ? scope.customizations : {} |
435 | @@ -47,6 +48,10 @@ | |||
436 | 47 | 48 | ||
437 | 48 | signal backClicked() | 49 | signal backClicked() |
438 | 49 | 50 | ||
439 | 51 | onScopeChanged: { | ||
440 | 52 | floatingSeeLess.companionBase = null; | ||
441 | 53 | } | ||
442 | 54 | |||
443 | 50 | function positionAtBeginning() { | 55 | function positionAtBeginning() { |
444 | 51 | categoryView.positionAtBeginning() | 56 | categoryView.positionAtBeginning() |
445 | 52 | } | 57 | } |
446 | @@ -152,11 +157,55 @@ | |||
447 | 152 | forceNoClip: subPageLoader.open | 157 | forceNoClip: subPageLoader.open |
448 | 153 | pixelAligned: true | 158 | pixelAligned: true |
449 | 154 | 159 | ||
451 | 155 | property Item expandedCategoryItem: null | 160 | property string expandedCategoryId: "" |
452 | 161 | property int runMaximizeAfterSizeChanges: 0 | ||
453 | 156 | 162 | ||
454 | 157 | readonly property bool pageHeaderTotallyVisible: scopeView.showPageHeader && | 163 | readonly property bool pageHeaderTotallyVisible: scopeView.showPageHeader && |
455 | 158 | ((headerItemShownHeight == 0 && categoryView.contentY <= categoryView.originY) || (headerItemShownHeight == pageHeaderLoader.item.height)) | 164 | ((headerItemShownHeight == 0 && categoryView.contentY <= categoryView.originY) || (headerItemShownHeight == pageHeaderLoader.item.height)) |
456 | 159 | 165 | ||
457 | 166 | onExpandedCategoryIdChanged: { | ||
458 | 167 | var firstCreated = firstCreatedIndex(); | ||
459 | 168 | var shrinkingAny = false; | ||
460 | 169 | var shrinkHeightDifference = 0; | ||
461 | 170 | for (var i = 0; i < createdItemCount(); ++i) { | ||
462 | 171 | var baseItem = item(firstCreated + i); | ||
463 | 172 | if (baseItem.expandable) { | ||
464 | 173 | var shouldExpand = baseItem.category === expandedCategoryId; | ||
465 | 174 | if (shouldExpand != baseItem.expanded) { | ||
466 | 175 | |||
467 | 176 | var animate = false; | ||
468 | 177 | if (!subPageLoader.open) { | ||
469 | 178 | var animateShrinking = !shouldExpand && baseItem.y + baseItem.item.collapsedHeight + baseItem.seeAll.height < categoryView.height; | ||
470 | 179 | var animateGrowing = shouldExpand && baseItem.y + baseItem.height < categoryView.height; | ||
471 | 180 | animate = shrinkingAny || animateShrinking || animateGrowing; | ||
472 | 181 | } | ||
473 | 182 | |||
474 | 183 | if (!shouldExpand) { | ||
475 | 184 | shrinkingAny = true; | ||
476 | 185 | shrinkHeightDifference = baseItem.item.expandedHeight - baseItem.item.collapsedHeight; | ||
477 | 186 | } | ||
478 | 187 | |||
479 | 188 | if (shouldExpand && !subPageLoader.open) { | ||
480 | 189 | if (!shrinkingAny) { | ||
481 | 190 | categoryView.maximizeVisibleArea(firstCreated + i, baseItem.item.expandedHeight + baseItem.seeAll.height); | ||
482 | 191 | } else { | ||
483 | 192 | // If the space that shrkinking is smaller than the one we need to grow we'll call maximizeVisibleArea | ||
484 | 193 | // after the shrink/grow animation ends | ||
485 | 194 | var growHeightDifference = baseItem.item.expandedHeight - baseItem.item.collapsedHeight; | ||
486 | 195 | if (growHeightDifference > shrinkHeightDifference) { | ||
487 | 196 | runMaximizeAfterSizeChanges = 2; | ||
488 | 197 | } else { | ||
489 | 198 | runMaximizeAfterSizeChanges = 0; | ||
490 | 199 | } | ||
491 | 200 | } | ||
492 | 201 | } | ||
493 | 202 | |||
494 | 203 | baseItem.expand(shouldExpand, animate); | ||
495 | 204 | } | ||
496 | 205 | } | ||
497 | 206 | } | ||
498 | 207 | } | ||
499 | 208 | |||
500 | 160 | delegate: ListItems.Base { | 209 | delegate: ListItems.Base { |
501 | 161 | id: baseItem | 210 | id: baseItem |
502 | 162 | objectName: "dashCategory" + category | 211 | objectName: "dashCategory" + category |
503 | @@ -175,6 +224,7 @@ | |||
504 | 175 | readonly property string category: categoryId | 224 | readonly property string category: categoryId |
505 | 176 | readonly property string headerLink: model.headerLink | 225 | readonly property string headerLink: model.headerLink |
506 | 177 | readonly property var item: rendererLoader.item | 226 | readonly property var item: rendererLoader.item |
507 | 227 | readonly property var seeAll: seeAll | ||
508 | 178 | 228 | ||
509 | 179 | function expand(expand, animate) { | 229 | function expand(expand, animate) { |
510 | 180 | heightBehaviour.enabled = animate; | 230 | heightBehaviour.enabled = animate; |
511 | @@ -194,13 +244,13 @@ | |||
512 | 194 | // This can happen with the VJ that doesn't know how height it will be on creation | 244 | // This can happen with the VJ that doesn't know how height it will be on creation |
513 | 195 | // so doesn't set expandable until a bit too late for onLoaded | 245 | // so doesn't set expandable until a bit too late for onLoaded |
514 | 196 | if (expandable) { | 246 | if (expandable) { |
516 | 197 | var shouldExpand = baseItem === categoryView.expandedCategoryItem; | 247 | var shouldExpand = baseItem.category === categoryView.expandedCategoryId; |
517 | 198 | baseItem.expand(shouldExpand, false /*animate*/); | 248 | baseItem.expand(shouldExpand, false /*animate*/); |
518 | 199 | } | 249 | } |
519 | 200 | } | 250 | } |
520 | 201 | 251 | ||
523 | 202 | onHeightChanged: rendererLoader.updateDelegateCreationRange(); | 252 | onHeightChanged: rendererLoader.updateRanges(); |
524 | 203 | onYChanged: rendererLoader.updateDelegateCreationRange(); | 253 | onYChanged: rendererLoader.updateRanges(); |
525 | 204 | 254 | ||
526 | 205 | Loader { | 255 | Loader { |
527 | 206 | id: rendererLoader | 256 | id: rendererLoader |
528 | @@ -215,9 +265,23 @@ | |||
529 | 215 | id: heightBehaviour | 265 | id: heightBehaviour |
530 | 216 | enabled: false | 266 | enabled: false |
531 | 217 | animation: UbuntuNumberAnimation { | 267 | animation: UbuntuNumberAnimation { |
532 | 268 | duration: UbuntuAnimation.FastDuration | ||
533 | 218 | onRunningChanged: { | 269 | onRunningChanged: { |
534 | 219 | if (!running) { | 270 | if (!running) { |
535 | 220 | heightBehaviour.enabled = false | 271 | heightBehaviour.enabled = false |
536 | 272 | if (categoryView.runMaximizeAfterSizeChanges > 0) { | ||
537 | 273 | categoryView.runMaximizeAfterSizeChanges--; | ||
538 | 274 | if (categoryView.runMaximizeAfterSizeChanges == 0) { | ||
539 | 275 | var firstCreated = categoryView.firstCreatedIndex(); | ||
540 | 276 | for (var i = 0; i < categoryView.createdItemCount(); ++i) { | ||
541 | 277 | var baseItem = categoryView.item(firstCreated + i); | ||
542 | 278 | if (baseItem.category === categoryView.expandedCategoryId) { | ||
543 | 279 | categoryView.maximizeVisibleArea(firstCreated + i, baseItem.item.expandedHeight + baseItem.seeAll.height); | ||
544 | 280 | break; | ||
545 | 281 | } | ||
546 | 282 | } | ||
547 | 283 | } | ||
548 | 284 | } | ||
549 | 221 | } | 285 | } |
550 | 222 | } | 286 | } |
551 | 223 | } | 287 | } |
552 | @@ -245,10 +309,10 @@ | |||
553 | 245 | item.objectName = Qt.binding(function() { return categoryId }) | 309 | item.objectName = Qt.binding(function() { return categoryId }) |
554 | 246 | item.scopeStyle = scopeView.scopeStyle; | 310 | item.scopeStyle = scopeView.scopeStyle; |
555 | 247 | if (baseItem.expandable) { | 311 | if (baseItem.expandable) { |
557 | 248 | var shouldExpand = baseItem === categoryView.expandedCategoryItem; | 312 | var shouldExpand = baseItem.category === categoryView.expandedCategoryId; |
558 | 249 | baseItem.expand(shouldExpand, false /*animate*/); | 313 | baseItem.expand(shouldExpand, false /*animate*/); |
559 | 250 | } | 314 | } |
561 | 251 | updateDelegateCreationRange(); | 315 | updateRanges(); |
562 | 252 | if (scope && scope.id === "clickscope" && (categoryId === "predefined" || categoryId === "local")) { | 316 | if (scope && scope.id === "clickscope" && (categoryId === "predefined" || categoryId === "local")) { |
563 | 253 | // Yeah, hackish :/ | 317 | // Yeah, hackish :/ |
564 | 254 | cardTool.artShapeSize = Qt.size(units.gu(8), units.gu(7.5)); | 318 | cardTool.artShapeSize = Qt.size(units.gu(8), units.gu(7.5)); |
565 | @@ -303,13 +367,25 @@ | |||
566 | 303 | } | 367 | } |
567 | 304 | } | 368 | } |
568 | 305 | } | 369 | } |
576 | 306 | onOriginYChanged: rendererLoader.updateDelegateCreationRange(); | 370 | onOriginYChanged: rendererLoader.updateRanges(); |
577 | 307 | onContentYChanged: rendererLoader.updateDelegateCreationRange(); | 371 | onContentYChanged: rendererLoader.updateRanges(); |
578 | 308 | onHeightChanged: rendererLoader.updateDelegateCreationRange(); | 372 | onHeightChanged: rendererLoader.updateRanges(); |
579 | 309 | onContentHeightChanged: rendererLoader.updateDelegateCreationRange(); | 373 | onContentHeightChanged: rendererLoader.updateRanges(); |
580 | 310 | } | 374 | } |
581 | 311 | 375 | Connections { | |
582 | 312 | function updateDelegateCreationRange() { | 376 | target: scopeView |
583 | 377 | onIsCurrentChanged: rendererLoader.updateRanges(); | ||
584 | 378 | } | ||
585 | 379 | Connections { | ||
586 | 380 | target: holdingList | ||
587 | 381 | onMovingChanged: if (!moving) rendererLoader.updateRanges(); | ||
588 | 382 | } | ||
589 | 383 | |||
590 | 384 | function updateRanges() { | ||
591 | 385 | if (holdingList && holdingList.moving) { | ||
592 | 386 | return; | ||
593 | 387 | } | ||
594 | 388 | |||
595 | 313 | if (categoryView.moving) { | 389 | if (categoryView.moving) { |
596 | 314 | // Do not update the range if we are overshooting up or down, since we'll come back | 390 | // Do not update the range if we are overshooting up or down, since we'll come back |
597 | 315 | // to the stable position and delete/create items without any reason | 391 | // to the stable position and delete/create items without any reason |
598 | @@ -321,10 +397,18 @@ | |||
599 | 321 | } | 397 | } |
600 | 322 | } | 398 | } |
601 | 323 | 399 | ||
602 | 400 | if (item && item.hasOwnProperty("visibleRangeBegin")) { | ||
603 | 401 | item.visibleRangeBegin = Math.max(-baseItem.y, 0) | ||
604 | 402 | item.visibleRangeEnd = item.visibleRangeBegin + Math.min(categoryView.height, rendererLoader.height) | ||
605 | 403 | } | ||
606 | 404 | |||
607 | 324 | if (item && item.hasOwnProperty("displayMarginBeginning")) { | 405 | if (item && item.hasOwnProperty("displayMarginBeginning")) { |
608 | 325 | // TODO do we need item.originY here, test 1300302 once we have a silo | 406 | // TODO do we need item.originY here, test 1300302 once we have a silo |
609 | 326 | // and we can run it on the phone | 407 | // and we can run it on the phone |
611 | 327 | if (baseItem.y + baseItem.height <= 0) { | 408 | if (scopeView.isCurrent) { |
612 | 409 | item.displayMarginBeginning = 1073741823; | ||
613 | 410 | item.displayMarginEnd = 1073741823; | ||
614 | 411 | } else if (baseItem.y + baseItem.height <= 0) { | ||
615 | 328 | // Not visible (item at top of the list viewport) | 412 | // Not visible (item at top of the list viewport) |
616 | 329 | item.displayMarginBeginning = -baseItem.height; | 413 | item.displayMarginBeginning = -baseItem.height; |
617 | 330 | item.displayMarginEnd = 0; | 414 | item.displayMarginEnd = 0; |
618 | @@ -333,9 +417,9 @@ | |||
619 | 333 | item.displayMarginBeginning = 0; | 417 | item.displayMarginBeginning = 0; |
620 | 334 | item.displayMarginEnd = -baseItem.height; | 418 | item.displayMarginEnd = -baseItem.height; |
621 | 335 | } else { | 419 | } else { |
625 | 336 | item.displayMarginBeginning = -Math.max(-baseItem.y, 0); | 420 | item.displayMarginBeginning = Math.round(-Math.max(-baseItem.y, 0)); |
626 | 337 | item.displayMarginEnd = -Math.max(baseItem.height - seeAll.height | 421 | item.displayMarginEnd = -Math.round(Math.max(baseItem.height - seeAll.height |
627 | 338 | - categoryView.height + baseItem.y, 0) | 422 | - categoryView.height + baseItem.y, 0)); |
628 | 339 | } | 423 | } |
629 | 340 | } | 424 | } |
630 | 341 | } | 425 | } |
631 | @@ -352,10 +436,11 @@ | |||
632 | 352 | height: seeAllLabel.visible ? seeAllLabel.font.pixelSize + units.gu(4) : 0 | 436 | height: seeAllLabel.visible ? seeAllLabel.font.pixelSize + units.gu(4) : 0 |
633 | 353 | 437 | ||
634 | 354 | onClicked: { | 438 | onClicked: { |
637 | 355 | if (categoryView.expandedCategoryItem !== baseItem) { | 439 | if (categoryView.expandedCategoryId !== baseItem.category) { |
638 | 356 | categoryView.expandedCategoryItem = baseItem; | 440 | categoryView.expandedCategoryId = baseItem.category; |
639 | 441 | floatingSeeLess.companionBase = baseItem; | ||
640 | 357 | } else { | 442 | } else { |
642 | 358 | categoryView.expandedCategoryItem = null; | 443 | categoryView.expandedCategoryId = ""; |
643 | 359 | } | 444 | } |
644 | 360 | } | 445 | } |
645 | 361 | 446 | ||
646 | @@ -455,7 +540,7 @@ | |||
647 | 455 | objectName: "floatingSeeLess" | 540 | objectName: "floatingSeeLess" |
648 | 456 | 541 | ||
649 | 457 | property Item companionTo: companionBase ? companionBase.seeAllButton : null | 542 | property Item companionTo: companionBase ? companionBase.seeAllButton : null |
651 | 458 | property Item companionBase: categoryView.expandedCategoryItem | 543 | property Item companionBase: null |
652 | 459 | property bool showBecausePosition: false | 544 | property bool showBecausePosition: false |
653 | 460 | property real yOffset: 0 | 545 | property real yOffset: 0 |
654 | 461 | 546 | ||
655 | @@ -467,7 +552,7 @@ | |||
656 | 467 | height: seeLessLabel.font.pixelSize + units.gu(4) | 552 | height: seeLessLabel.font.pixelSize + units.gu(4) |
657 | 468 | visible: companionTo && showBecausePosition | 553 | visible: companionTo && showBecausePosition |
658 | 469 | 554 | ||
660 | 470 | onClicked: categoryView.expandedCategoryItem = null; | 555 | onClicked: categoryView.expandedCategoryId = ""; |
661 | 471 | 556 | ||
662 | 472 | function updateVisibility() { | 557 | function updateVisibility() { |
663 | 473 | var companionPos = companionTo.mapToItem(floatingSeeLess, 0, 0); | 558 | var companionPos = companionTo.mapToItem(floatingSeeLess, 0, 0); |
664 | @@ -476,6 +561,10 @@ | |||
665 | 476 | var posToBase = floatingSeeLess.mapToItem(companionBase, 0, -yOffset).y; | 561 | var posToBase = floatingSeeLess.mapToItem(companionBase, 0, -yOffset).y; |
666 | 477 | yOffset = Math.max(0, companionBase.item.collapsedHeight - posToBase); | 562 | yOffset = Math.max(0, companionBase.item.collapsedHeight - posToBase); |
667 | 478 | yOffset = Math.min(yOffset, height); | 563 | yOffset = Math.min(yOffset, height); |
668 | 564 | |||
669 | 565 | if (!showBecausePosition && categoryView.expandedCategoryId === "") { | ||
670 | 566 | companionBase = null; | ||
671 | 567 | } | ||
672 | 479 | } | 568 | } |
673 | 480 | 569 | ||
674 | 481 | Label { | 570 | Label { |
675 | 482 | 571 | ||
676 | === modified file 'qml/Dash/ScopeListView.qml' | |||
677 | --- qml/Dash/ScopeListView.qml 2014-07-23 06:54:10 +0000 | |||
678 | +++ qml/Dash/ScopeListView.qml 2014-09-11 16:03:35 +0000 | |||
679 | @@ -20,4 +20,5 @@ | |||
680 | 20 | ListViewWithPageHeader { | 20 | ListViewWithPageHeader { |
681 | 21 | maximumFlickVelocity: height * 10 | 21 | maximumFlickVelocity: height * 10 |
682 | 22 | flickDeceleration: height * 2 | 22 | flickDeceleration: height * 2 |
683 | 23 | cacheBuffer: Number.MAX_VALUE | ||
684 | 23 | } | 24 | } |
685 | 24 | 25 | ||
686 | === modified file 'qml/Dash/ScopesOverviewAll.qml' | |||
687 | --- qml/Dash/ScopesOverviewAll.qml 2014-07-25 08:47:40 +0000 | |||
688 | +++ qml/Dash/ScopesOverviewAll.qml 2014-09-11 16:03:35 +0000 | |||
689 | @@ -43,6 +43,8 @@ | |||
690 | 43 | id: cardGrid | 43 | id: cardGrid |
691 | 44 | width: root.width | 44 | width: root.width |
692 | 45 | height: parent.height | 45 | height: parent.height |
693 | 46 | visibleRangeBegin: root.contentY | ||
694 | 47 | visibleRangeEnd: root.contentY + root.height | ||
695 | 46 | 48 | ||
696 | 47 | onClicked: { | 49 | onClicked: { |
697 | 48 | root.clicked(index, result, item, itemModel); | 50 | root.clicked(index, result, item, itemModel); |
698 | 49 | 51 | ||
699 | === modified file 'qml/Dash/ScopesOverviewFavorites.qml' | |||
700 | --- qml/Dash/ScopesOverviewFavorites.qml 2014-07-30 10:14:35 +0000 | |||
701 | +++ qml/Dash/ScopesOverviewFavorites.qml 2014-09-11 16:03:35 +0000 | |||
702 | @@ -61,7 +61,7 @@ | |||
703 | 61 | item.cardData = Qt.binding(function() { return model; }); | 61 | item.cardData = Qt.binding(function() { return model; }); |
704 | 62 | item.template = Qt.binding(function() { return cardTool.template; }); | 62 | item.template = Qt.binding(function() { return cardTool.template; }); |
705 | 63 | item.components = Qt.binding(function() { return cardTool.components; }); | 63 | item.components = Qt.binding(function() { return cardTool.components; }); |
707 | 64 | item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; }); | 64 | item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; }); |
708 | 65 | } | 65 | } |
709 | 66 | 66 | ||
710 | 67 | Connections { | 67 | Connections { |
711 | 68 | 68 | ||
712 | === modified file 'tests/autopilot/unity8/shell/emulators/dash.py' | |||
713 | --- tests/autopilot/unity8/shell/emulators/dash.py 2014-08-25 16:07:45 +0000 | |||
714 | +++ tests/autopilot/unity8/shell/emulators/dash.py 2014-09-11 16:03:35 +0000 | |||
715 | @@ -93,7 +93,7 @@ | |||
716 | 93 | 'No scope found with id {0}'.format(scope_id)) | 93 | 'No scope found with id {0}'.format(scope_id)) |
717 | 94 | 94 | ||
718 | 95 | def _get_scope_from_loader(self, loader): | 95 | def _get_scope_from_loader(self, loader): |
720 | 96 | return loader.get_children()[0] | 96 | return loader.wait_select_single('GenericScopeView'); |
721 | 97 | 97 | ||
722 | 98 | def _open_scope_scrolling(self, scope_loader): | 98 | def _open_scope_scrolling(self, scope_loader): |
723 | 99 | scroll = self._get_scroll_direction(scope_loader) | 99 | scroll = self._get_scroll_direction(scope_loader) |
724 | @@ -102,8 +102,8 @@ | |||
725 | 102 | scroll() | 102 | scroll() |
726 | 103 | self.dash_content_list.moving.wait_for(False) | 103 | self.dash_content_list.moving.wait_for(False) |
727 | 104 | 104 | ||
728 | 105 | scope_loader.isCurrent.wait_for(True) | ||
729 | 105 | scope = self._get_scope_from_loader(scope_loader) | 106 | scope = self._get_scope_from_loader(scope_loader) |
730 | 106 | scope.isCurrent.wait_for(True) | ||
731 | 107 | return scope | 107 | return scope |
732 | 108 | 108 | ||
733 | 109 | def _get_scroll_direction(self, scope_loader): | 109 | def _get_scroll_direction(self, scope_loader): |
734 | 110 | 110 | ||
735 | === modified file 'tests/mocks/Ubuntu/CMakeLists.txt' | |||
736 | --- tests/mocks/Ubuntu/CMakeLists.txt 2014-08-25 10:05:13 +0000 | |||
737 | +++ tests/mocks/Ubuntu/CMakeLists.txt 2014-09-11 16:03:35 +0000 | |||
738 | @@ -1,3 +1,4 @@ | |||
739 | 1 | add_subdirectory(Connectivity) | ||
740 | 1 | add_subdirectory(DownloadDaemonListener) | 2 | add_subdirectory(DownloadDaemonListener) |
741 | 2 | add_subdirectory(Payments) | 3 | add_subdirectory(Payments) |
742 | 3 | add_subdirectory(SystemImage) | 4 | add_subdirectory(SystemImage) |
743 | 4 | 5 | ||
744 | === added directory 'tests/mocks/Ubuntu/Connectivity' | |||
745 | === added file 'tests/mocks/Ubuntu/Connectivity/CMakeLists.txt' | |||
746 | --- tests/mocks/Ubuntu/Connectivity/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
747 | +++ tests/mocks/Ubuntu/Connectivity/CMakeLists.txt 2014-09-11 16:03:35 +0000 | |||
748 | @@ -0,0 +1,10 @@ | |||
749 | 1 | add_library(connectivity-qml SHARED | ||
750 | 2 | networking-status.cpp | ||
751 | 3 | plugin.cpp | ||
752 | 4 | ) | ||
753 | 5 | qt5_use_modules(connectivity-qml Qml) | ||
754 | 6 | |||
755 | 7 | # copy qmldir file into build directory for shadow builds | ||
756 | 8 | file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" | ||
757 | 9 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR} | ||
758 | 10 | ) | ||
759 | 0 | 11 | ||
760 | === added file 'tests/mocks/Ubuntu/Connectivity/networking-status.cpp' | |||
761 | --- tests/mocks/Ubuntu/Connectivity/networking-status.cpp 1970-01-01 00:00:00 +0000 | |||
762 | +++ tests/mocks/Ubuntu/Connectivity/networking-status.cpp 2014-09-11 16:03:35 +0000 | |||
763 | @@ -0,0 +1,65 @@ | |||
764 | 1 | /* | ||
765 | 2 | * Copyright © 2013 Canonical Ltd. | ||
766 | 3 | * | ||
767 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
768 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
769 | 6 | * as published by the Free Software Foundation. | ||
770 | 7 | * | ||
771 | 8 | * This program is distributed in the hope that it will be useful, | ||
772 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
773 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
774 | 11 | * GNU Lesser General Public License for more details. | ||
775 | 12 | * | ||
776 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
777 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
778 | 15 | * | ||
779 | 16 | * Authors: | ||
780 | 17 | * Antti Kaijanmäki <antti.kaijanmaki@canonical.com> | ||
781 | 18 | */ | ||
782 | 19 | |||
783 | 20 | #include "networking-status.h" | ||
784 | 21 | |||
785 | 22 | NetworkingStatus::NetworkingStatus(QObject *parent) | ||
786 | 23 | : QObject(parent) | ||
787 | 24 | { | ||
788 | 25 | |||
789 | 26 | qRegisterMetaType<NetworkingStatus::Limitations>(); | ||
790 | 27 | qRegisterMetaType<QVector<NetworkingStatus::Limitations>>(); | ||
791 | 28 | qRegisterMetaType<NetworkingStatus::Status>(); | ||
792 | 29 | } | ||
793 | 30 | |||
794 | 31 | NetworkingStatus::~NetworkingStatus() | ||
795 | 32 | {} | ||
796 | 33 | |||
797 | 34 | QVector<NetworkingStatus::Limitations> | ||
798 | 35 | NetworkingStatus::limitations() const | ||
799 | 36 | { | ||
800 | 37 | return m_limitations; | ||
801 | 38 | } | ||
802 | 39 | |||
803 | 40 | NetworkingStatus::Status | ||
804 | 41 | NetworkingStatus::status() const | ||
805 | 42 | { | ||
806 | 43 | return Status::Online; | ||
807 | 44 | } | ||
808 | 45 | |||
809 | 46 | bool | ||
810 | 47 | NetworkingStatus::online() const | ||
811 | 48 | { | ||
812 | 49 | return status() == Status::Online; | ||
813 | 50 | } | ||
814 | 51 | |||
815 | 52 | bool | ||
816 | 53 | NetworkingStatus::limitedBandwith() const | ||
817 | 54 | { | ||
818 | 55 | return limitations().contains(Limitations::Bandwith); | ||
819 | 56 | } | ||
820 | 57 | |||
821 | 58 | void NetworkingStatus::setLimitedBandwidth(bool limited) | ||
822 | 59 | { | ||
823 | 60 | if (limited) { | ||
824 | 61 | m_limitations << Limitations::Bandwith; | ||
825 | 62 | } else if (limitedBandwith()) { | ||
826 | 63 | m_limitations.remove(m_limitations.indexOf(Limitations::Bandwith)); | ||
827 | 64 | } | ||
828 | 65 | } | ||
829 | 0 | 66 | ||
830 | === added file 'tests/mocks/Ubuntu/Connectivity/networking-status.h' | |||
831 | --- tests/mocks/Ubuntu/Connectivity/networking-status.h 1970-01-01 00:00:00 +0000 | |||
832 | +++ tests/mocks/Ubuntu/Connectivity/networking-status.h 2014-09-11 16:03:35 +0000 | |||
833 | @@ -0,0 +1,73 @@ | |||
834 | 1 | /* | ||
835 | 2 | * Copyright © 2014 Canonical Ltd. | ||
836 | 3 | * | ||
837 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
838 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
839 | 6 | * as published by the Free Software Foundation. | ||
840 | 7 | * | ||
841 | 8 | * This program is distributed in the hope that it will be useful, | ||
842 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
843 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
844 | 11 | * GNU Lesser General Public License for more details. | ||
845 | 12 | * | ||
846 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
847 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
848 | 15 | * | ||
849 | 16 | */ | ||
850 | 17 | |||
851 | 18 | #ifndef FAKE_NETWORKING_STATUS_H | ||
852 | 19 | #define FAKE_NETWORKING_STATUS_H | ||
853 | 20 | |||
854 | 21 | #include <QObject> | ||
855 | 22 | #include <QVector> | ||
856 | 23 | |||
857 | 24 | class Q_DECL_EXPORT NetworkingStatus : public QObject | ||
858 | 25 | { | ||
859 | 26 | Q_OBJECT | ||
860 | 27 | Q_DISABLE_COPY(NetworkingStatus) | ||
861 | 28 | |||
862 | 29 | Q_ENUMS(Limitations) | ||
863 | 30 | Q_ENUMS(Status) | ||
864 | 31 | |||
865 | 32 | Q_PROPERTY(QVector<Limitations> limitations READ limitations NOTIFY limitationsChanged) | ||
866 | 33 | Q_PROPERTY(Status status READ status NOTIFY statusChanged) | ||
867 | 34 | Q_PROPERTY(bool online READ online NOTIFY onlineChanged) | ||
868 | 35 | Q_PROPERTY(bool limitedBandwith READ limitedBandwith WRITE setLimitedBandwidth NOTIFY limitedBandwithChanged) | ||
869 | 36 | |||
870 | 37 | public: | ||
871 | 38 | explicit NetworkingStatus(QObject *parent = 0); | ||
872 | 39 | virtual ~NetworkingStatus(); | ||
873 | 40 | |||
874 | 41 | enum Limitations { | ||
875 | 42 | Bandwith | ||
876 | 43 | }; | ||
877 | 44 | |||
878 | 45 | enum Status { | ||
879 | 46 | Offline, | ||
880 | 47 | Connecting, | ||
881 | 48 | Online | ||
882 | 49 | }; | ||
883 | 50 | |||
884 | 51 | QVector<Limitations> limitations() const; | ||
885 | 52 | Status status() const; | ||
886 | 53 | bool online() const; | ||
887 | 54 | bool limitedBandwith() const; | ||
888 | 55 | |||
889 | 56 | // Only in the fake one | ||
890 | 57 | void setLimitedBandwidth(bool limited); | ||
891 | 58 | |||
892 | 59 | Q_SIGNALS: | ||
893 | 60 | void limitationsChanged(); | ||
894 | 61 | void statusChanged(Status value); | ||
895 | 62 | void onlineChanged(bool value); | ||
896 | 63 | void limitedBandwithChanged(bool value); | ||
897 | 64 | |||
898 | 65 | private: | ||
899 | 66 | QVector<NetworkingStatus::Limitations> m_limitations; | ||
900 | 67 | }; | ||
901 | 68 | |||
902 | 69 | Q_DECLARE_METATYPE(NetworkingStatus::Limitations) | ||
903 | 70 | Q_DECLARE_METATYPE(QVector<NetworkingStatus::Limitations>) | ||
904 | 71 | Q_DECLARE_METATYPE(NetworkingStatus::Status) | ||
905 | 72 | |||
906 | 73 | #endif // FAKE_NETWORKING_STATUS_H | ||
907 | 0 | 74 | ||
908 | === added file 'tests/mocks/Ubuntu/Connectivity/plugin.cpp' | |||
909 | --- tests/mocks/Ubuntu/Connectivity/plugin.cpp 1970-01-01 00:00:00 +0000 | |||
910 | +++ tests/mocks/Ubuntu/Connectivity/plugin.cpp 2014-09-11 16:03:35 +0000 | |||
911 | @@ -0,0 +1,46 @@ | |||
912 | 1 | /* | ||
913 | 2 | * Copyright © 2014 Canonical Ltd. | ||
914 | 3 | * | ||
915 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
916 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
917 | 6 | * as published by the Free Software Foundation. | ||
918 | 7 | * | ||
919 | 8 | * This program is distributed in the hope that it will be useful, | ||
920 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
921 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
922 | 11 | * GNU Lesser General Public License for more details. | ||
923 | 12 | * | ||
924 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
925 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
926 | 15 | * | ||
927 | 16 | * Authors: | ||
928 | 17 | * Antti Kaijanmäki <antti.kaijanmaki@canonical.com> | ||
929 | 18 | */ | ||
930 | 19 | |||
931 | 20 | #include "plugin.h" | ||
932 | 21 | |||
933 | 22 | #include <QtQml> | ||
934 | 23 | |||
935 | 24 | #include "networking-status.h" | ||
936 | 25 | |||
937 | 26 | static QObject * | ||
938 | 27 | networkingStatusSingletonProvider(QQmlEngine *engine, QJSEngine *scriptEngine) | ||
939 | 28 | { | ||
940 | 29 | Q_UNUSED(scriptEngine) | ||
941 | 30 | |||
942 | 31 | return new NetworkingStatus(engine); | ||
943 | 32 | } | ||
944 | 33 | |||
945 | 34 | void | ||
946 | 35 | QmlConnectivityNetworkingPlugin::registerTypes(const char *uri) | ||
947 | 36 | { | ||
948 | 37 | // @uri Ubuntu.Connectivity | ||
949 | 38 | qmlRegisterSingletonType<NetworkingStatus>(uri, 1, 0, "NetworkingStatus", networkingStatusSingletonProvider); | ||
950 | 39 | } | ||
951 | 40 | |||
952 | 41 | void | ||
953 | 42 | QmlConnectivityNetworkingPlugin::initializeEngine(QQmlEngine *engine, const char *uri) | ||
954 | 43 | { | ||
955 | 44 | Q_UNUSED(uri); | ||
956 | 45 | Q_UNUSED(engine); | ||
957 | 46 | } | ||
958 | 0 | 47 | ||
959 | === added file 'tests/mocks/Ubuntu/Connectivity/plugin.h' | |||
960 | --- tests/mocks/Ubuntu/Connectivity/plugin.h 1970-01-01 00:00:00 +0000 | |||
961 | +++ tests/mocks/Ubuntu/Connectivity/plugin.h 2014-09-11 16:03:35 +0000 | |||
962 | @@ -0,0 +1,35 @@ | |||
963 | 1 | /* | ||
964 | 2 | * Copyright © 2014 Canonical Ltd. | ||
965 | 3 | * | ||
966 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
967 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
968 | 6 | * as published by the Free Software Foundation. | ||
969 | 7 | * | ||
970 | 8 | * This program is distributed in the hope that it will be useful, | ||
971 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
972 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
973 | 11 | * GNU Lesser General Public License for more details. | ||
974 | 12 | * | ||
975 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
976 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
977 | 15 | * | ||
978 | 16 | * Authors: | ||
979 | 17 | * Antti Kaijanmäki <antti.kaijanmaki@canonical.com> | ||
980 | 18 | */ | ||
981 | 19 | |||
982 | 20 | #ifndef QML_CONNECTIVITY_PLUGIN_H | ||
983 | 21 | #define QML_CONNECTIVITY_PLUGIN_H | ||
984 | 22 | |||
985 | 23 | #include <QQmlExtensionPlugin> | ||
986 | 24 | |||
987 | 25 | class QmlConnectivityNetworkingPlugin : public QQmlExtensionPlugin { | ||
988 | 26 | Q_OBJECT | ||
989 | 27 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") | ||
990 | 28 | Q_INTERFACES(QQmlExtensionInterface) | ||
991 | 29 | |||
992 | 30 | public: | ||
993 | 31 | void registerTypes(const char *uri); | ||
994 | 32 | void initializeEngine(QQmlEngine *engine, const char *uri); | ||
995 | 33 | }; | ||
996 | 34 | |||
997 | 35 | #endif // QML_CONNECTIVITY_PLUGIN_H | ||
998 | 0 | 36 | ||
999 | === added file 'tests/mocks/Ubuntu/Connectivity/qmldir' | |||
1000 | --- tests/mocks/Ubuntu/Connectivity/qmldir 1970-01-01 00:00:00 +0000 | |||
1001 | +++ tests/mocks/Ubuntu/Connectivity/qmldir 2014-09-11 16:03:35 +0000 | |||
1002 | @@ -0,0 +1,2 @@ | |||
1003 | 1 | module Ubuntu.Connectivity | ||
1004 | 2 | plugin connectivity-qml | ||
1005 | 0 | 3 | ||
1006 | === modified file 'tests/mocks/Unity/fake_categories.cpp' | |||
1007 | --- tests/mocks/Unity/fake_categories.cpp 2014-08-15 14:21:42 +0000 | |||
1008 | +++ tests/mocks/Unity/fake_categories.cpp 2014-09-11 16:03:35 +0000 | |||
1009 | @@ -29,25 +29,12 @@ | |||
1010 | 29 | 29 | ||
1011 | 30 | int Categories::rowCount(const QModelIndex& /*parent*/) const | 30 | int Categories::rowCount(const QModelIndex& /*parent*/) const |
1012 | 31 | { | 31 | { |
1014 | 32 | return m_category_count + m_specialCategories.count(); | 32 | return m_category_count; |
1015 | 33 | } | 33 | } |
1016 | 34 | 34 | ||
1018 | 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*/) |
1019 | 36 | { | 36 | { |
1034 | 37 | CategoryData catData; | 37 | qFatal("Using un-implemented Categories::addSpecialCategory"); |
1021 | 38 | catData.categoryId = categoryId; | ||
1022 | 39 | catData.name = name; | ||
1023 | 40 | catData.icon = icon; | ||
1024 | 41 | catData.rawTemplate = rawTemplate; | ||
1025 | 42 | catData.countObject = countObject; | ||
1026 | 43 | |||
1027 | 44 | beginInsertRows(QModelIndex(), 0, 0); | ||
1028 | 45 | m_specialCategories.prepend(catData); | ||
1029 | 46 | endInsertRows(); | ||
1030 | 47 | |||
1031 | 48 | if (countObject) { | ||
1032 | 49 | connect(countObject, SIGNAL(countChanged()), this, SLOT(countChanged())); | ||
1033 | 50 | } | ||
1035 | 51 | } | 38 | } |
1036 | 52 | 39 | ||
1037 | 53 | bool Categories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */) | 40 | bool Categories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */) |
1038 | @@ -55,23 +42,6 @@ | |||
1039 | 55 | qFatal("Using un-implemented Categories::overrideCategoryJson"); | 42 | qFatal("Using un-implemented Categories::overrideCategoryJson"); |
1040 | 56 | } | 43 | } |
1041 | 57 | 44 | ||
1042 | 58 | void Categories::countChanged() | ||
1043 | 59 | { | ||
1044 | 60 | QObject* countObject = sender(); | ||
1045 | 61 | |||
1046 | 62 | for (int i = 0; i < m_specialCategories.count(); ++i) { | ||
1047 | 63 | const CategoryData &catData = m_specialCategories.at(i); | ||
1048 | 64 | if (catData.countObject == countObject) { | ||
1049 | 65 | QVector<int> roles; | ||
1050 | 66 | roles.append(RoleCount); | ||
1051 | 67 | |||
1052 | 68 | QModelIndex changedIndex(index(i)); | ||
1053 | 69 | dataChanged(changedIndex, changedIndex, roles); | ||
1054 | 70 | break; | ||
1055 | 71 | } | ||
1056 | 72 | } | ||
1057 | 73 | } | ||
1058 | 74 | |||
1059 | 75 | QVariant | 45 | QVariant |
1060 | 76 | Categories::data(const QModelIndex& index, int role) const | 46 | Categories::data(const QModelIndex& index, int role) const |
1061 | 77 | { | 47 | { |
1062 | @@ -79,115 +49,74 @@ | |||
1063 | 79 | return QVariant(); | 49 | return QVariant(); |
1064 | 80 | } | 50 | } |
1065 | 81 | 51 | ||
1097 | 82 | ResultsModel *resultsModel = m_resultsModels[index.row()]; | 52 | ResultsModel *resultsModel = resultModel(index.row()); |
1098 | 83 | if (!resultsModel) { | 53 | switch (role) { |
1099 | 84 | resultsModel = new ResultsModel(15, index.row()); | 54 | case RoleCategoryId: |
1100 | 85 | m_resultsModels[index.row()] = resultsModel; | 55 | return QString("%1").arg(index.row()); |
1101 | 86 | } | 56 | case RoleName: |
1102 | 87 | if (index.row() < m_specialCategories.count()) { | 57 | return QString("Category %1").arg(index.row()); |
1103 | 88 | const CategoryData &catData = m_specialCategories.at(index.row()); | 58 | case RoleIcon: |
1104 | 89 | switch (role) { | 59 | return "gtk-apply"; |
1105 | 90 | case RoleCategoryId: | 60 | case RoleRawRendererTemplate: |
1106 | 91 | return catData.categoryId; | 61 | qFatal("Using un-implemented RoleRawRendererTemplate Categories role"); |
1107 | 92 | case RoleName: | 62 | return QVariant(); |
1108 | 93 | return catData.name; | 63 | case RoleRenderer: |
1109 | 94 | case RoleIcon: | 64 | { |
1110 | 95 | return catData.icon; | 65 | QVariantMap map; |
1111 | 96 | case RoleRawRendererTemplate: | 66 | if (index.row() % 2 == 0) { |
1112 | 97 | return catData.rawTemplate; | 67 | map["category-layout"] = "grid"; |
1113 | 98 | case RoleRenderer: | 68 | } else { |
1114 | 99 | { | 69 | map["category-layout"] = "carousel"; |
1115 | 100 | QVariantMap map; | 70 | } |
1116 | 101 | if (index.row() % 2 == 0) { | 71 | if (index.row() == 18) { |
1117 | 102 | map["category-layout"] = "grid"; | 72 | map["category-layout"] = "horizontal-list"; |
1118 | 103 | } else { | 73 | } |
1119 | 104 | map["category-layout"] = "carousel"; | 74 | if (index.row() == 19) { |
1120 | 105 | map["overlay"] = true; | 75 | map["category-layout"] = "grid"; |
1121 | 106 | } | 76 | map["collapsed-rows"] = 0; |
1122 | 107 | map["card-size"] = "small"; | 77 | } |
1123 | 108 | return map; | 78 | map["card-size"] = "small"; |
1124 | 109 | } | 79 | |
1125 | 110 | case RoleComponents: | 80 | map["category-layout"] = m_layouts.value(index.row(), map["category-layout"].toString()); |
1126 | 111 | { | 81 | |
1127 | 112 | QVariantMap map, artMap, attributeMap; | 82 | if (map["category-layout"] == "carousel") { |
1128 | 83 | map["overlay"] = true; | ||
1129 | 84 | } | ||
1130 | 85 | |||
1131 | 86 | return map; | ||
1132 | 87 | } | ||
1133 | 88 | case RoleComponents: | ||
1134 | 89 | { | ||
1135 | 90 | QVariantMap map, artMap, attributeMap; | ||
1136 | 91 | if (index.row() % 2 != 0) { | ||
1137 | 92 | artMap["aspect-ratio"] = QString("1.%1").arg(index.row()); | ||
1138 | 93 | } else { | ||
1139 | 113 | artMap["aspect-ratio"] = "1.0"; | 94 | artMap["aspect-ratio"] = "1.0"; |
1217 | 114 | artMap["field"] = "art"; | 95 | } |
1218 | 115 | map["art"] = artMap; | 96 | artMap["field"] = "art"; |
1219 | 116 | map["title"] = "HOLA"; | 97 | map["art"] = artMap; |
1220 | 117 | attributeMap["field"] = "attribute"; | 98 | map["title"] = "HOLA"; |
1221 | 118 | map["attributes"] = attributeMap; | 99 | map["subtitle"] = "HOLA"; |
1222 | 119 | return map; | 100 | attributeMap["field"] = "attribute"; |
1223 | 120 | } | 101 | map["attributes"] = attributeMap; |
1224 | 121 | case RoleHeaderLink: | 102 | return map; |
1225 | 122 | return QString(); | 103 | } |
1226 | 123 | case RoleResults: | 104 | case RoleHeaderLink: |
1227 | 124 | return QVariant(); | 105 | { |
1228 | 125 | case RoleCount: | 106 | QString res; |
1229 | 126 | return catData.countObject->property("count"); | 107 | if (index.row() == 1 || index.row() == 4) { |
1230 | 127 | default: | 108 | res = QString("scope://query/1"); |
1231 | 128 | qFatal("Using un-implemented Categories role"); | 109 | } |
1232 | 129 | return QVariant(); | 110 | res = m_headerLinks.value(index.row(), res); |
1233 | 130 | } | 111 | return res; |
1234 | 131 | } else { | 112 | } |
1235 | 132 | switch (role) { | 113 | case RoleResults: |
1236 | 133 | case RoleCategoryId: | 114 | return QVariant::fromValue(resultsModel); |
1237 | 134 | return QString("%1").arg(index.row()); | 115 | case RoleCount: |
1238 | 135 | case RoleName: | 116 | return resultsModel->rowCount(); |
1239 | 136 | return QString("Category %1").arg(index.row()); | 117 | default: |
1240 | 137 | case RoleIcon: | 118 | qFatal("Using un-implemented Categories role"); |
1241 | 138 | return "gtk-apply"; | 119 | return QVariant(); |
1165 | 139 | case RoleRawRendererTemplate: | ||
1166 | 140 | qFatal("Using un-implemented RoleRawRendererTemplate Categories role"); | ||
1167 | 141 | return QVariant(); | ||
1168 | 142 | case RoleRenderer: | ||
1169 | 143 | { | ||
1170 | 144 | QVariantMap map; | ||
1171 | 145 | if (index.row() % 2 == 0) { | ||
1172 | 146 | map["category-layout"] = "grid"; | ||
1173 | 147 | } else { | ||
1174 | 148 | map["category-layout"] = "carousel"; | ||
1175 | 149 | map["card-size"] = "medium"; | ||
1176 | 150 | map["overlay"] = true; | ||
1177 | 151 | } | ||
1178 | 152 | if (index.row() == 18) { | ||
1179 | 153 | map["category-layout"] = "horizontal-list"; | ||
1180 | 154 | } | ||
1181 | 155 | if (index.row() == 19) { | ||
1182 | 156 | map["category-layout"] = "grid"; | ||
1183 | 157 | map["collapsed-rows"] = 0; | ||
1184 | 158 | } | ||
1185 | 159 | map["card-size"] = "small"; | ||
1186 | 160 | return map; | ||
1187 | 161 | } | ||
1188 | 162 | case RoleComponents: | ||
1189 | 163 | { | ||
1190 | 164 | QVariantMap map, artMap, attributeMap; | ||
1191 | 165 | if (index.row() % 2 != 0) { | ||
1192 | 166 | artMap["aspect-ratio"] = QString("1.%1").arg(index.row()); | ||
1193 | 167 | } else { | ||
1194 | 168 | artMap["aspect-ratio"] = "1.0"; | ||
1195 | 169 | } | ||
1196 | 170 | artMap["field"] = "art"; | ||
1197 | 171 | map["art"] = artMap; | ||
1198 | 172 | map["title"] = "HOLA"; | ||
1199 | 173 | map["subtitle"] = "HOLA"; | ||
1200 | 174 | attributeMap["field"] = "attribute"; | ||
1201 | 175 | map["attributes"] = attributeMap; | ||
1202 | 176 | return map; | ||
1203 | 177 | } | ||
1204 | 178 | case RoleHeaderLink: | ||
1205 | 179 | if (index.row() == 1 || index.row() == 4) { | ||
1206 | 180 | return QString("scope://query/1"); | ||
1207 | 181 | } | ||
1208 | 182 | return QString(); | ||
1209 | 183 | case RoleResults: | ||
1210 | 184 | return QVariant::fromValue(resultsModel); | ||
1211 | 185 | case RoleCount: | ||
1212 | 186 | return resultsModel->rowCount(); | ||
1213 | 187 | default: | ||
1214 | 188 | qFatal("Using un-implemented Categories role"); | ||
1215 | 189 | return QVariant(); | ||
1216 | 190 | } | ||
1242 | 191 | } | 120 | } |
1243 | 192 | } | 121 | } |
1244 | 193 | 122 | ||
1245 | @@ -196,3 +125,33 @@ | |||
1246 | 196 | { | 125 | { |
1247 | 197 | return data(index(row, 0), role); | 126 | return data(index(row, 0), role); |
1248 | 198 | } | 127 | } |
1249 | 128 | |||
1250 | 129 | void Categories::setCount(int count) | ||
1251 | 130 | { | ||
1252 | 131 | if (m_category_count != count) { | ||
1253 | 132 | beginResetModel(); // This is just for test setup so we can be lazy and reset | ||
1254 | 133 | m_category_count = count; | ||
1255 | 134 | endResetModel(); | ||
1256 | 135 | } | ||
1257 | 136 | } | ||
1258 | 137 | |||
1259 | 138 | ResultsModel* Categories::resultModel(int row) const | ||
1260 | 139 | { | ||
1261 | 140 | ResultsModel *result = m_resultsModels[row]; | ||
1262 | 141 | if (!result) { | ||
1263 | 142 | Categories *that = const_cast<Categories*>(this); | ||
1264 | 143 | result = new ResultsModel(15, row, that); | ||
1265 | 144 | m_resultsModels[row] = result; | ||
1266 | 145 | } | ||
1267 | 146 | return result; | ||
1268 | 147 | } | ||
1269 | 148 | |||
1270 | 149 | void Categories::setLayout(int row, const QString &layout) | ||
1271 | 150 | { | ||
1272 | 151 | m_layouts[row] = layout; | ||
1273 | 152 | } | ||
1274 | 153 | |||
1275 | 154 | void Categories::setHeaderLink(int row, const QString &headerLink) | ||
1276 | 155 | { | ||
1277 | 156 | m_headerLinks[row] = headerLink; | ||
1278 | 157 | } | ||
1279 | 199 | 158 | ||
1280 | === modified file 'tests/mocks/Unity/fake_categories.h' | |||
1281 | --- tests/mocks/Unity/fake_categories.h 2014-07-11 16:39:33 +0000 | |||
1282 | +++ tests/mocks/Unity/fake_categories.h 2014-09-11 16:03:35 +0000 | |||
1283 | @@ -39,22 +39,17 @@ | |||
1284 | 39 | 39 | ||
1285 | 40 | Q_INVOKABLE QVariant data(int row, int role) const; | 40 | Q_INVOKABLE QVariant data(int row, int role) const; |
1286 | 41 | 41 | ||
1289 | 42 | private Q_SLOTS: | 42 | // For testing purposes |
1290 | 43 | void countChanged(); | 43 | Q_INVOKABLE void setCount(int count); |
1291 | 44 | Q_INVOKABLE ResultsModel* resultModel(int row) const; | ||
1292 | 45 | Q_INVOKABLE void setLayout(int row, const QString &layout); | ||
1293 | 46 | Q_INVOKABLE void setHeaderLink(int row, const QString &headerLink); | ||
1294 | 44 | 47 | ||
1295 | 45 | private: | 48 | private: |
1296 | 46 | mutable QHash<int, ResultsModel*> m_resultsModels; | 49 | mutable QHash<int, ResultsModel*> m_resultsModels; |
1297 | 50 | QHash<int, QString> m_layouts; | ||
1298 | 51 | QHash<int, QString> m_headerLinks; | ||
1299 | 47 | int m_category_count; | 52 | int m_category_count; |
1300 | 48 | |||
1301 | 49 | struct CategoryData { | ||
1302 | 50 | QString categoryId; | ||
1303 | 51 | QString name; | ||
1304 | 52 | QString icon; | ||
1305 | 53 | QString rawTemplate; | ||
1306 | 54 | QObject* countObject; | ||
1307 | 55 | }; | ||
1308 | 56 | |||
1309 | 57 | QList<CategoryData> m_specialCategories; | ||
1310 | 58 | }; | 53 | }; |
1311 | 59 | 54 | ||
1312 | 60 | #endif // FAKE_CATEGORIES_H | 55 | #endif // FAKE_CATEGORIES_H |
1313 | 61 | 56 | ||
1314 | === modified file 'tests/mocks/Unity/fake_resultsmodel.cpp' | |||
1315 | --- tests/mocks/Unity/fake_resultsmodel.cpp 2014-08-13 16:06:40 +0000 | |||
1316 | +++ tests/mocks/Unity/fake_resultsmodel.cpp 2014-09-11 16:03:35 +0000 | |||
1317 | @@ -44,6 +44,15 @@ | |||
1318 | 44 | qFatal("Calling un-implemented ResultsModel::setCategoryId"); | 44 | qFatal("Calling un-implemented ResultsModel::setCategoryId"); |
1319 | 45 | } | 45 | } |
1320 | 46 | 46 | ||
1321 | 47 | void ResultsModel::setResultCount(int result_count) | ||
1322 | 48 | { | ||
1323 | 49 | if (m_result_count != result_count) { | ||
1324 | 50 | beginResetModel(); // This is just for test setup so we can be lazy and reset | ||
1325 | 51 | m_result_count = result_count; | ||
1326 | 52 | endResetModel(); | ||
1327 | 53 | } | ||
1328 | 54 | } | ||
1329 | 55 | |||
1330 | 47 | int ResultsModel::rowCount(const QModelIndex& parent) const | 56 | int ResultsModel::rowCount(const QModelIndex& parent) const |
1331 | 48 | { | 57 | { |
1332 | 49 | Q_UNUSED(parent); | 58 | Q_UNUSED(parent); |
1333 | 50 | 59 | ||
1334 | === modified file 'tests/mocks/Unity/fake_resultsmodel.h' | |||
1335 | --- tests/mocks/Unity/fake_resultsmodel.h 2014-08-11 09:57:29 +0000 | |||
1336 | +++ tests/mocks/Unity/fake_resultsmodel.h 2014-09-11 16:03:35 +0000 | |||
1337 | @@ -41,6 +41,9 @@ | |||
1338 | 41 | /* setters */ | 41 | /* setters */ |
1339 | 42 | void setCategoryId(QString const& id) override; | 42 | void setCategoryId(QString const& id) override; |
1340 | 43 | 43 | ||
1341 | 44 | // For testing purposes | ||
1342 | 45 | Q_INVOKABLE void setResultCount(int result_count); | ||
1343 | 46 | |||
1344 | 44 | private: | 47 | private: |
1345 | 45 | int m_result_count; | 48 | int m_result_count; |
1346 | 46 | int m_categoryId; | 49 | int m_categoryId; |
1347 | 47 | 50 | ||
1348 | === modified file 'tests/mocks/Unity/fake_scope.cpp' | |||
1349 | --- tests/mocks/Unity/fake_scope.cpp 2014-08-27 08:01:40 +0000 | |||
1350 | +++ tests/mocks/Unity/fake_scope.cpp 2014-09-11 16:03:35 +0000 | |||
1351 | @@ -145,6 +145,23 @@ | |||
1352 | 145 | Q_EMIT favoriteChanged(); | 145 | Q_EMIT favoriteChanged(); |
1353 | 146 | } | 146 | } |
1354 | 147 | } | 147 | } |
1355 | 148 | |||
1356 | 149 | void Scope::setId(const QString &id) | ||
1357 | 150 | { | ||
1358 | 151 | if (id != m_id) { | ||
1359 | 152 | m_id = id; | ||
1360 | 153 | Q_EMIT idChanged(); | ||
1361 | 154 | } | ||
1362 | 155 | } | ||
1363 | 156 | |||
1364 | 157 | void Scope::setName(const QString &name) | ||
1365 | 158 | { | ||
1366 | 159 | if (name != m_name) { | ||
1367 | 160 | m_name = name; | ||
1368 | 161 | Q_EMIT nameChanged(); | ||
1369 | 162 | } | ||
1370 | 163 | } | ||
1371 | 164 | |||
1372 | 148 | void Scope::setSearchInProgress(const bool inProg) | 165 | void Scope::setSearchInProgress(const bool inProg) |
1373 | 149 | { | 166 | { |
1374 | 150 | if (inProg != m_searching) { | 167 | if (inProg != m_searching) { |
1375 | 151 | 168 | ||
1376 | === modified file 'tests/mocks/Unity/fake_scope.h' | |||
1377 | --- tests/mocks/Unity/fake_scope.h 2014-08-12 12:09:49 +0000 | |||
1378 | +++ tests/mocks/Unity/fake_scope.h 2014-09-11 16:03:35 +0000 | |||
1379 | @@ -56,6 +56,8 @@ | |||
1380 | 56 | void setFormFactor(const QString& form_factor) override; | 56 | void setFormFactor(const QString& form_factor) override; |
1381 | 57 | void setActive(const bool) override; | 57 | void setActive(const bool) override; |
1382 | 58 | void setFavorite(const bool) override; | 58 | void setFavorite(const bool) override; |
1383 | 59 | Q_INVOKABLE void setId(const QString &id); // This is not invokable in the Interface, here for testing benefits | ||
1384 | 60 | Q_INVOKABLE void setName(const QString &name); // This is not invokable in the Interface, here for testing benefits | ||
1385 | 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 |
1386 | 60 | 62 | ||
1387 | 61 | Q_INVOKABLE void activate(QVariant const& result) override; | 63 | Q_INVOKABLE void activate(QVariant const& result) override; |
1388 | 62 | 64 | ||
1389 | === modified file 'tests/plugins/Dash/CMakeLists.txt' | |||
1390 | --- tests/plugins/Dash/CMakeLists.txt 2014-07-22 10:03:37 +0000 | |||
1391 | +++ tests/plugins/Dash/CMakeLists.txt 2014-09-11 16:03:35 +0000 | |||
1392 | @@ -32,7 +32,7 @@ | |||
1393 | 32 | qt5_use_modules(${TESTNAME}TestExec Test Core Qml) | 32 | qt5_use_modules(${TESTNAME}TestExec Test Core Qml) |
1394 | 33 | target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES}) | 33 | target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES}) |
1395 | 34 | 34 | ||
1397 | 35 | add_binary_qml_test(${TESTNAME} "" "Dash-qml") | 35 | add_binary_qml_test(${TESTNAME} "" "Dash-qml" "") |
1398 | 36 | endmacro() | 36 | endmacro() |
1399 | 37 | 37 | ||
1400 | 38 | add_lvwph_test(listviewwithpageheader ListViewWithPageHeader) | 38 | add_lvwph_test(listviewwithpageheader ListViewWithPageHeader) |
1401 | @@ -48,7 +48,7 @@ | |||
1402 | 48 | qt5_use_modules(${TESTNAME}TestExec Test Core Qml) | 48 | qt5_use_modules(${TESTNAME}TestExec Test Core Qml) |
1403 | 49 | target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES}) | 49 | target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES}) |
1404 | 50 | 50 | ||
1406 | 51 | add_binary_qml_test(${TESTNAME} "" "Dash-qml") | 51 | add_binary_qml_test(${TESTNAME} "" "Dash-qml" "") |
1407 | 52 | 52 | ||
1408 | 53 | add_executable(${TESTNAME}tryExec | 53 | add_executable(${TESTNAME}tryExec |
1409 | 54 | ${FILENAME}try.cpp | 54 | ${FILENAME}try.cpp |
1410 | @@ -71,7 +71,7 @@ | |||
1411 | 71 | add_executable(CardCreatorTestExec cardcreatortest.cpp) | 71 | add_executable(CardCreatorTestExec cardcreatortest.cpp) |
1412 | 72 | qt5_use_modules(CardCreatorTestExec Test Core Qml) | 72 | qt5_use_modules(CardCreatorTestExec Test Core Qml) |
1413 | 73 | target_link_libraries(CardCreatorTestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES}) | 73 | target_link_libraries(CardCreatorTestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES}) |
1415 | 74 | add_binary_qml_test(CardCreator "" "Dash-qml") | 74 | add_binary_qml_test(CardCreator "" "Dash-qml" "QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/tests/mocks/") |
1416 | 75 | 75 | ||
1417 | 76 | # plain qml test | 76 | # plain qml test |
1418 | 77 | set(qmltest_DEFAULT_TARGETS qmluitests) | 77 | set(qmltest_DEFAULT_TARGETS qmluitests) |
1419 | 78 | 78 | ||
1420 | === modified file 'tests/plugins/Dash/cardcreator/1.res' | |||
1421 | --- tests/plugins/Dash/cardcreator/1.res 2014-08-13 10:29:21 +0000 | |||
1422 | +++ tests/plugins/Dash/cardcreator/1.res 2014-09-11 16:03:35 +0000 | |||
1423 | @@ -6,7 +6,7 @@ | |||
1424 | 6 | property var artShapeBorderSource: undefined; | 6 | property var artShapeBorderSource: undefined; |
1425 | 7 | property real fontScale: 1.0; | 7 | property real fontScale: 1.0; |
1426 | 8 | property var scopeStyle: null; | 8 | property var scopeStyle: null; |
1428 | 9 | property int headerAlignment: Text.AlignLeft; | 9 | property int titleAlignment: Text.AlignLeft; |
1429 | 10 | property int fixedHeaderHeight: -1; | 10 | property int fixedHeaderHeight: -1; |
1430 | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1431 | 12 | readonly property string title: cardData && cardData["title"] || ""; | 12 | readonly property string title: cardData && cardData["title"] || ""; |
1432 | @@ -46,7 +46,8 @@ | |||
1433 | 46 | } | 46 | } |
1434 | 47 | image: Image { | 47 | image: Image { |
1435 | 48 | objectName: "artImage"; | 48 | objectName: "artImage"; |
1437 | 49 | source: cardData && cardData["art"] || ""; | 49 | property bool doLoadSource: !NetworkingStatus.limitedBandwith; |
1438 | 50 | source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; } | ||
1439 | 50 | cache: true; | 51 | cache: true; |
1440 | 51 | asynchronous: root.asynchronous; | 52 | asynchronous: root.asynchronous; |
1441 | 52 | fillMode: Image.PreserveAspectCrop; | 53 | fillMode: Image.PreserveAspectCrop; |
1442 | @@ -68,13 +69,13 @@ | |||
1443 | 68 | elide: Text.ElideRight; | 69 | elide: Text.ElideRight; |
1444 | 69 | fontSize: "small"; | 70 | fontSize: "small"; |
1445 | 70 | wrapMode: Text.Wrap; | 71 | wrapMode: Text.Wrap; |
1447 | 71 | maximumLineCount: 2; | 72 | maximumLineCount: horizontalAlignment === Text.AlignHCenter ? 1 : 2; |
1448 | 72 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 73 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1449 | 73 | color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText; | 74 | color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText; |
1450 | 74 | visible: showHeader ; | 75 | visible: showHeader ; |
1451 | 75 | text: root.title; | 76 | text: root.title; |
1454 | 76 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | 77 | font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; |
1455 | 77 | horizontalAlignment: root.headerAlignment; | 78 | horizontalAlignment: root.titleAlignment; |
1456 | 78 | } | 79 | } |
1457 | 79 | UbuntuShape { | 80 | UbuntuShape { |
1458 | 80 | id: touchdown; | 81 | id: touchdown; |
1459 | 81 | 82 | ||
1460 | === modified file 'tests/plugins/Dash/cardcreator/2.res' | |||
1461 | --- tests/plugins/Dash/cardcreator/2.res 2014-08-29 08:31:22 +0000 | |||
1462 | +++ tests/plugins/Dash/cardcreator/2.res 2014-09-11 16:03:35 +0000 | |||
1463 | @@ -6,7 +6,7 @@ | |||
1464 | 6 | property var artShapeBorderSource: undefined; | 6 | property var artShapeBorderSource: undefined; |
1465 | 7 | property real fontScale: 1.0; | 7 | property real fontScale: 1.0; |
1466 | 8 | property var scopeStyle: null; | 8 | property var scopeStyle: null; |
1468 | 9 | property int headerAlignment: Text.AlignLeft; | 9 | property int titleAlignment: Text.AlignLeft; |
1469 | 10 | property int fixedHeaderHeight: -1; | 10 | property int fixedHeaderHeight: -1; |
1470 | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1471 | 12 | readonly property string title: cardData && cardData["title"] || ""; | 12 | readonly property string title: cardData && cardData["title"] || ""; |
1472 | @@ -67,7 +67,8 @@ | |||
1473 | 67 | objectName: "mascotImage"; | 67 | objectName: "mascotImage"; |
1474 | 68 | anchors { verticalCenter: parent.verticalCenter; } | 68 | anchors { verticalCenter: parent.verticalCenter; } |
1475 | 69 | readonly property int maxSize: Math.max(width, height) * 4; | 69 | readonly property int maxSize: Math.max(width, height) * 4; |
1477 | 70 | source: cardData && cardData["mascot"] || ""; | 70 | property bool doLoadSource: !NetworkingStatus.limitedBandwith; |
1478 | 71 | source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; } | ||
1479 | 71 | width: units.gu(6); | 72 | width: units.gu(6); |
1480 | 72 | height: units.gu(5.625); | 73 | height: units.gu(5.625); |
1481 | 73 | sourceSize { width: maxSize; height: maxSize } | 74 | sourceSize { width: maxSize; height: maxSize } |
1482 | @@ -92,13 +93,13 @@ | |||
1483 | 92 | elide: Text.ElideRight; | 93 | elide: Text.ElideRight; |
1484 | 93 | fontSize: "small"; | 94 | fontSize: "small"; |
1485 | 94 | wrapMode: Text.Wrap; | 95 | wrapMode: Text.Wrap; |
1487 | 95 | maximumLineCount: 2; | 96 | maximumLineCount: horizontalAlignment === Text.AlignHCenter ? 1 : 2; |
1488 | 96 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 97 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1489 | 97 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); | 98 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); |
1490 | 98 | visible: showHeader ; | 99 | visible: showHeader ; |
1491 | 99 | text: root.title; | 100 | text: root.title; |
1494 | 100 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | 101 | font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; |
1495 | 101 | horizontalAlignment: root.headerAlignment; | 102 | horizontalAlignment: root.titleAlignment; |
1496 | 102 | } | 103 | } |
1497 | 103 | ,Label { | 104 | ,Label { |
1498 | 104 | id: subtitleLabel; | 105 | id: subtitleLabel; |
1499 | @@ -110,13 +111,12 @@ | |||
1500 | 110 | } | 111 | } |
1501 | 111 | anchors.topMargin: units.dp(2); | 112 | anchors.topMargin: units.dp(2); |
1502 | 112 | elide: Text.ElideRight; | 113 | elide: Text.ElideRight; |
1504 | 113 | fontSize: "small"; | 114 | fontSize: "x-small"; |
1505 | 114 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 115 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1506 | 115 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); | 116 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); |
1507 | 116 | visible: titleLabel.visible && titleLabel.text; | 117 | visible: titleLabel.visible && titleLabel.text; |
1508 | 117 | text: cardData && cardData["subtitle"] || ""; | 118 | text: cardData && cardData["subtitle"] || ""; |
1509 | 118 | font.weight: Font.Light; | 119 | font.weight: Font.Light; |
1510 | 119 | horizontalAlignment: root.headerAlignment; | ||
1511 | 120 | } | 120 | } |
1512 | 121 | 121 | ||
1513 | 122 | ] | 122 | ] |
1514 | 123 | 123 | ||
1515 | === modified file 'tests/plugins/Dash/cardcreator/3.res' | |||
1516 | --- tests/plugins/Dash/cardcreator/3.res 2014-08-13 10:29:21 +0000 | |||
1517 | +++ tests/plugins/Dash/cardcreator/3.res 2014-09-11 16:03:35 +0000 | |||
1518 | @@ -6,7 +6,7 @@ | |||
1519 | 6 | property var artShapeBorderSource: undefined; | 6 | property var artShapeBorderSource: undefined; |
1520 | 7 | property real fontScale: 1.0; | 7 | property real fontScale: 1.0; |
1521 | 8 | property var scopeStyle: null; | 8 | property var scopeStyle: null; |
1523 | 9 | property int headerAlignment: Text.AlignLeft; | 9 | property int titleAlignment: Text.AlignLeft; |
1524 | 10 | property int fixedHeaderHeight: -1; | 10 | property int fixedHeaderHeight: -1; |
1525 | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1526 | 12 | readonly property string title: cardData && cardData["title"] || ""; | 12 | readonly property string title: cardData && cardData["title"] || ""; |
1527 | @@ -46,8 +46,9 @@ | |||
1528 | 46 | } | 46 | } |
1529 | 47 | image: Image { | 47 | image: Image { |
1530 | 48 | objectName: "artImage"; | 48 | objectName: "artImage"; |
1533 | 49 | source: cardData && cardData["art"] || ""; | 49 | property bool doLoadSource: !NetworkingStatus.limitedBandwith; |
1534 | 50 | cache: true; | 50 | source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; } |
1535 | 51 | cache: true; | ||
1536 | 51 | asynchronous: root.asynchronous; | 52 | asynchronous: root.asynchronous; |
1537 | 52 | fillMode: Image.PreserveAspectCrop; | 53 | fillMode: Image.PreserveAspectCrop; |
1538 | 53 | width: root.width; | 54 | width: root.width; |
1539 | @@ -68,13 +69,13 @@ | |||
1540 | 68 | elide: Text.ElideRight; | 69 | elide: Text.ElideRight; |
1541 | 69 | fontSize: "small"; | 70 | fontSize: "small"; |
1542 | 70 | wrapMode: Text.Wrap; | 71 | wrapMode: Text.Wrap; |
1544 | 71 | maximumLineCount: 2; | 72 | maximumLineCount: horizontalAlignment === Text.AlignHCenter ? 1 : 2; |
1545 | 72 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 73 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1546 | 73 | color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText; | 74 | color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText; |
1547 | 74 | visible: showHeader ; | 75 | visible: showHeader ; |
1548 | 75 | text: root.title; | 76 | text: root.title; |
1551 | 76 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | 77 | font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; |
1552 | 77 | horizontalAlignment: root.headerAlignment; | 78 | horizontalAlignment: root.titleAlignment; |
1553 | 78 | } | 79 | } |
1554 | 79 | Label { | 80 | Label { |
1555 | 80 | id: subtitleLabel; | 81 | id: subtitleLabel; |
1556 | @@ -86,13 +87,12 @@ | |||
1557 | 86 | } | 87 | } |
1558 | 87 | anchors.topMargin: units.dp(2); | 88 | anchors.topMargin: units.dp(2); |
1559 | 88 | elide: Text.ElideRight; | 89 | elide: Text.ElideRight; |
1561 | 89 | fontSize: "small"; | 90 | fontSize: "x-small"; |
1562 | 90 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 91 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1563 | 91 | color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText; | 92 | color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText; |
1564 | 92 | visible: titleLabel.visible && titleLabel.text; | 93 | visible: titleLabel.visible && titleLabel.text; |
1565 | 93 | text: cardData && cardData["subtitle"] || ""; | 94 | text: cardData && cardData["subtitle"] || ""; |
1566 | 94 | font.weight: Font.Light; | 95 | font.weight: Font.Light; |
1567 | 95 | horizontalAlignment: root.headerAlignment; | ||
1568 | 96 | } | 96 | } |
1569 | 97 | UbuntuShape { | 97 | UbuntuShape { |
1570 | 98 | id: touchdown; | 98 | id: touchdown; |
1571 | 99 | 99 | ||
1572 | === modified file 'tests/plugins/Dash/cardcreator/4.res' | |||
1573 | --- tests/plugins/Dash/cardcreator/4.res 2014-08-13 10:29:21 +0000 | |||
1574 | +++ tests/plugins/Dash/cardcreator/4.res 2014-09-11 16:03:35 +0000 | |||
1575 | @@ -6,7 +6,7 @@ | |||
1576 | 6 | property var artShapeBorderSource: undefined; | 6 | property var artShapeBorderSource: undefined; |
1577 | 7 | property real fontScale: 1.0; | 7 | property real fontScale: 1.0; |
1578 | 8 | property var scopeStyle: null; | 8 | property var scopeStyle: null; |
1580 | 9 | property int headerAlignment: Text.AlignLeft; | 9 | property int titleAlignment: Text.AlignLeft; |
1581 | 10 | property int fixedHeaderHeight: -1; | 10 | property int fixedHeaderHeight: -1; |
1582 | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1583 | 12 | readonly property string title: cardData && cardData["title"] || ""; | 12 | readonly property string title: cardData && cardData["title"] || ""; |
1584 | @@ -46,8 +46,9 @@ | |||
1585 | 46 | objectName: "mascotImage"; | 46 | objectName: "mascotImage"; |
1586 | 47 | anchors { verticalCenter: parent.verticalCenter; } | 47 | anchors { verticalCenter: parent.verticalCenter; } |
1587 | 48 | readonly property int maxSize: Math.max(width, height) * 4; | 48 | readonly property int maxSize: Math.max(width, height) * 4; |
1590 | 49 | source: cardData && cardData["mascot"] || ""; | 49 | property bool doLoadSource: !NetworkingStatus.limitedBandwith; |
1591 | 50 | width: units.gu(6); | 50 | source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; } |
1592 | 51 | width: units.gu(6); | ||
1593 | 51 | height: units.gu(5.625); | 52 | height: units.gu(5.625); |
1594 | 52 | sourceSize { width: maxSize; height: maxSize } | 53 | sourceSize { width: maxSize; height: maxSize } |
1595 | 53 | fillMode: Image.PreserveAspectCrop; | 54 | fillMode: Image.PreserveAspectCrop; |
1596 | @@ -72,13 +73,13 @@ | |||
1597 | 72 | elide: Text.ElideRight; | 73 | elide: Text.ElideRight; |
1598 | 73 | fontSize: "small"; | 74 | fontSize: "small"; |
1599 | 74 | wrapMode: Text.Wrap; | 75 | wrapMode: Text.Wrap; |
1601 | 75 | maximumLineCount: 2; | 76 | maximumLineCount: horizontalAlignment === Text.AlignHCenter ? 1 : 2; |
1602 | 76 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 77 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1603 | 77 | color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText; | 78 | color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText; |
1604 | 78 | visible: showHeader ; | 79 | visible: showHeader ; |
1605 | 79 | text: root.title; | 80 | text: root.title; |
1608 | 80 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | 81 | font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; |
1609 | 81 | horizontalAlignment: root.headerAlignment; | 82 | horizontalAlignment: root.titleAlignment; |
1610 | 82 | } | 83 | } |
1611 | 83 | ,Label { | 84 | ,Label { |
1612 | 84 | id: subtitleLabel; | 85 | id: subtitleLabel; |
1613 | @@ -90,13 +91,12 @@ | |||
1614 | 90 | } | 91 | } |
1615 | 91 | anchors.topMargin: units.dp(2); | 92 | anchors.topMargin: units.dp(2); |
1616 | 92 | elide: Text.ElideRight; | 93 | elide: Text.ElideRight; |
1618 | 93 | fontSize: "small"; | 94 | fontSize: "x-small"; |
1619 | 94 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 95 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1620 | 95 | color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText; | 96 | color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText; |
1621 | 96 | visible: titleLabel.visible && titleLabel.text; | 97 | visible: titleLabel.visible && titleLabel.text; |
1622 | 97 | text: cardData && cardData["subtitle"] || ""; | 98 | text: cardData && cardData["subtitle"] || ""; |
1623 | 98 | font.weight: Font.Light; | 99 | font.weight: Font.Light; |
1624 | 99 | horizontalAlignment: root.headerAlignment; | ||
1625 | 100 | } | 100 | } |
1626 | 101 | ] | 101 | ] |
1627 | 102 | } | 102 | } |
1628 | 103 | 103 | ||
1629 | === modified file 'tests/plugins/Dash/cardcreator/5.res' | |||
1630 | --- tests/plugins/Dash/cardcreator/5.res 2014-08-29 08:31:22 +0000 | |||
1631 | +++ tests/plugins/Dash/cardcreator/5.res 2014-09-11 16:03:35 +0000 | |||
1632 | @@ -6,7 +6,7 @@ | |||
1633 | 6 | property var artShapeBorderSource: undefined; | 6 | property var artShapeBorderSource: undefined; |
1634 | 7 | property real fontScale: 1.0; | 7 | property real fontScale: 1.0; |
1635 | 8 | property var scopeStyle: null; | 8 | property var scopeStyle: null; |
1637 | 9 | property int headerAlignment: Text.AlignLeft; | 9 | property int titleAlignment: Text.AlignLeft; |
1638 | 10 | property int fixedHeaderHeight: -1; | 10 | property int fixedHeaderHeight: -1; |
1639 | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1640 | 12 | readonly property string title: cardData && cardData["title"] || ""; | 12 | readonly property string title: cardData && cardData["title"] || ""; |
1641 | @@ -46,8 +46,9 @@ | |||
1642 | 46 | } | 46 | } |
1643 | 47 | image: Image { | 47 | image: Image { |
1644 | 48 | objectName: "artImage"; | 48 | objectName: "artImage"; |
1647 | 49 | source: cardData && cardData["art"] || ""; | 49 | property bool doLoadSource: !NetworkingStatus.limitedBandwith; |
1648 | 50 | cache: true; | 50 | source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; } |
1649 | 51 | cache: true; | ||
1650 | 51 | asynchronous: root.asynchronous; | 52 | asynchronous: root.asynchronous; |
1651 | 52 | fillMode: Image.PreserveAspectCrop; | 53 | fillMode: Image.PreserveAspectCrop; |
1652 | 53 | width: root.width; | 54 | width: root.width; |
1653 | @@ -112,13 +113,13 @@ | |||
1654 | 112 | elide: Text.ElideRight; | 113 | elide: Text.ElideRight; |
1655 | 113 | fontSize: "small"; | 114 | fontSize: "small"; |
1656 | 114 | wrapMode: Text.Wrap; | 115 | wrapMode: Text.Wrap; |
1658 | 115 | maximumLineCount: 2; | 116 | maximumLineCount: horizontalAlignment === Text.AlignHCenter ? 1 : 2; |
1659 | 116 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 117 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1660 | 117 | color: root.scopeStyle && overlayLoader.item ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item && overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); | 118 | color: root.scopeStyle && overlayLoader.item ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item && overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); |
1661 | 118 | visible: showHeader && overlayLoader.active; | 119 | visible: showHeader && overlayLoader.active; |
1662 | 119 | text: root.title; | 120 | text: root.title; |
1665 | 120 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | 121 | font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; |
1666 | 121 | horizontalAlignment: root.headerAlignment; | 122 | horizontalAlignment: root.titleAlignment; |
1667 | 122 | } | 123 | } |
1668 | 123 | Label { | 124 | Label { |
1669 | 124 | id: subtitleLabel; | 125 | id: subtitleLabel; |
1670 | @@ -131,13 +132,12 @@ | |||
1671 | 131 | } | 132 | } |
1672 | 132 | anchors.topMargin: units.dp(2); | 133 | anchors.topMargin: units.dp(2); |
1673 | 133 | elide: Text.ElideRight; | 134 | elide: Text.ElideRight; |
1675 | 134 | fontSize: "small"; | 135 | fontSize: "x-small"; |
1676 | 135 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 136 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1677 | 136 | color: root.scopeStyle && overlayLoader.item ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item && overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); | 137 | color: root.scopeStyle && overlayLoader.item ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item && overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); |
1678 | 137 | visible: titleLabel.visible && titleLabel.text; | 138 | visible: titleLabel.visible && titleLabel.text; |
1679 | 138 | text: cardData && cardData["subtitle"] || ""; | 139 | text: cardData && cardData["subtitle"] || ""; |
1680 | 139 | font.weight: Font.Light; | 140 | font.weight: Font.Light; |
1681 | 140 | horizontalAlignment: root.headerAlignment; | ||
1682 | 141 | } | 141 | } |
1683 | 142 | UbuntuShape { | 142 | UbuntuShape { |
1684 | 143 | id: touchdown; | 143 | id: touchdown; |
1685 | 144 | 144 | ||
1686 | === modified file 'tests/plugins/Dash/cardcreator/6.res' | |||
1687 | --- tests/plugins/Dash/cardcreator/6.res 2014-08-29 08:31:22 +0000 | |||
1688 | +++ tests/plugins/Dash/cardcreator/6.res 2014-09-11 16:03:35 +0000 | |||
1689 | @@ -6,7 +6,7 @@ | |||
1690 | 6 | property var artShapeBorderSource: undefined; | 6 | property var artShapeBorderSource: undefined; |
1691 | 7 | property real fontScale: 1.0; | 7 | property real fontScale: 1.0; |
1692 | 8 | property var scopeStyle: null; | 8 | property var scopeStyle: null; |
1694 | 9 | property int headerAlignment: Text.AlignLeft; | 9 | property int titleAlignment: Text.AlignLeft; |
1695 | 10 | property int fixedHeaderHeight: -1; | 10 | property int fixedHeaderHeight: -1; |
1696 | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1697 | 12 | readonly property string title: cardData && cardData["title"] || ""; | 12 | readonly property string title: cardData && cardData["title"] || ""; |
1698 | @@ -68,13 +68,13 @@ | |||
1699 | 68 | elide: Text.ElideRight; | 68 | elide: Text.ElideRight; |
1700 | 69 | fontSize: "small"; | 69 | fontSize: "small"; |
1701 | 70 | wrapMode: Text.Wrap; | 70 | wrapMode: Text.Wrap; |
1703 | 71 | maximumLineCount: 2; | 71 | maximumLineCount: horizontalAlignment === Text.AlignHCenter ? 1 : 2; |
1704 | 72 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 72 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1705 | 73 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); | 73 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); |
1706 | 74 | visible: showHeader ; | 74 | visible: showHeader ; |
1707 | 75 | text: root.title; | 75 | text: root.title; |
1710 | 76 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | 76 | font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; |
1711 | 77 | horizontalAlignment: root.headerAlignment; | 77 | horizontalAlignment: root.titleAlignment; |
1712 | 78 | } | 78 | } |
1713 | 79 | ,Label { | 79 | ,Label { |
1714 | 80 | id: subtitleLabel; | 80 | id: subtitleLabel; |
1715 | @@ -86,15 +86,14 @@ | |||
1716 | 86 | } | 86 | } |
1717 | 87 | anchors.topMargin: units.dp(2); | 87 | anchors.topMargin: units.dp(2); |
1718 | 88 | elide: Text.ElideRight; | 88 | elide: Text.ElideRight; |
1720 | 89 | fontSize: "small"; | 89 | fontSize: "x-small"; |
1721 | 90 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 90 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1722 | 91 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); | 91 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); |
1723 | 92 | visible: titleLabel.visible && titleLabel.text; | 92 | visible: titleLabel.visible && titleLabel.text; |
1724 | 93 | text: cardData && cardData["subtitle"] || ""; | 93 | text: cardData && cardData["subtitle"] || ""; |
1725 | 94 | font.weight: Font.Light; | 94 | font.weight: Font.Light; |
1726 | 95 | horizontalAlignment: root.headerAlignment; | ||
1727 | 96 | } | 95 | } |
1729 | 97 | ,Icon { | 96 | ,StatusIcon { |
1730 | 98 | id: emblemIcon; | 97 | id: emblemIcon; |
1731 | 99 | objectName: "emblemIcon"; | 98 | objectName: "emblemIcon"; |
1732 | 100 | anchors { | 99 | anchors { |
1733 | @@ -104,7 +103,6 @@ | |||
1734 | 104 | } | 103 | } |
1735 | 105 | source: cardData && cardData["emblem"] || ""; | 104 | source: cardData && cardData["emblem"] || ""; |
1736 | 106 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); | 105 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); |
1737 | 107 | width: height; | ||
1738 | 108 | height: source != "" ? titleLabel.font.pixelSize : 0; | 106 | height: source != "" ? titleLabel.font.pixelSize : 0; |
1739 | 109 | } | 107 | } |
1740 | 110 | 108 | ||
1741 | 111 | 109 | ||
1742 | === modified file 'tests/plugins/Dash/cardcreator/7.res' | |||
1743 | --- tests/plugins/Dash/cardcreator/7.res 2014-08-29 08:31:22 +0000 | |||
1744 | +++ tests/plugins/Dash/cardcreator/7.res 2014-09-11 16:03:35 +0000 | |||
1745 | @@ -6,7 +6,7 @@ | |||
1746 | 6 | property var artShapeBorderSource: undefined; | 6 | property var artShapeBorderSource: undefined; |
1747 | 7 | property real fontScale: 1.0; | 7 | property real fontScale: 1.0; |
1748 | 8 | property var scopeStyle: null; | 8 | property var scopeStyle: null; |
1750 | 9 | property int headerAlignment: Text.AlignLeft; | 9 | property int titleAlignment: Text.AlignLeft; |
1751 | 10 | property int fixedHeaderHeight: -1; | 10 | property int fixedHeaderHeight: -1; |
1752 | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); | 11 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1753 | 12 | readonly property string title: cardData && cardData["title"] || ""; | 12 | readonly property string title: cardData && cardData["title"] || ""; |
1754 | @@ -67,8 +67,9 @@ | |||
1755 | 67 | objectName: "mascotImage"; | 67 | objectName: "mascotImage"; |
1756 | 68 | anchors { verticalCenter: parent.verticalCenter; } | 68 | anchors { verticalCenter: parent.verticalCenter; } |
1757 | 69 | readonly property int maxSize: Math.max(width, height) * 4; | 69 | readonly property int maxSize: Math.max(width, height) * 4; |
1760 | 70 | source: cardData && cardData["mascot"] || ""; | 70 | property bool doLoadSource: !NetworkingStatus.limitedBandwith; |
1761 | 71 | width: units.gu(6); | 71 | source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; } |
1762 | 72 | width: units.gu(6); | ||
1763 | 72 | height: units.gu(5.625); | 73 | height: units.gu(5.625); |
1764 | 73 | sourceSize { width: maxSize; height: maxSize } | 74 | sourceSize { width: maxSize; height: maxSize } |
1765 | 74 | fillMode: Image.PreserveAspectCrop; | 75 | fillMode: Image.PreserveAspectCrop; |
1766 | @@ -93,13 +94,13 @@ | |||
1767 | 93 | elide: Text.ElideRight; | 94 | elide: Text.ElideRight; |
1768 | 94 | fontSize: "small"; | 95 | fontSize: "small"; |
1769 | 95 | wrapMode: Text.Wrap; | 96 | wrapMode: Text.Wrap; |
1771 | 96 | maximumLineCount: 2; | 97 | maximumLineCount: horizontalAlignment === Text.AlignHCenter ? 1 : 2; |
1772 | 97 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 98 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1773 | 98 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); | 99 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); |
1774 | 99 | visible: showHeader ; | 100 | visible: showHeader ; |
1775 | 100 | text: root.title; | 101 | text: root.title; |
1778 | 101 | font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal; | 102 | font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; |
1779 | 102 | horizontalAlignment: root.headerAlignment; | 103 | horizontalAlignment: root.titleAlignment; |
1780 | 103 | } | 104 | } |
1781 | 104 | ,Label { | 105 | ,Label { |
1782 | 105 | id: subtitleLabel; | 106 | id: subtitleLabel; |
1783 | @@ -111,13 +112,12 @@ | |||
1784 | 111 | } | 112 | } |
1785 | 112 | anchors.topMargin: units.dp(2); | 113 | anchors.topMargin: units.dp(2); |
1786 | 113 | elide: Text.ElideRight; | 114 | elide: Text.ElideRight; |
1788 | 114 | fontSize: "small"; | 115 | fontSize: "x-small"; |
1789 | 115 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); | 116 | font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); |
1790 | 116 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); | 117 | color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white"); |
1791 | 117 | visible: titleLabel.visible && titleLabel.text; | 118 | visible: titleLabel.visible && titleLabel.text; |
1792 | 118 | text: cardData && cardData["subtitle"] || ""; | 119 | text: cardData && cardData["subtitle"] || ""; |
1793 | 119 | font.weight: Font.Light; | 120 | font.weight: Font.Light; |
1794 | 120 | horizontalAlignment: root.headerAlignment; | ||
1795 | 121 | } | 121 | } |
1796 | 122 | ,CardAttributes { | 122 | ,CardAttributes { |
1797 | 123 | id: attributesRow; | 123 | id: attributesRow; |
1798 | 124 | 124 | ||
1799 | === modified file 'tests/plugins/Dash/listviewwithpageheadertest.cpp' | |||
1800 | --- tests/plugins/Dash/listviewwithpageheadertest.cpp 2014-04-24 14:13:21 +0000 | |||
1801 | +++ tests/plugins/Dash/listviewwithpageheadertest.cpp 2014-09-11 16:03:35 +0000 | |||
1802 | @@ -28,6 +28,8 @@ | |||
1803 | 28 | #include <private/qquickitem_p.h> | 28 | #include <private/qquickitem_p.h> |
1804 | 29 | #pragma GCC diagnostic pop | 29 | #pragma GCC diagnostic pop |
1805 | 30 | 30 | ||
1806 | 31 | #include <limits> | ||
1807 | 32 | |||
1808 | 31 | // TODO Think on how doing a test for lost items | 33 | // TODO Think on how doing a test for lost items |
1809 | 32 | // particullary making sure that lost items are culled | 34 | // particullary making sure that lost items are culled |
1810 | 33 | // and then removed in the next updatePolish cycle | 35 | // and then removed in the next updatePolish cycle |
1811 | @@ -1899,6 +1901,43 @@ | |||
1812 | 1899 | QTRY_COMPARE(lvwph->m_firstVisibleIndex, 0); | 1901 | QTRY_COMPARE(lvwph->m_firstVisibleIndex, 0); |
1813 | 1900 | } | 1902 | } |
1814 | 1901 | 1903 | ||
1815 | 1904 | void testNoCacheBuffer() | ||
1816 | 1905 | { | ||
1817 | 1906 | lvwph->setCacheBuffer(0); | ||
1818 | 1907 | QTRY_COMPARE(lvwph->m_visibleItems.count(), 3); | ||
1819 | 1908 | QCOMPARE(lvwph->m_firstVisibleIndex, 0); | ||
1820 | 1909 | verifyItem(0, 50., 150., false); | ||
1821 | 1910 | verifyItem(1, 200., 200., false); | ||
1822 | 1911 | verifyItem(2, 400., 350., false); | ||
1823 | 1912 | QCOMPARE(lvwph->m_minYExtent, 0.); | ||
1824 | 1913 | QCOMPARE(lvwph->m_clipItem->y(), 0.); | ||
1825 | 1914 | QCOMPARE(lvwph->m_clipItem->clip(), false); | ||
1826 | 1915 | QCOMPARE(lvwph->m_headerItem->y(), 0.); | ||
1827 | 1916 | QCOMPARE(lvwph->m_headerItem->height(), 50.); | ||
1828 | 1917 | QCOMPARE(lvwph->contentY(), 0.); | ||
1829 | 1918 | QCOMPARE(lvwph->m_headerItemShownHeight, 0.); | ||
1830 | 1919 | } | ||
1831 | 1920 | |||
1832 | 1921 | void testAllCacheBuffer() | ||
1833 | 1922 | { | ||
1834 | 1923 | lvwph->setCacheBuffer(std::numeric_limits<qreal>::max()); | ||
1835 | 1924 | QTRY_COMPARE(lvwph->m_visibleItems.count(), 6); | ||
1836 | 1925 | QCOMPARE(lvwph->m_firstVisibleIndex, 0); | ||
1837 | 1926 | verifyItem(0, 50., 150., false); | ||
1838 | 1927 | verifyItem(1, 200., 200., false); | ||
1839 | 1928 | verifyItem(2, 400., 350., false); | ||
1840 | 1929 | verifyItem(3, 750., 350., true); | ||
1841 | 1930 | verifyItem(4, 1100., 350., true); | ||
1842 | 1931 | verifyItem(5, 1450., 350., true); | ||
1843 | 1932 | QCOMPARE(lvwph->m_minYExtent, 0.); | ||
1844 | 1933 | QCOMPARE(lvwph->m_clipItem->y(), 0.); | ||
1845 | 1934 | QCOMPARE(lvwph->m_clipItem->clip(), false); | ||
1846 | 1935 | QCOMPARE(lvwph->m_headerItem->y(), 0.); | ||
1847 | 1936 | QCOMPARE(lvwph->m_headerItem->height(), 50.); | ||
1848 | 1937 | QCOMPARE(lvwph->contentY(), 0.); | ||
1849 | 1938 | QCOMPARE(lvwph->m_headerItemShownHeight, 0.); | ||
1850 | 1939 | } | ||
1851 | 1940 | |||
1852 | 1902 | private: | 1941 | private: |
1853 | 1903 | QQuickView *view; | 1942 | QQuickView *view; |
1854 | 1904 | ListViewWithPageHeader *lvwph; | 1943 | ListViewWithPageHeader *lvwph; |
1855 | 1905 | 1944 | ||
1856 | === modified file 'tests/plugins/Dash/listviewwithpageheadertest.qml' | |||
1857 | --- tests/plugins/Dash/listviewwithpageheadertest.qml 2014-04-30 10:06:33 +0000 | |||
1858 | +++ tests/plugins/Dash/listviewwithpageheadertest.qml 2014-09-11 16:03:35 +0000 | |||
1859 | @@ -60,6 +60,7 @@ | |||
1860 | 60 | anchors.top: parent.top | 60 | anchors.top: parent.top |
1861 | 61 | anchors.bottom: parent.bottom | 61 | anchors.bottom: parent.bottom |
1862 | 62 | model: model | 62 | model: model |
1863 | 63 | cacheBuffer: height * 0.5 | ||
1864 | 63 | delegate: Rectangle { | 64 | delegate: Rectangle { |
1865 | 64 | property bool timerDone: false | 65 | property bool timerDone: false |
1866 | 65 | width: parent.width - 20 | 66 | width: parent.width - 20 |
1867 | 66 | 67 | ||
1868 | === modified file 'tests/plugins/Dash/listviewwithpageheadertestsection.qml' | |||
1869 | --- tests/plugins/Dash/listviewwithpageheadertestsection.qml 2014-04-30 10:06:33 +0000 | |||
1870 | +++ tests/plugins/Dash/listviewwithpageheadertestsection.qml 2014-09-11 16:03:35 +0000 | |||
1871 | @@ -60,6 +60,7 @@ | |||
1872 | 60 | anchors.top: parent.top | 60 | anchors.top: parent.top |
1873 | 61 | anchors.bottom: parent.bottom | 61 | anchors.bottom: parent.bottom |
1874 | 62 | model: model | 62 | model: model |
1875 | 63 | cacheBuffer: height * 0.5 | ||
1876 | 63 | delegate: Rectangle { | 64 | delegate: Rectangle { |
1877 | 64 | property bool timerDone: false | 65 | property bool timerDone: false |
1878 | 65 | width: parent.width - 20 | 66 | width: parent.width - 20 |
1879 | 66 | 67 | ||
1880 | === modified file 'tests/plugins/Dash/listviewwithpageheadertestsectionexternalmodel.qml' | |||
1881 | --- tests/plugins/Dash/listviewwithpageheadertestsectionexternalmodel.qml 2014-04-30 10:06:33 +0000 | |||
1882 | +++ tests/plugins/Dash/listviewwithpageheadertestsectionexternalmodel.qml 2014-09-11 16:03:35 +0000 | |||
1883 | @@ -28,6 +28,7 @@ | |||
1884 | 28 | anchors.top: parent.top | 28 | anchors.top: parent.top |
1885 | 29 | anchors.bottom: parent.bottom | 29 | anchors.bottom: parent.bottom |
1886 | 30 | model: model | 30 | model: model |
1887 | 31 | cacheBuffer: height * 0.5 | ||
1888 | 31 | delegate: Rectangle { | 32 | delegate: Rectangle { |
1889 | 32 | property bool timerDone: false | 33 | property bool timerDone: false |
1890 | 33 | width: parent.width - 20 | 34 | width: parent.width - 20 |
1891 | 34 | 35 | ||
1892 | === modified file 'tests/plugins/Ubuntu/Gestures/CMakeLists.txt' | |||
1893 | --- tests/plugins/Ubuntu/Gestures/CMakeLists.txt 2014-05-01 14:25:18 +0000 | |||
1894 | +++ tests/plugins/Ubuntu/Gestures/CMakeLists.txt 2014-09-11 16:03:35 +0000 | |||
1895 | @@ -19,7 +19,7 @@ | |||
1896 | 19 | qt5_use_modules(${CLASSNAME}TestExec Test Core Qml Gui Quick) | 19 | qt5_use_modules(${CLASSNAME}TestExec Test Core Qml Gui Quick) |
1897 | 20 | target_link_libraries(${CLASSNAME}TestExec UbuntuGestureQml) | 20 | target_link_libraries(${CLASSNAME}TestExec UbuntuGestureQml) |
1898 | 21 | 21 | ||
1900 | 22 | add_binary_qml_test(${CLASSNAME} ${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures UbuntuGesturesTestQmlFiles) | 22 | add_binary_qml_test(${CLASSNAME} ${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures UbuntuGesturesTestQmlFiles "") |
1901 | 23 | add_manual_qml_test(. ${CLASSNAME} IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins) | 23 | add_manual_qml_test(. ${CLASSNAME} IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins) |
1902 | 24 | endmacro(add_gesture_ui_test) | 24 | endmacro(add_gesture_ui_test) |
1903 | 25 | 25 | ||
1904 | 26 | 26 | ||
1905 | === modified file 'tests/qmltests/Components/CMakeLists.txt' | |||
1906 | --- tests/qmltests/Components/CMakeLists.txt 2014-05-01 14:25:18 +0000 | |||
1907 | +++ tests/qmltests/Components/CMakeLists.txt 2014-09-11 16:03:35 +0000 | |||
1908 | @@ -10,7 +10,7 @@ | |||
1909 | 10 | qt5_use_modules(DragHandleTestExec Test Core Qml Gui Quick) | 10 | qt5_use_modules(DragHandleTestExec Test Core Qml Gui Quick) |
1910 | 11 | target_link_libraries(DragHandleTestExec UbuntuGestureQml) | 11 | target_link_libraries(DragHandleTestExec UbuntuGestureQml) |
1911 | 12 | 12 | ||
1913 | 13 | add_binary_qml_test(DragHandle ${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures "") | 13 | add_binary_qml_test(DragHandle ${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures "" "") |
1914 | 14 | add_manual_qml_test(. DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins) | 14 | add_manual_qml_test(. DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins) |
1915 | 15 | 15 | ||
1916 | 16 | add_definitions(-DUBUNTU_GESTURES_PLUGIN_DIR="${CMAKE_BINARY_DIR}/plugins") | 16 | add_definitions(-DUBUNTU_GESTURES_PLUGIN_DIR="${CMAKE_BINARY_DIR}/plugins") |
1917 | 17 | 17 | ||
1918 | === modified file 'tests/qmltests/Dash/CardHelpers.js' | |||
1919 | --- tests/qmltests/Dash/CardHelpers.js 2014-08-08 14:56:53 +0000 | |||
1920 | +++ tests/qmltests/Dash/CardHelpers.js 2014-09-11 16:03:35 +0000 | |||
1921 | @@ -16,7 +16,7 @@ | |||
1922 | 16 | 16 | ||
1923 | 17 | .pragma library | 17 | .pragma library |
1924 | 18 | 18 | ||
1926 | 19 | var components = ["title", "art", "subtitle", "mascot", "emblem", "old-price", "price", "alt-price", "rating", "alt-rating", "summary", "attributes", "overlayColor"] | 19 | var components = ["title", "art", "subtitle", "mascot", "emblem", "summary", "attributes", "overlayColor"] |
1927 | 20 | 20 | ||
1928 | 21 | var defaultLayout = ' \ | 21 | var defaultLayout = ' \ |
1929 | 22 | { \ | 22 | { \ |
1930 | @@ -37,17 +37,6 @@ | |||
1931 | 37 | "overlayColor": null, \ | 37 | "overlayColor": null, \ |
1932 | 38 | "mascot": null, \ | 38 | "mascot": null, \ |
1933 | 39 | "emblem": null, \ | 39 | "emblem": null, \ |
1934 | 40 | "old-price": null, \ | ||
1935 | 41 | "price": null, \ | ||
1936 | 42 | "alt-price": null, \ | ||
1937 | 43 | "rating": { \ | ||
1938 | 44 | "type": "stars", \ | ||
1939 | 45 | "range": [0, 5], \ | ||
1940 | 46 | "full": "image://theme/rating-star-full", \ | ||
1941 | 47 | "half": "image://theme/rating-star-half", \ | ||
1942 | 48 | "empty": "image://theme/rating-star-empty" \ | ||
1943 | 49 | }, \ | ||
1944 | 50 | "alt-rating": null, \ | ||
1945 | 51 | "summary": null, \ | 40 | "summary": null, \ |
1946 | 52 | "attributes": { "max-count": 2 } \ | 41 | "attributes": { "max-count": 2 } \ |
1947 | 53 | }, \ | 42 | }, \ |
1948 | 54 | 43 | ||
1949 | === modified file 'tests/qmltests/Dash/tst_Card.qml' | |||
1950 | --- tests/qmltests/Dash/tst_Card.qml 2014-08-22 14:43:02 +0000 | |||
1951 | +++ tests/qmltests/Dash/tst_Card.qml 2014-09-11 16:03:35 +0000 | |||
1952 | @@ -17,6 +17,7 @@ | |||
1953 | 17 | import QtQuick 2.0 | 17 | import QtQuick 2.0 |
1954 | 18 | import QtTest 1.0 | 18 | import QtTest 1.0 |
1955 | 19 | import Ubuntu.Components 0.1 | 19 | import Ubuntu.Components 0.1 |
1956 | 20 | import Ubuntu.Connectivity 1.0 | ||
1957 | 20 | import Unity.Test 0.1 as UT | 21 | import Unity.Test 0.1 as UT |
1958 | 21 | import "../../../qml/Dash" | 22 | import "../../../qml/Dash" |
1959 | 22 | import "CardHelpers.js" as Helpers | 23 | import "CardHelpers.js" as Helpers |
1960 | @@ -566,5 +567,25 @@ | |||
1961 | 566 | verify((card.width - titleToCard.x - titleToCard.width) === units.gu(1)); | 567 | verify((card.width - titleToCard.x - titleToCard.width) === units.gu(1)); |
1962 | 567 | } | 568 | } |
1963 | 568 | } | 569 | } |
1964 | 570 | |||
1965 | 571 | function test_load_images_visibility_network_data() { | ||
1966 | 572 | return [ | ||
1967 | 573 | { tag: "Visible, network", visible: true, limitedBandwith: false }, | ||
1968 | 574 | { tag: "Visible, no network", visible: true, limitedBandwith: true }, | ||
1969 | 575 | { tag: "Not Visible, network", visible: false, limitedBandwith: false }, | ||
1970 | 576 | { tag: "Not Visible, no network", visible: false, limitedBandwith: true } | ||
1971 | 577 | ]; | ||
1972 | 578 | } | ||
1973 | 579 | |||
1974 | 580 | function test_load_images_visibility_network(data) { | ||
1975 | 581 | loader.visible = data.visible; | ||
1976 | 582 | NetworkingStatus.limitedBandwith = data.limitedBandwith; | ||
1977 | 583 | |||
1978 | 584 | selector.selectedIndex = 0; | ||
1979 | 585 | waitForRendering(selector); | ||
1980 | 586 | waitForRendering(card); | ||
1981 | 587 | |||
1982 | 588 | verify(data.visible || !data.limitedBandwith || artImage.source == ""); | ||
1983 | 589 | } | ||
1984 | 569 | } | 590 | } |
1985 | 570 | } | 591 | } |
1986 | 571 | 592 | ||
1987 | === modified file 'tests/qmltests/Dash/tst_CardTool.qml' | |||
1988 | --- tests/qmltests/Dash/tst_CardTool.qml 2014-08-14 23:07:21 +0000 | |||
1989 | +++ tests/qmltests/Dash/tst_CardTool.qml 2014-09-11 16:03:35 +0000 | |||
1990 | @@ -85,8 +85,8 @@ | |||
1991 | 85 | "layout": { "template": { "card-layout": "vertical" }, "components": { "title": "title", "subtitle": "subtitle" } } | 85 | "layout": { "template": { "card-layout": "vertical" }, "components": { "title": "title", "subtitle": "subtitle" } } |
1992 | 86 | }, | 86 | }, |
1993 | 87 | { | 87 | { |
1996 | 88 | "name": "Title, price - horizontal", | 88 | "name": "Title, attributes - horizontal", |
1997 | 89 | "layout": { "template": { "card-layout": "horizontal" }, "components": { "title": "title", "price": "price" } } | 89 | "layout": { "template": { "card-layout": "horizontal" }, "components": { "title": "title", "attributes": "attributes" } } |
1998 | 90 | }, | 90 | }, |
1999 | 91 | ] | 91 | ] |
2000 | 92 | 92 | ||
2001 | @@ -100,6 +100,7 @@ | |||
2002 | 100 | } | 100 | } |
2003 | 101 | 101 | ||
2004 | 102 | Column { | 102 | Column { |
2005 | 103 | id: column | ||
2006 | 103 | width: units.gu(38) | 104 | width: units.gu(38) |
2007 | 104 | anchors { left: parent.left; top: parent.top; margins: units.gu(1) } | 105 | anchors { left: parent.left; top: parent.top; margins: units.gu(1) } |
2008 | 105 | 106 | ||
2009 | @@ -111,7 +112,7 @@ | |||
2010 | 111 | ] | 112 | ] |
2011 | 112 | 113 | ||
2012 | 113 | delegate: Row { | 114 | delegate: Row { |
2014 | 114 | anchors { left: parent.left; right: parent.right; margins: units.gu(3) } | 115 | anchors { left: column.left; right: column.right; margins: units.gu(3) } |
2015 | 115 | 116 | ||
2016 | 116 | Label { | 117 | Label { |
2017 | 117 | height: units.gu(5) | 118 | height: units.gu(5) |
2018 | @@ -315,28 +316,35 @@ | |||
2019 | 315 | } | 316 | } |
2020 | 316 | } | 317 | } |
2021 | 317 | 318 | ||
2023 | 318 | function test_card_header_component_alignment_data() { | 319 | function test_card_title_alignment_data() { |
2024 | 319 | return [ | 320 | return [ |
2034 | 320 | { tag: "Title - vertical", component: "titleLabel", property: "headerAlignment", | 321 | { tag: "Art, header, summary", value: Text.AlignLeft, index: 0 }, |
2035 | 321 | value: Text.AlignHCenter, index: 11, layout_index: 0 }, | 322 | { tag: "Header, summary", value: Text.AlignLeft, index: 1 }, |
2036 | 322 | { tag: "Title - horizontal", component: "titleLabel", property: "headerAlignment", | 323 | { tag: "Art, header", value: Text.AlignLeft, index: 2 }, |
2037 | 323 | value: Text.AlignLeft, index: 12, layout_index: 0}, | 324 | { tag: "Header only", value: Text.AlignLeft, index: 3 }, |
2038 | 324 | { tag: "Title, subtitle - vertical", component: "titleLabel", property: "headerAlignment", | 325 | { tag: "Header title only", value: Text.AlignHCenter, index: 4 }, |
2039 | 325 | value: Text.AlignLeft, index: 13, layout_index: 0}, | 326 | { tag: "Header title and subtitle", value: Text.AlignLeft, index: 5 }, |
2040 | 326 | { tag: "Title, price - horizontal", component: "titleLabel", property: "headerAlignment", | 327 | { tag: "Header title and mascot", value: Text.AlignLeft, index: 6 }, |
2041 | 327 | value: Text.AlignLeft, index: 14, layout_index: 0}, | 328 | { tag: "Art, header, summary - small", value: Text.AlignLeft, index: 7 }, |
2042 | 328 | ] | 329 | { tag: "Art, header, summary - large", value: Text.AlignLeft, index: 8 }, |
2043 | 330 | { tag: "Art, header, summary - horizontal", value: Text.AlignLeft, index: 9 }, | ||
2044 | 331 | { tag: "Art, header - portrait", value: Text.AlignLeft, index: 10 }, | ||
2045 | 332 | { tag: "Title - vertical", value: Text.AlignHCenter, index: 11 }, | ||
2046 | 333 | { tag: "Title - horizontal", value: Text.AlignLeft, index: 12 }, | ||
2047 | 334 | { tag: "Title, subtitle - vertical", value: Text.AlignLeft, index: 13 }, | ||
2048 | 335 | { tag: "Title, attributes - horizontal", value: Text.AlignLeft, index: 14 }, | ||
2049 | 336 | ]; | ||
2050 | 329 | } | 337 | } |
2051 | 330 | 338 | ||
2053 | 331 | function test_card_header_component_alignment(data) { | 339 | function test_card_title_alignment(data) { |
2054 | 332 | selector.selectedIndex = data.index; | 340 | selector.selectedIndex = data.index; |
2062 | 333 | if (data.hasOwnProperty("layout_index")) { | 341 | |
2063 | 334 | layoutSelector.selectedIndex = data.layout_index; | 342 | tryCompare(cardTool, "titleAlignment", Text.AlignLeft); |
2064 | 335 | } | 343 | |
2065 | 336 | 344 | cardTool.components['title'] = { "field": "title", "align": "center" }; | |
2066 | 337 | if (data.hasOwnProperty("property")) { | 345 | cardTool.componentsChanged(); |
2067 | 338 | tryCompare(cardTool, data.property, data.value); | 346 | |
2068 | 339 | } | 347 | tryCompare(cardTool, "titleAlignment", data.value); |
2069 | 340 | } | 348 | } |
2070 | 341 | 349 | ||
2071 | 342 | function test_categoryLayout_data() { | 350 | function test_categoryLayout_data() { |
2072 | 343 | 351 | ||
2073 | === modified file 'tests/qmltests/Dash/tst_Dash.qml' | |||
2074 | --- tests/qmltests/Dash/tst_Dash.qml 2014-09-08 14:14:12 +0000 | |||
2075 | +++ tests/qmltests/Dash/tst_Dash.qml 2014-09-11 16:03:35 +0000 | |||
2076 | @@ -249,8 +249,7 @@ | |||
2077 | 249 | var categoryListView = findChild(dashContentList.currentItem, "categoryListView"); | 249 | var categoryListView = findChild(dashContentList.currentItem, "categoryListView"); |
2078 | 250 | var dashCategory2 = findChild(categoryListView, "dashCategory2"); | 250 | var dashCategory2 = findChild(categoryListView, "dashCategory2"); |
2079 | 251 | tryCompareFunction(function() { | 251 | tryCompareFunction(function() { |
2082 | 252 | var d = findChild(dashCategory2, "delegate2"); | 252 | if (dashCategory2.y < 200) return true; |
2081 | 253 | if (d) return true; | ||
2083 | 254 | categoryListView.contentY += 100; | 253 | categoryListView.contentY += 100; |
2084 | 255 | return false; | 254 | return false; |
2085 | 256 | }, true); | 255 | }, true); |
2086 | 257 | 256 | ||
2087 | === modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml' | |||
2088 | --- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-26 19:25:41 +0000 | |||
2089 | +++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-09-11 16:03:35 +0000 | |||
2090 | @@ -1,5 +1,5 @@ | |||
2091 | 1 | /* | 1 | /* |
2093 | 2 | * Copyright 2013 Canonical Ltd. | 2 | * Copyright 2013, 2014 Canonical Ltd. |
2094 | 3 | * | 3 | * |
2095 | 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 |
2096 | 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 |
2097 | @@ -43,6 +43,10 @@ | |||
2098 | 43 | onLoadedChanged: if (loaded) genericScopeView.scope = scopes.getScope(2); | 43 | onLoadedChanged: if (loaded) genericScopeView.scope = scopes.getScope(2); |
2099 | 44 | } | 44 | } |
2100 | 45 | 45 | ||
2101 | 46 | MockScope { | ||
2102 | 47 | id: mockScope | ||
2103 | 48 | } | ||
2104 | 49 | |||
2105 | 46 | SignalSpy { | 50 | SignalSpy { |
2106 | 47 | id: spy | 51 | id: spy |
2107 | 48 | } | 52 | } |
2108 | @@ -78,18 +82,29 @@ | |||
2109 | 78 | spy.signalName = ""; | 82 | spy.signalName = ""; |
2110 | 79 | } | 83 | } |
2111 | 80 | 84 | ||
2113 | 81 | function scrollToCategory(category) { | 85 | function scrollToCategory(categoryName) { |
2114 | 82 | var categoryListView = findChild(genericScopeView, "categoryListView"); | 86 | var categoryListView = findChild(genericScopeView, "categoryListView"); |
2115 | 83 | tryCompareFunction(function() { | 87 | tryCompareFunction(function() { |
2117 | 84 | if (findChild(genericScopeView, category)) return true; | 88 | var category = findChild(genericScopeView, categoryName); |
2118 | 89 | if (category && category.y > 0 && category.y < genericScopeView.height) return true; | ||
2119 | 85 | mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height, | 90 | mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height, |
2120 | 86 | genericScopeView.width/2, genericScopeView.y) | 91 | genericScopeView.width/2, genericScopeView.y) |
2121 | 87 | tryCompare(categoryListView, "moving", false); | 92 | tryCompare(categoryListView, "moving", false); |
2123 | 88 | return findChild(genericScopeView, category) !== null; | 93 | return false; |
2124 | 89 | }, true); | 94 | }, true); |
2125 | 90 | 95 | ||
2126 | 91 | tryCompareFunction(function() { return findChild(genericScopeView, "delegate0") !== null; }, true); | 96 | tryCompareFunction(function() { return findChild(genericScopeView, "delegate0") !== null; }, true); |
2128 | 92 | return findChild(genericScopeView, category); | 97 | return findChild(genericScopeView, categoryName); |
2129 | 98 | } | ||
2130 | 99 | |||
2131 | 100 | function scrollToEnd() | ||
2132 | 101 | { | ||
2133 | 102 | var categoryListView = findChild(genericScopeView, "categoryListView"); | ||
2134 | 103 | while (!categoryListView.atYEnd) { | ||
2135 | 104 | mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height - units.gu(8), | ||
2136 | 105 | genericScopeView.width/2, genericScopeView.y) | ||
2137 | 106 | tryCompare(categoryListView, "moving", false); | ||
2138 | 107 | } | ||
2139 | 93 | } | 108 | } |
2140 | 94 | 109 | ||
2141 | 95 | function test_isActive() { | 110 | function test_isActive() { |
2142 | @@ -268,7 +283,7 @@ | |||
2143 | 268 | if (category === undefined) category = 0; | 283 | if (category === undefined) category = 0; |
2144 | 269 | if (delegate === undefined) delegate = 0; | 284 | if (delegate === undefined) delegate = 0; |
2145 | 270 | tryCompareFunction(function() { | 285 | tryCompareFunction(function() { |
2147 | 271 | var cardGrid = findChild(genericScopeView, category); | 286 | var cardGrid = findChild(genericScopeView, "dashCategory"+category); |
2148 | 272 | if (cardGrid != null) { | 287 | if (cardGrid != null) { |
2149 | 273 | var tile = findChild(cardGrid, "delegate"+delegate); | 288 | var tile = findChild(cardGrid, "delegate"+delegate); |
2150 | 274 | return tile != null; | 289 | return tile != null; |
2151 | @@ -276,7 +291,7 @@ | |||
2152 | 276 | return false; | 291 | return false; |
2153 | 277 | }, | 292 | }, |
2154 | 278 | true); | 293 | true); |
2156 | 279 | var tile = findChild(findChild(genericScopeView, category), "delegate"+delegate); | 294 | var tile = findChild(findChild(genericScopeView, "dashCategory"+category), "delegate"+delegate); |
2157 | 280 | mouseClick(tile, tile.width / 2, tile.height / 2); | 295 | mouseClick(tile, tile.width / 2, tile.height / 2); |
2158 | 281 | tryCompare(testCase.subPageLoader, "open", true); | 296 | tryCompare(testCase.subPageLoader, "open", true); |
2159 | 282 | tryCompare(testCase.subPageLoader, "x", 0); | 297 | tryCompare(testCase.subPageLoader, "x", 0); |
2160 | @@ -426,6 +441,87 @@ | |||
2161 | 426 | compare(image.source, data.logo, "Title image has the wrong source"); | 441 | compare(image.source, data.logo, "Title image has the wrong source"); |
2162 | 427 | } | 442 | } |
2163 | 428 | 443 | ||
2164 | 444 | function test_seeAllTwoCategoriesScenario1() { | ||
2165 | 445 | mockScope.setId("mockScope"); | ||
2166 | 446 | mockScope.setName("Mock Scope"); | ||
2167 | 447 | mockScope.categories.setCount(2); | ||
2168 | 448 | mockScope.categories.resultModel(0).setResultCount(50); | ||
2169 | 449 | mockScope.categories.resultModel(1).setResultCount(15); | ||
2170 | 450 | mockScope.categories.setLayout(0, "grid"); | ||
2171 | 451 | mockScope.categories.setLayout(1, "grid"); | ||
2172 | 452 | mockScope.categories.setHeaderLink(0, ""); | ||
2173 | 453 | mockScope.categories.setHeaderLink(1, ""); | ||
2174 | 454 | genericScopeView.scope = mockScope; | ||
2175 | 455 | waitForRendering(genericScopeView.categoryView); | ||
2176 | 456 | |||
2177 | 457 | var category0 = findChild(genericScopeView, "dashCategory0") | ||
2178 | 458 | var seeAll0 = findChild(category0, "seeAll") | ||
2179 | 459 | |||
2180 | 460 | waitForRendering(seeAll0); | ||
2181 | 461 | verify(category0.expandable); | ||
2182 | 462 | verify(!category0.expanded); | ||
2183 | 463 | |||
2184 | 464 | mouseClick(seeAll0, seeAll0.width / 2, seeAll0.height / 2); | ||
2185 | 465 | verify(category0.expanded); | ||
2186 | 466 | tryCompare(category0, "height", category0.item.expandedHeight + seeAll0.height); | ||
2187 | 467 | tryCompare(genericScopeView.categoryView, "contentY", units.gu(13.5)); | ||
2188 | 468 | |||
2189 | 469 | scrollToEnd(); | ||
2190 | 470 | |||
2191 | 471 | tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory1") !== null; }, true); | ||
2192 | 472 | var category1 = findChild(genericScopeView, "dashCategory1") | ||
2193 | 473 | var seeAll1 = findChild(category1, "seeAll") | ||
2194 | 474 | verify(category1.expandable); | ||
2195 | 475 | verify(!category1.expanded); | ||
2196 | 476 | |||
2197 | 477 | mouseClick(seeAll1, seeAll1.width / 2, seeAll1.height / 2); | ||
2198 | 478 | verify(!category0.expanded); | ||
2199 | 479 | verify(category1.expanded); | ||
2200 | 480 | tryCompare(category1, "height", category1.item.expandedHeight + seeAll1.height); | ||
2201 | 481 | tryCompareFunction(function() { | ||
2202 | 482 | return genericScopeView.categoryView.contentY + category1.y + category1.height + genericScopeView.categoryView.pageHeader.height | ||
2203 | 483 | == genericScopeView.categoryView.contentHeight;} | ||
2204 | 484 | , true); | ||
2205 | 485 | } | ||
2206 | 486 | |||
2207 | 487 | function test_seeAllTwoCategoriesScenario2() { | ||
2208 | 488 | mockScope.setId("mockScope"); | ||
2209 | 489 | mockScope.setName("Mock Scope"); | ||
2210 | 490 | mockScope.categories.setCount(2); | ||
2211 | 491 | mockScope.categories.resultModel(0).setResultCount(15); | ||
2212 | 492 | mockScope.categories.resultModel(1).setResultCount(50); | ||
2213 | 493 | mockScope.categories.setLayout(0, "grid"); | ||
2214 | 494 | mockScope.categories.setLayout(1, "grid"); | ||
2215 | 495 | mockScope.categories.setHeaderLink(0, ""); | ||
2216 | 496 | mockScope.categories.setHeaderLink(1, ""); | ||
2217 | 497 | genericScopeView.scope = mockScope; | ||
2218 | 498 | waitForRendering(genericScopeView.categoryView); | ||
2219 | 499 | |||
2220 | 500 | var category0 = findChild(genericScopeView, "dashCategory0") | ||
2221 | 501 | var seeAll0 = findChild(category0, "seeAll") | ||
2222 | 502 | |||
2223 | 503 | waitForRendering(seeAll0); | ||
2224 | 504 | verify(category0.expandable); | ||
2225 | 505 | verify(!category0.expanded); | ||
2226 | 506 | |||
2227 | 507 | mouseClick(seeAll0, seeAll0.width / 2, seeAll0.height / 2); | ||
2228 | 508 | verify(category0.expanded); | ||
2229 | 509 | tryCompare(category0, "height", category0.item.expandedHeight + seeAll0.height); | ||
2230 | 510 | |||
2231 | 511 | scrollToEnd(); | ||
2232 | 512 | |||
2233 | 513 | var category1 = findChild(genericScopeView, "dashCategory1") | ||
2234 | 514 | var seeAll1 = findChild(category1, "seeAll") | ||
2235 | 515 | verify(category1.expandable); | ||
2236 | 516 | verify(!category1.expanded); | ||
2237 | 517 | |||
2238 | 518 | mouseClick(seeAll1, seeAll1.width / 2, seeAll1.height / 2); | ||
2239 | 519 | verify(!category0.expanded); | ||
2240 | 520 | verify(category1.expanded); | ||
2241 | 521 | tryCompare(category1, "height", category1.item.expandedHeight + seeAll1.height); | ||
2242 | 522 | tryCompare(category1, "y", units.gu(5)); | ||
2243 | 523 | } | ||
2244 | 524 | |||
2245 | 429 | function test_favorite_data() { | 525 | function test_favorite_data() { |
2246 | 430 | return [ | 526 | return [ |
2247 | 431 | { tag: "People", id: "MockScope1", favorite: true }, | 527 | { tag: "People", id: "MockScope1", favorite: true }, |
FAILED: Continuous integration, rev:1233 jenkins. qa.ubuntu. com/job/ unity8- ci/4241/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/4474 jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- utopic/ 1242 jenkins. qa.ubuntu. com/job/ unity8- utopic- amd64-ci/ 1335 jenkins. qa.ubuntu. com/job/ unity8- utopic- i386-ci/ 1335 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- mako/4248 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/5726 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/5726/ artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 12680
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: s-jenkins. ubuntu- ci:8080/ job/unity8- ci/4241/ rebuild
http://