Merge lp:~aacid/unity8/scopes_more_things_on_memory into lp:unity8

Proposed by Albert Astals Cid
Status: Superseded
Proposed branch: lp:~aacid/unity8/scopes_more_things_on_memory
Merge into: lp:unity8
Diff against target: 986 lines (+404/-49)
37 files modified
build.sh (+1/-0)
cmake/modules/QmlTest.cmake (+2/-1)
debian/control (+1/-0)
plugins/Dash/CardCreator.js (+5/-2)
plugins/Dash/listviewwithpageheader.cpp (+18/-7)
plugins/Dash/listviewwithpageheader.h (+6/-0)
qml/Dash/CardGrid.qml (+1/-0)
qml/Dash/CardVerticalJournal.qml (+1/-0)
qml/Dash/DashContent.qml (+1/-0)
qml/Dash/DashRenderer.qml (+4/-0)
qml/Dash/GenericScopeView.qml (+35/-14)
qml/Dash/ScopeListView.qml (+1/-0)
qml/Dash/ScopesOverviewAll.qml (+2/-0)
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/plugins/Dash/CMakeLists.txt (+3/-3)
tests/plugins/Dash/cardcreator/1.res (+2/-1)
tests/plugins/Dash/cardcreator/2.res (+2/-1)
tests/plugins/Dash/cardcreator/3.res (+3/-2)
tests/plugins/Dash/cardcreator/4.res (+3/-2)
tests/plugins/Dash/cardcreator/5.res (+3/-2)
tests/plugins/Dash/cardcreator/7.res (+3/-2)
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/tst_Card.qml (+21/-0)
tests/qmltests/Dash/tst_Dash.qml (+1/-2)
tests/qmltests/Dash/tst_GenericScopeView.qml (+7/-6)
To merge this branch: bzr merge lp:~aacid/unity8/scopes_more_things_on_memory
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity Team Pending
Review via email: mp+232185@code.launchpad.net

This proposal has been superseded by a proposal from 2014-09-04.

Commit message

Use some more memory for scopes

 * Keep all the categories around
 * For the current scope, have all the delegates

Description of the change

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

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

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

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

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

To post a comment you must log in.
1205. By Albert Astals Cid

lesschanges

1206. By Albert Astals Cid

"Remove unused hasAttributes variable" doesn't belong to this branch, revert

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1207. By Albert Astals Cid

Sent the visible range so that even if we set a huge displayMargin for current view, the views are only created, not marked as visible

1208. By Albert Astals Cid

Only set the source of the images once it is visible

Saves data

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1209. By Albert Astals Cid

Merge

1210. By Albert Astals Cid

Only default to not loading images if we're on limited bandwidth

1211. By Albert Astals Cid

Implement visibleRangeBegin in ScopesOverviewAll

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1212. By Albert Astals Cid

Fix test

1213. By Albert Astals Cid

Adapt to test changes

1214. By Albert Astals Cid

adapt card creator tests yet again

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1215. By Albert Astals Cid

Merge

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1216. By Albert Astals Cid

Merge

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1217. By Albert Astals Cid

Do not update ranges of GSV if it's being moved around by its parent

It will cause unnecessary stuttering in those animations

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1218. By Albert Astals Cid

more wait and not direct access

1219. By Albert Astals Cid

Saviq suggestions

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1220. By Albert Astals Cid

Fix syntax

1221. By Albert Astals Cid

Add Ubuntu.Connectivity mock

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1222. By Albert Astals Cid

test the visible+network code for card images

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1223. By Albert Astals Cid

kill the evil multiple lines at end of file

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'build.sh'
2--- build.sh 2014-08-14 13:37:22 +0000
3+++ build.sh 2014-09-01 11:24:24 +0000
4@@ -51,6 +51,7 @@
5 qtdeclarative5-ubuntu-settings-components \
6 qtdeclarative5-ubuntu-telephony0.1 \
7 qtdeclarative5-ubuntu-thumbnailer0.1 \
8+ qml-module-ubuntu-connectivity \
9 unity-notifications-impl \
10 ubuntu-mobile-icons \
11 unity-scope-home \
12
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-01 11:24:24 +0000
16@@ -131,7 +131,7 @@
17 add_manual_qml_test(${SUBPATH} ${COMPONENT_NAME} ${ARGN})
18 endmacro(add_qml_test_internal)
19
20-macro(add_binary_qml_test CLASS_NAME LD_PATH DEPS)
21+macro(add_binary_qml_test CLASS_NAME LD_PATH DEPS ENVVAR)
22 set(testCommand
23 LD_LIBRARY_PATH=${LD_PATH}
24 ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec
25@@ -148,6 +148,7 @@
26 endif()
27 set(xvfbtestCommand
28 ${LD_PRELOAD_PATH}
29+ ${ENVVAR}
30 LD_LIBRARY_PATH=${LD_PATH}
31 xvfb-run --server-args "-screen 0 1024x768x24" --auto-servernum
32 ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec
33
34=== modified file 'debian/control'
35--- debian/control 2014-08-28 20:06:04 +0000
36+++ debian/control 2014-09-01 11:24:24 +0000
37@@ -173,6 +173,7 @@
38 libhardware2,
39 libunity-core-6.0-9,
40 pay-service,
41+ qml-module-ubuntu-connectivity,
42 ${misc:Depends},
43 ${shlibs:Depends},
44 Provides: unity-launcher-impl,
45
46=== modified file 'plugins/Dash/CardCreator.js'
47--- plugins/Dash/CardCreator.js 2014-08-27 15:34:00 +0000
48+++ plugins/Dash/CardCreator.js 2014-09-01 11:24:24 +0000
49@@ -84,7 +84,8 @@
50 } \n\
51 image: Image { \n\
52 objectName: "artImage"; \n\
53- source: cardData && cardData["art"] || ""; \n\
54+ property bool doLoadSource: !NetworkingStatus.limitedBandwith; \n\
55+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; } \n\
56 cache: true; \n\
57 asynchronous: root.asynchronous; \n\
58 fillMode: Image.PreserveAspectCrop; \n\
59@@ -195,7 +196,8 @@
60 objectName: "mascotImage"; \n\
61 anchors { %1 } \n\
62 readonly property int maxSize: Math.max(width, height) * 4; \n\
63- source: cardData && cardData["mascot"] || ""; \n\
64+ property bool doLoadSource: !NetworkingStatus.limitedBandwith; \n\
65+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; } \n\
66 width: units.gu(6); \n\
67 height: units.gu(5.625); \n\
68 sourceSize { width: maxSize; height: maxSize } \n\
69@@ -655,6 +657,7 @@
70 function createCardComponent(parent, template, components) {
71 var imports = 'import QtQuick 2.2; \n\
72 import Ubuntu.Components 1.1; \n\
73+ import Ubuntu.Connectivity 1.0; \n\
74 import Dash 0.1;\n\
75 import Utils 0.1;\n';
76 var card = cardString(template, components);
77
78=== modified file 'plugins/Dash/listviewwithpageheader.cpp'
79--- plugins/Dash/listviewwithpageheader.cpp 2014-08-08 08:47:36 +0000
80+++ plugins/Dash/listviewwithpageheader.cpp 2014-09-01 11:24:24 +0000
81@@ -104,8 +104,6 @@
82 #pragma GCC diagnostic pop
83 // #include <private/qquickrectangle_p.h>
84
85-static const qreal bufferRatio = 0.5;
86-
87 qreal ListViewWithPageHeader::ListItem::height() const
88 {
89 return m_item->height() + (m_sectionItem ? m_sectionItem->height() : 0);
90@@ -158,6 +156,7 @@
91 , m_forceNoClip(false)
92 , m_inLayout(false)
93 , m_inContentHeightKeepHeaderShown(false)
94+ , m_cacheBuffer(0)
95 {
96 m_clipItem = new QQuickItem(contentItem());
97 // m_clipItem = new QQuickRectangle(contentItem());
98@@ -335,6 +334,20 @@
99 return m_headerItemShownHeight;
100 }
101
102+qreal ListViewWithPageHeader::cacheBuffer() const
103+{
104+ return m_cacheBuffer;
105+}
106+
107+void ListViewWithPageHeader::setCacheBuffer(qreal cacheBuffer)
108+{
109+ if (cacheBuffer != m_cacheBuffer) {
110+ m_cacheBuffer = cacheBuffer;
111+ Q_EMIT cacheBufferChanged();
112+ polish();
113+ }
114+}
115+
116 void ListViewWithPageHeader::positionAtBeginning()
117 {
118 if (m_delegateModel->count() <= 0)
119@@ -356,8 +369,7 @@
120 // Create the subsequent items
121 int modelIndex = 1;
122 qreal pos = item->y() + item->height();
123- const qreal buffer = height() * bufferRatio;
124- const qreal bufferTo = height() + buffer;
125+ const qreal bufferTo = height() + m_cacheBuffer;
126 while (modelIndex < m_delegateModel->count() && pos <= bufferTo) {
127 if (!(item = createItem(modelIndex, false)))
128 break;
129@@ -593,11 +605,10 @@
130 return;
131 }
132
133- const qreal buffer = height() * bufferRatio;
134 const qreal from = contentY();
135 const qreal to = from + height();
136- const qreal bufferFrom = from - buffer;
137- const qreal bufferTo = to + buffer;
138+ const qreal bufferFrom = from - m_cacheBuffer;
139+ const qreal bufferTo = to + m_cacheBuffer;
140
141 bool added = addVisibleItems(from, to, false);
142 bool removed = removeNonVisibleItems(bufferFrom, bufferTo);
143
144=== modified file 'plugins/Dash/listviewwithpageheader.h'
145--- plugins/Dash/listviewwithpageheader.h 2014-08-08 08:47:36 +0000
146+++ plugins/Dash/listviewwithpageheader.h 2014-09-01 11:24:24 +0000
147@@ -54,6 +54,7 @@
148 Q_PROPERTY(bool forceNoClip READ forceNoClip WRITE setForceNoClip NOTIFY forceNoClipChanged)
149 Q_PROPERTY(int stickyHeaderHeight READ stickyHeaderHeight NOTIFY stickyHeaderHeightChanged)
150 Q_PROPERTY(qreal headerItemShownHeight READ headerItemShownHeight NOTIFY headerItemShownHeightChanged)
151+ Q_PROPERTY(qreal cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged)
152
153 friend class ListViewWithPageHeaderTest;
154 friend class ListViewWithPageHeaderTestSection;
155@@ -84,6 +85,9 @@
156 int stickyHeaderHeight() const;
157 qreal headerItemShownHeight() const;
158
159+ qreal cacheBuffer() const;
160+ void setCacheBuffer(qreal cacheBuffer);
161+
162 Q_INVOKABLE void positionAtBeginning();
163 Q_INVOKABLE void showHeader();
164 Q_INVOKABLE QQuickItem *item(int modelIndex) const;
165@@ -103,6 +107,7 @@
166 void forceNoClipChanged();
167 void stickyHeaderHeightChanged();
168 void headerItemShownHeightChanged();
169+ void cacheBufferChanged();
170
171 protected:
172 void componentComplete() override;
173@@ -197,6 +202,7 @@
174 bool m_forceNoClip;
175 bool m_inLayout;
176 bool m_inContentHeightKeepHeaderShown;
177+ qreal m_cacheBuffer;
178
179 // Qt 5.0 doesn't like releasing the items just after itemCreated
180 // so we delay the releasing until the next updatePolish
181
182=== modified file 'qml/Dash/CardGrid.qml'
183--- qml/Dash/CardGrid.qml 2014-07-29 08:57:29 +0000
184+++ qml/Dash/CardGrid.qml 2014-09-01 11:24:24 +0000
185@@ -55,6 +55,7 @@
186 delegate: Item {
187 width: grid.cellWidth
188 height: grid.cellHeight
189+ visible: y + height >= root.visibleRangeBegin && y <= root.visibleRangeEnd
190 Loader {
191 id: loader
192 sourceComponent: cardTool.cardComponent
193
194=== modified file 'qml/Dash/CardVerticalJournal.qml'
195--- qml/Dash/CardVerticalJournal.qml 2014-07-29 08:57:29 +0000
196+++ qml/Dash/CardVerticalJournal.qml 2014-09-01 11:24:24 +0000
197@@ -49,6 +49,7 @@
198 id: loader
199 sourceComponent: cardTool.cardComponent
200 width: cardTool.cardWidth
201+ visible: y + height >= root.visibleRangeBegin && y <= root.visibleRangeEnd
202 onLoaded: {
203 item.objectName = "delegate" + index;
204 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
205
206=== modified file 'qml/Dash/DashContent.qml'
207--- qml/Dash/DashContent.qml 2014-08-27 15:35:52 +0000
208+++ qml/Dash/DashContent.qml 2014-09-01 11:24:24 +0000
209@@ -177,6 +177,7 @@
210 dashContent.scopeLoaded(item.scope.id)
211 item.paginationCount = Qt.binding(function() { return dashContentList.count } )
212 item.paginationIndex = Qt.binding(function() { return dashContentList.currentIndex } )
213+ item.holdingList = dashContentList;
214 }
215 Connections {
216 target: isCurrent ? scope : null
217
218=== modified file 'qml/Dash/DashRenderer.qml'
219--- qml/Dash/DashRenderer.qml 2014-07-29 08:57:29 +0000
220+++ qml/Dash/DashRenderer.qml 2014-09-01 11:24:24 +0000
221@@ -27,6 +27,10 @@
222
223 property int displayMarginEnd: 0
224
225+ property int visibleRangeBegin: 0
226+
227+ property int visibleRangeEnd: 0
228+
229 property real originY: 0
230
231 // The model to renderer
232
233=== modified file 'qml/Dash/GenericScopeView.qml'
234--- qml/Dash/GenericScopeView.qml 2014-08-27 15:35:40 +0000
235+++ qml/Dash/GenericScopeView.qml 2014-09-01 11:24:24 +0000
236@@ -38,6 +38,7 @@
237 property int paginationCount: 0
238 property int paginationIndex: 0
239 property alias pageHeaderTotallyVisible: categoryView.pageHeaderTotallyVisible
240+ property var holdingList: null
241
242 property var scopeStyle: ScopeStyle {
243 style: scope ? scope.customizations : {}
244@@ -200,8 +201,8 @@
245 }
246 }
247
248- onHeightChanged: rendererLoader.updateDelegateCreationRange();
249- onYChanged: rendererLoader.updateDelegateCreationRange();
250+ onHeightChanged: rendererLoader.updateRanges();
251+ onYChanged: rendererLoader.updateRanges();
252
253 Loader {
254 id: rendererLoader
255@@ -249,7 +250,7 @@
256 var shouldExpand = baseItem === categoryView.expandedCategoryItem;
257 baseItem.expand(shouldExpand, false /*animate*/);
258 }
259- updateDelegateCreationRange();
260+ updateRanges();
261 if (scope && scope.id === "clickscope" && (categoryId === "predefined" || categoryId === "local")) {
262 // Yeah, hackish :/
263 cardTool.artShapeSize = Qt.size(units.gu(8), units.gu(7.5));
264@@ -304,13 +305,25 @@
265 }
266 }
267 }
268- onOriginYChanged: rendererLoader.updateDelegateCreationRange();
269- onContentYChanged: rendererLoader.updateDelegateCreationRange();
270- onHeightChanged: rendererLoader.updateDelegateCreationRange();
271- onContentHeightChanged: rendererLoader.updateDelegateCreationRange();
272- }
273-
274- function updateDelegateCreationRange() {
275+ onOriginYChanged: rendererLoader.updateRanges();
276+ onContentYChanged: rendererLoader.updateRanges();
277+ onHeightChanged: rendererLoader.updateRanges();
278+ onContentHeightChanged: rendererLoader.updateRanges();
279+ }
280+ Connections {
281+ target: scopeView
282+ onIsCurrentChanged: rendererLoader.updateRanges();
283+ }
284+ Connections {
285+ target: holdingList
286+ onMovingChanged: if (!moving) rendererLoader.updateRanges();
287+ }
288+
289+ function updateRanges() {
290+ if (holdingList && holdingList.moving) {
291+ return;
292+ }
293+
294 if (categoryView.moving) {
295 // Do not update the range if we are overshooting up or down, since we'll come back
296 // to the stable position and delete/create items without any reason
297@@ -322,10 +335,18 @@
298 }
299 }
300
301+ if (item && item.hasOwnProperty("visibleRangeBegin")) {
302+ item.visibleRangeBegin = Math.max(-baseItem.y, 0)
303+ item.visibleRangeEnd = item.visibleRangeBegin + Math.min(categoryView.height, rendererLoader.height)
304+ }
305+
306 if (item && item.hasOwnProperty("displayMarginBeginning")) {
307 // TODO do we need item.originY here, test 1300302 once we have a silo
308 // and we can run it on the phone
309- if (baseItem.y + baseItem.height <= 0) {
310+ if (scopeView.isCurrent) {
311+ item.displayMarginBeginning = 1073741823;
312+ item.displayMarginEnd = 1073741823;
313+ } else if (baseItem.y + baseItem.height <= 0) {
314 // Not visible (item at top of the list viewport)
315 item.displayMarginBeginning = -baseItem.height;
316 item.displayMarginEnd = 0;
317@@ -334,9 +355,9 @@
318 item.displayMarginBeginning = 0;
319 item.displayMarginEnd = -baseItem.height;
320 } else {
321- item.displayMarginBeginning = -Math.max(-baseItem.y, 0);
322- item.displayMarginEnd = -Math.max(baseItem.height - seeAll.height
323- - categoryView.height + baseItem.y, 0)
324+ item.displayMarginBeginning = Math.round(-Math.max(-baseItem.y, 0));
325+ item.displayMarginEnd = -Math.round(Math.max(baseItem.height - seeAll.height
326+ - categoryView.height + baseItem.y, 0));
327 }
328 }
329 }
330
331=== modified file 'qml/Dash/ScopeListView.qml'
332--- qml/Dash/ScopeListView.qml 2014-07-23 06:54:10 +0000
333+++ qml/Dash/ScopeListView.qml 2014-09-01 11:24:24 +0000
334@@ -20,4 +20,5 @@
335 ListViewWithPageHeader {
336 maximumFlickVelocity: height * 10
337 flickDeceleration: height * 2
338+ cacheBuffer: Number.MAX_VALUE
339 }
340
341=== modified file 'qml/Dash/ScopesOverviewAll.qml'
342--- qml/Dash/ScopesOverviewAll.qml 2014-07-25 08:47:40 +0000
343+++ qml/Dash/ScopesOverviewAll.qml 2014-09-01 11:24:24 +0000
344@@ -43,6 +43,8 @@
345 id: cardGrid
346 width: root.width
347 height: parent.height
348+ visibleRangeBegin: root.contentY
349+ visibleRangeEnd: root.contentY + root.height
350
351 onClicked: {
352 root.clicked(index, result, item, itemModel);
353
354=== modified file 'tests/autopilot/unity8/shell/emulators/dash.py'
355--- tests/autopilot/unity8/shell/emulators/dash.py 2014-08-25 16:07:45 +0000
356+++ tests/autopilot/unity8/shell/emulators/dash.py 2014-09-01 11:24:24 +0000
357@@ -93,7 +93,7 @@
358 'No scope found with id {0}'.format(scope_id))
359
360 def _get_scope_from_loader(self, loader):
361- return loader.get_children()[0]
362+ return loader.wait_select_single('GenericScopeView');
363
364 def _open_scope_scrolling(self, scope_loader):
365 scroll = self._get_scroll_direction(scope_loader)
366@@ -102,8 +102,8 @@
367 scroll()
368 self.dash_content_list.moving.wait_for(False)
369
370+ scope_loader.isCurrent.wait_for(True)
371 scope = self._get_scope_from_loader(scope_loader)
372- scope.isCurrent.wait_for(True)
373 return scope
374
375 def _get_scroll_direction(self, scope_loader):
376
377=== modified file 'tests/mocks/Ubuntu/CMakeLists.txt'
378--- tests/mocks/Ubuntu/CMakeLists.txt 2014-08-25 10:05:13 +0000
379+++ tests/mocks/Ubuntu/CMakeLists.txt 2014-09-01 11:24:24 +0000
380@@ -1,3 +1,4 @@
381+add_subdirectory(Connectivity)
382 add_subdirectory(DownloadDaemonListener)
383 add_subdirectory(Payments)
384 add_subdirectory(SystemImage)
385
386=== added directory 'tests/mocks/Ubuntu/Connectivity'
387=== added file 'tests/mocks/Ubuntu/Connectivity/CMakeLists.txt'
388--- tests/mocks/Ubuntu/Connectivity/CMakeLists.txt 1970-01-01 00:00:00 +0000
389+++ tests/mocks/Ubuntu/Connectivity/CMakeLists.txt 2014-09-01 11:24:24 +0000
390@@ -0,0 +1,10 @@
391+add_library(connectivity-qml SHARED
392+ networking-status.cpp
393+ plugin.cpp
394+)
395+qt5_use_modules(connectivity-qml Qml)
396+
397+# copy qmldir file into build directory for shadow builds
398+file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
399+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
400+ )
401
402=== added file 'tests/mocks/Ubuntu/Connectivity/networking-status.cpp'
403--- tests/mocks/Ubuntu/Connectivity/networking-status.cpp 1970-01-01 00:00:00 +0000
404+++ tests/mocks/Ubuntu/Connectivity/networking-status.cpp 2014-09-01 11:24:24 +0000
405@@ -0,0 +1,65 @@
406+/*
407+ * Copyright © 2013 Canonical Ltd.
408+ *
409+ * This program is free software: you can redistribute it and/or modify it
410+ * under the terms of the GNU Lesser General Public License version 3,
411+ * as published by the Free Software Foundation.
412+ *
413+ * This program is distributed in the hope that it will be useful,
414+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
415+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
416+ * GNU Lesser General Public License for more details.
417+ *
418+ * You should have received a copy of the GNU Lesser General Public License
419+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
420+ *
421+ * Authors:
422+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
423+ */
424+
425+#include "networking-status.h"
426+
427+NetworkingStatus::NetworkingStatus(QObject *parent)
428+ : QObject(parent)
429+{
430+
431+ qRegisterMetaType<NetworkingStatus::Limitations>();
432+ qRegisterMetaType<QVector<NetworkingStatus::Limitations>>();
433+ qRegisterMetaType<NetworkingStatus::Status>();
434+}
435+
436+NetworkingStatus::~NetworkingStatus()
437+{}
438+
439+QVector<NetworkingStatus::Limitations>
440+NetworkingStatus::limitations() const
441+{
442+ return m_limitations;
443+}
444+
445+NetworkingStatus::Status
446+NetworkingStatus::status() const
447+{
448+ return Status::Online;
449+}
450+
451+bool
452+NetworkingStatus::online() const
453+{
454+ return status() == Status::Online;
455+}
456+
457+bool
458+NetworkingStatus::limitedBandwith() const
459+{
460+ return limitations().contains(Limitations::Bandwith);
461+}
462+
463+void NetworkingStatus::setLimitedBandwidth(bool limited)
464+{
465+ if (limited) {
466+ m_limitations << Limitations::Bandwith;
467+ } else if (limitedBandwith()) {
468+ m_limitations.remove(m_limitations.indexOf(Limitations::Bandwith));
469+ }
470+}
471
472=== added file 'tests/mocks/Ubuntu/Connectivity/networking-status.h'
473--- tests/mocks/Ubuntu/Connectivity/networking-status.h 1970-01-01 00:00:00 +0000
474+++ tests/mocks/Ubuntu/Connectivity/networking-status.h 2014-09-01 11:24:24 +0000
475@@ -0,0 +1,73 @@
476+/*
477+ * Copyright © 2014 Canonical Ltd.
478+ *
479+ * This program is free software: you can redistribute it and/or modify it
480+ * under the terms of the GNU Lesser General Public License version 3,
481+ * as published by the Free Software Foundation.
482+ *
483+ * This program is distributed in the hope that it will be useful,
484+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
485+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
486+ * GNU Lesser General Public License for more details.
487+ *
488+ * You should have received a copy of the GNU Lesser General Public License
489+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
490+ *
491+ */
492+
493+#ifndef FAKE_NETWORKING_STATUS_H
494+#define FAKE_NETWORKING_STATUS_H
495+
496+#include <QObject>
497+#include <QVector>
498+
499+class Q_DECL_EXPORT NetworkingStatus : public QObject
500+{
501+ Q_OBJECT
502+ Q_DISABLE_COPY(NetworkingStatus)
503+
504+ Q_ENUMS(Limitations)
505+ Q_ENUMS(Status)
506+
507+ Q_PROPERTY(QVector<Limitations> limitations READ limitations NOTIFY limitationsChanged)
508+ Q_PROPERTY(Status status READ status NOTIFY statusChanged)
509+ Q_PROPERTY(bool online READ online NOTIFY onlineChanged)
510+ Q_PROPERTY(bool limitedBandwith READ limitedBandwith WRITE setLimitedBandwidth NOTIFY limitedBandwithChanged)
511+
512+public:
513+ explicit NetworkingStatus(QObject *parent = 0);
514+ virtual ~NetworkingStatus();
515+
516+ enum Limitations {
517+ Bandwith
518+ };
519+
520+ enum Status {
521+ Offline,
522+ Connecting,
523+ Online
524+ };
525+
526+ QVector<Limitations> limitations() const;
527+ Status status() const;
528+ bool online() const;
529+ bool limitedBandwith() const;
530+
531+ // Only in the fake one
532+ void setLimitedBandwidth(bool limited);
533+
534+Q_SIGNALS:
535+ void limitationsChanged();
536+ void statusChanged(Status value);
537+ void onlineChanged(bool value);
538+ void limitedBandwithChanged(bool value);
539+
540+private:
541+ QVector<NetworkingStatus::Limitations> m_limitations;
542+};
543+
544+Q_DECLARE_METATYPE(NetworkingStatus::Limitations)
545+Q_DECLARE_METATYPE(QVector<NetworkingStatus::Limitations>)
546+Q_DECLARE_METATYPE(NetworkingStatus::Status)
547+
548+#endif // FAKE_NETWORKING_STATUS_H
549
550=== added file 'tests/mocks/Ubuntu/Connectivity/plugin.cpp'
551--- tests/mocks/Ubuntu/Connectivity/plugin.cpp 1970-01-01 00:00:00 +0000
552+++ tests/mocks/Ubuntu/Connectivity/plugin.cpp 2014-09-01 11:24:24 +0000
553@@ -0,0 +1,46 @@
554+/*
555+ * Copyright © 2014 Canonical Ltd.
556+ *
557+ * This program is free software: you can redistribute it and/or modify it
558+ * under the terms of the GNU Lesser General Public License version 3,
559+ * as published by the Free Software Foundation.
560+ *
561+ * This program is distributed in the hope that it will be useful,
562+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
563+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
564+ * GNU Lesser General Public License for more details.
565+ *
566+ * You should have received a copy of the GNU Lesser General Public License
567+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
568+ *
569+ * Authors:
570+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
571+ */
572+
573+#include "plugin.h"
574+
575+#include <QtQml>
576+
577+#include "networking-status.h"
578+
579+static QObject *
580+networkingStatusSingletonProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
581+{
582+ Q_UNUSED(scriptEngine)
583+
584+ return new NetworkingStatus(engine);
585+}
586+
587+void
588+QmlConnectivityNetworkingPlugin::registerTypes(const char *uri)
589+{
590+ // @uri Ubuntu.Connectivity
591+ qmlRegisterSingletonType<NetworkingStatus>(uri, 1, 0, "NetworkingStatus", networkingStatusSingletonProvider);
592+}
593+
594+void
595+QmlConnectivityNetworkingPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
596+{
597+ Q_UNUSED(uri);
598+ Q_UNUSED(engine);
599+}
600
601=== added file 'tests/mocks/Ubuntu/Connectivity/plugin.h'
602--- tests/mocks/Ubuntu/Connectivity/plugin.h 1970-01-01 00:00:00 +0000
603+++ tests/mocks/Ubuntu/Connectivity/plugin.h 2014-09-01 11:24:24 +0000
604@@ -0,0 +1,35 @@
605+/*
606+ * Copyright © 2014 Canonical Ltd.
607+ *
608+ * This program is free software: you can redistribute it and/or modify it
609+ * under the terms of the GNU Lesser General Public License version 3,
610+ * as published by the Free Software Foundation.
611+ *
612+ * This program is distributed in the hope that it will be useful,
613+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
614+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
615+ * GNU Lesser General Public License for more details.
616+ *
617+ * You should have received a copy of the GNU Lesser General Public License
618+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
619+ *
620+ * Authors:
621+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
622+ */
623+
624+#ifndef QML_CONNECTIVITY_PLUGIN_H
625+#define QML_CONNECTIVITY_PLUGIN_H
626+
627+#include <QQmlExtensionPlugin>
628+
629+class QmlConnectivityNetworkingPlugin : public QQmlExtensionPlugin {
630+ Q_OBJECT
631+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
632+ Q_INTERFACES(QQmlExtensionInterface)
633+
634+public:
635+ void registerTypes(const char *uri);
636+ void initializeEngine(QQmlEngine *engine, const char *uri);
637+};
638+
639+#endif // QML_CONNECTIVITY_PLUGIN_H
640
641=== added file 'tests/mocks/Ubuntu/Connectivity/qmldir'
642--- tests/mocks/Ubuntu/Connectivity/qmldir 1970-01-01 00:00:00 +0000
643+++ tests/mocks/Ubuntu/Connectivity/qmldir 2014-09-01 11:24:24 +0000
644@@ -0,0 +1,2 @@
645+module Ubuntu.Connectivity
646+plugin connectivity-qml
647
648=== modified file 'tests/plugins/Dash/CMakeLists.txt'
649--- tests/plugins/Dash/CMakeLists.txt 2014-07-22 10:03:37 +0000
650+++ tests/plugins/Dash/CMakeLists.txt 2014-09-01 11:24:24 +0000
651@@ -32,7 +32,7 @@
652 qt5_use_modules(${TESTNAME}TestExec Test Core Qml)
653 target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
654
655- add_binary_qml_test(${TESTNAME} "" "Dash-qml")
656+ add_binary_qml_test(${TESTNAME} "" "Dash-qml" "")
657 endmacro()
658
659 add_lvwph_test(listviewwithpageheader ListViewWithPageHeader)
660@@ -48,7 +48,7 @@
661 qt5_use_modules(${TESTNAME}TestExec Test Core Qml)
662 target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
663
664- add_binary_qml_test(${TESTNAME} "" "Dash-qml")
665+ add_binary_qml_test(${TESTNAME} "" "Dash-qml" "")
666
667 add_executable(${TESTNAME}tryExec
668 ${FILENAME}try.cpp
669@@ -71,7 +71,7 @@
670 add_executable(CardCreatorTestExec cardcreatortest.cpp)
671 qt5_use_modules(CardCreatorTestExec Test Core Qml)
672 target_link_libraries(CardCreatorTestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
673-add_binary_qml_test(CardCreator "" "Dash-qml")
674+add_binary_qml_test(CardCreator "" "Dash-qml" "QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/tests/mocks/")
675
676 # plain qml test
677 set(qmltest_DEFAULT_TARGETS qmluitests)
678
679=== modified file 'tests/plugins/Dash/cardcreator/1.res'
680--- tests/plugins/Dash/cardcreator/1.res 2014-08-13 10:29:21 +0000
681+++ tests/plugins/Dash/cardcreator/1.res 2014-09-01 11:24:24 +0000
682@@ -46,7 +46,8 @@
683 }
684 image: Image {
685 objectName: "artImage";
686- source: cardData && cardData["art"] || "";
687+ property bool doLoadSource: !NetworkingStatus.limitedBandwith;
688+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; }
689 cache: true;
690 asynchronous: root.asynchronous;
691 fillMode: Image.PreserveAspectCrop;
692
693=== modified file 'tests/plugins/Dash/cardcreator/2.res'
694--- tests/plugins/Dash/cardcreator/2.res 2014-08-14 16:24:45 +0000
695+++ tests/plugins/Dash/cardcreator/2.res 2014-09-01 11:24:24 +0000
696@@ -67,7 +67,8 @@
697 objectName: "mascotImage";
698 anchors { verticalCenter: parent.verticalCenter; }
699 readonly property int maxSize: Math.max(width, height) * 4;
700- source: cardData && cardData["mascot"] || "";
701+ property bool doLoadSource: !NetworkingStatus.limitedBandwith;
702+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; }
703 width: units.gu(6);
704 height: units.gu(5.625);
705 sourceSize { width: maxSize; height: maxSize }
706
707=== modified file 'tests/plugins/Dash/cardcreator/3.res'
708--- tests/plugins/Dash/cardcreator/3.res 2014-08-13 10:29:21 +0000
709+++ tests/plugins/Dash/cardcreator/3.res 2014-09-01 11:24:24 +0000
710@@ -46,8 +46,9 @@
711 }
712 image: Image {
713 objectName: "artImage";
714- source: cardData && cardData["art"] || "";
715- cache: true;
716+ property bool doLoadSource: !NetworkingStatus.limitedBandwith;
717+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; }
718+ cache: true;
719 asynchronous: root.asynchronous;
720 fillMode: Image.PreserveAspectCrop;
721 width: root.width;
722
723=== modified file 'tests/plugins/Dash/cardcreator/4.res'
724--- tests/plugins/Dash/cardcreator/4.res 2014-08-13 10:29:21 +0000
725+++ tests/plugins/Dash/cardcreator/4.res 2014-09-01 11:24:24 +0000
726@@ -46,8 +46,9 @@
727 objectName: "mascotImage";
728 anchors { verticalCenter: parent.verticalCenter; }
729 readonly property int maxSize: Math.max(width, height) * 4;
730- source: cardData && cardData["mascot"] || "";
731- width: units.gu(6);
732+ property bool doLoadSource: !NetworkingStatus.limitedBandwith;
733+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; }
734+ width: units.gu(6);
735 height: units.gu(5.625);
736 sourceSize { width: maxSize; height: maxSize }
737 fillMode: Image.PreserveAspectCrop;
738
739=== modified file 'tests/plugins/Dash/cardcreator/5.res'
740--- tests/plugins/Dash/cardcreator/5.res 2014-08-20 16:05:39 +0000
741+++ tests/plugins/Dash/cardcreator/5.res 2014-09-01 11:24:24 +0000
742@@ -46,8 +46,9 @@
743 }
744 image: Image {
745 objectName: "artImage";
746- source: cardData && cardData["art"] || "";
747- cache: true;
748+ property bool doLoadSource: !NetworkingStatus.limitedBandwith;
749+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; }
750+ cache: true;
751 asynchronous: root.asynchronous;
752 fillMode: Image.PreserveAspectCrop;
753 width: root.width;
754
755=== modified file 'tests/plugins/Dash/cardcreator/7.res'
756--- tests/plugins/Dash/cardcreator/7.res 2014-08-18 08:22:45 +0000
757+++ tests/plugins/Dash/cardcreator/7.res 2014-09-01 11:24:24 +0000
758@@ -67,8 +67,9 @@
759 objectName: "mascotImage";
760 anchors { verticalCenter: parent.verticalCenter; }
761 readonly property int maxSize: Math.max(width, height) * 4;
762- source: cardData && cardData["mascot"] || "";
763- width: units.gu(6);
764+ property bool doLoadSource: !NetworkingStatus.limitedBandwith;
765+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; }
766+ width: units.gu(6);
767 height: units.gu(5.625);
768 sourceSize { width: maxSize; height: maxSize }
769 fillMode: Image.PreserveAspectCrop;
770
771=== modified file 'tests/plugins/Dash/listviewwithpageheadertest.cpp'
772--- tests/plugins/Dash/listviewwithpageheadertest.cpp 2014-04-24 14:13:21 +0000
773+++ tests/plugins/Dash/listviewwithpageheadertest.cpp 2014-09-01 11:24:24 +0000
774@@ -28,6 +28,8 @@
775 #include <private/qquickitem_p.h>
776 #pragma GCC diagnostic pop
777
778+#include <limits>
779+
780 // TODO Think on how doing a test for lost items
781 // particullary making sure that lost items are culled
782 // and then removed in the next updatePolish cycle
783@@ -1899,6 +1901,43 @@
784 QTRY_COMPARE(lvwph->m_firstVisibleIndex, 0);
785 }
786
787+ void testNoCacheBuffer()
788+ {
789+ lvwph->setCacheBuffer(0);
790+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 3);
791+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
792+ verifyItem(0, 50., 150., false);
793+ verifyItem(1, 200., 200., false);
794+ verifyItem(2, 400., 350., false);
795+ QCOMPARE(lvwph->m_minYExtent, 0.);
796+ QCOMPARE(lvwph->m_clipItem->y(), 0.);
797+ QCOMPARE(lvwph->m_clipItem->clip(), false);
798+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
799+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
800+ QCOMPARE(lvwph->contentY(), 0.);
801+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
802+ }
803+
804+ void testAllCacheBuffer()
805+ {
806+ lvwph->setCacheBuffer(std::numeric_limits<qreal>::max());
807+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 6);
808+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
809+ verifyItem(0, 50., 150., false);
810+ verifyItem(1, 200., 200., false);
811+ verifyItem(2, 400., 350., false);
812+ verifyItem(3, 750., 350., true);
813+ verifyItem(4, 1100., 350., true);
814+ verifyItem(5, 1450., 350., true);
815+ QCOMPARE(lvwph->m_minYExtent, 0.);
816+ QCOMPARE(lvwph->m_clipItem->y(), 0.);
817+ QCOMPARE(lvwph->m_clipItem->clip(), false);
818+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
819+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
820+ QCOMPARE(lvwph->contentY(), 0.);
821+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
822+ }
823+
824 private:
825 QQuickView *view;
826 ListViewWithPageHeader *lvwph;
827
828=== modified file 'tests/plugins/Dash/listviewwithpageheadertest.qml'
829--- tests/plugins/Dash/listviewwithpageheadertest.qml 2014-04-30 10:06:33 +0000
830+++ tests/plugins/Dash/listviewwithpageheadertest.qml 2014-09-01 11:24:24 +0000
831@@ -60,6 +60,7 @@
832 anchors.top: parent.top
833 anchors.bottom: parent.bottom
834 model: model
835+ cacheBuffer: height * 0.5
836 delegate: Rectangle {
837 property bool timerDone: false
838 width: parent.width - 20
839
840=== modified file 'tests/plugins/Dash/listviewwithpageheadertestsection.qml'
841--- tests/plugins/Dash/listviewwithpageheadertestsection.qml 2014-04-30 10:06:33 +0000
842+++ tests/plugins/Dash/listviewwithpageheadertestsection.qml 2014-09-01 11:24:24 +0000
843@@ -60,6 +60,7 @@
844 anchors.top: parent.top
845 anchors.bottom: parent.bottom
846 model: model
847+ cacheBuffer: height * 0.5
848 delegate: Rectangle {
849 property bool timerDone: false
850 width: parent.width - 20
851
852=== modified file 'tests/plugins/Dash/listviewwithpageheadertestsectionexternalmodel.qml'
853--- tests/plugins/Dash/listviewwithpageheadertestsectionexternalmodel.qml 2014-04-30 10:06:33 +0000
854+++ tests/plugins/Dash/listviewwithpageheadertestsectionexternalmodel.qml 2014-09-01 11:24:24 +0000
855@@ -28,6 +28,7 @@
856 anchors.top: parent.top
857 anchors.bottom: parent.bottom
858 model: model
859+ cacheBuffer: height * 0.5
860 delegate: Rectangle {
861 property bool timerDone: false
862 width: parent.width - 20
863
864=== modified file 'tests/plugins/Ubuntu/Gestures/CMakeLists.txt'
865--- tests/plugins/Ubuntu/Gestures/CMakeLists.txt 2014-05-01 14:25:18 +0000
866+++ tests/plugins/Ubuntu/Gestures/CMakeLists.txt 2014-09-01 11:24:24 +0000
867@@ -19,7 +19,7 @@
868 qt5_use_modules(${CLASSNAME}TestExec Test Core Qml Gui Quick)
869 target_link_libraries(${CLASSNAME}TestExec UbuntuGestureQml)
870
871- add_binary_qml_test(${CLASSNAME} ${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures UbuntuGesturesTestQmlFiles)
872+ add_binary_qml_test(${CLASSNAME} ${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures UbuntuGesturesTestQmlFiles "")
873 add_manual_qml_test(. ${CLASSNAME} IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
874 endmacro(add_gesture_ui_test)
875
876
877=== modified file 'tests/qmltests/Components/CMakeLists.txt'
878--- tests/qmltests/Components/CMakeLists.txt 2014-05-01 14:25:18 +0000
879+++ tests/qmltests/Components/CMakeLists.txt 2014-09-01 11:24:24 +0000
880@@ -10,7 +10,7 @@
881 qt5_use_modules(DragHandleTestExec Test Core Qml Gui Quick)
882 target_link_libraries(DragHandleTestExec UbuntuGestureQml)
883
884-add_binary_qml_test(DragHandle ${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures "")
885+add_binary_qml_test(DragHandle ${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures "" "")
886 add_manual_qml_test(. DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
887
888 add_definitions(-DUBUNTU_GESTURES_PLUGIN_DIR="${CMAKE_BINARY_DIR}/plugins")
889
890=== modified file 'tests/qmltests/Dash/tst_Card.qml'
891--- tests/qmltests/Dash/tst_Card.qml 2014-08-22 14:43:02 +0000
892+++ tests/qmltests/Dash/tst_Card.qml 2014-09-01 11:24:24 +0000
893@@ -17,6 +17,7 @@
894 import QtQuick 2.0
895 import QtTest 1.0
896 import Ubuntu.Components 0.1
897+import Ubuntu.Connectivity 1.0
898 import Unity.Test 0.1 as UT
899 import "../../../qml/Dash"
900 import "CardHelpers.js" as Helpers
901@@ -566,5 +567,25 @@
902 verify((card.width - titleToCard.x - titleToCard.width) === units.gu(1));
903 }
904 }
905+
906+ function test_load_images_visibility_network_data() {
907+ return [
908+ { tag: "Visible, network", visible: true, limitedBandwith: false },
909+ { tag: "Visible, no network", visible: true, limitedBandwith: true },
910+ { tag: "Not Visible, network", visible: false, limitedBandwith: false },
911+ { tag: "Not Visible, no network", visible: false, limitedBandwith: true }
912+ ];
913+ }
914+
915+ function test_load_images_visibility_network(data) {
916+ loader.visible = data.visible;
917+ NetworkingStatus.limitedBandwith = data.limitedBandwith;
918+
919+ selector.selectedIndex = 0;
920+ waitForRendering(selector);
921+ waitForRendering(card);
922+
923+ verify(data.visible || !data.limitedBandwith || artImage.source == "");
924+ }
925 }
926 }
927
928=== modified file 'tests/qmltests/Dash/tst_Dash.qml'
929--- tests/qmltests/Dash/tst_Dash.qml 2014-08-18 11:17:04 +0000
930+++ tests/qmltests/Dash/tst_Dash.qml 2014-09-01 11:24:24 +0000
931@@ -242,8 +242,7 @@
932 var categoryListView = findChild(dashContentList.currentItem, "categoryListView");
933 var dashCategory2 = findChild(categoryListView, "dashCategory2");
934 tryCompareFunction(function() {
935- var d = findChild(dashCategory2, "delegate2");
936- if (d) return true;
937+ if (dashCategory2.y < 200) return true;
938 categoryListView.contentY += 100;
939 return false;
940 }, true);
941
942=== modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml'
943--- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-26 19:25:41 +0000
944+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-09-01 11:24:24 +0000
945@@ -78,18 +78,19 @@
946 spy.signalName = "";
947 }
948
949- function scrollToCategory(category) {
950+ function scrollToCategory(categoryName) {
951 var categoryListView = findChild(genericScopeView, "categoryListView");
952 tryCompareFunction(function() {
953- if (findChild(genericScopeView, category)) return true;
954+ var category = findChild(genericScopeView, categoryName);
955+ if (category && category.y > 0 && category.y < genericScopeView.height) return true;
956 mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height,
957 genericScopeView.width/2, genericScopeView.y)
958 tryCompare(categoryListView, "moving", false);
959- return findChild(genericScopeView, category) !== null;
960+ return false;
961 }, true);
962
963 tryCompareFunction(function() { return findChild(genericScopeView, "delegate0") !== null; }, true);
964- return findChild(genericScopeView, category);
965+ return findChild(genericScopeView, categoryName);
966 }
967
968 function test_isActive() {
969@@ -268,7 +269,7 @@
970 if (category === undefined) category = 0;
971 if (delegate === undefined) delegate = 0;
972 tryCompareFunction(function() {
973- var cardGrid = findChild(genericScopeView, category);
974+ var cardGrid = findChild(genericScopeView, "dashCategory"+category);
975 if (cardGrid != null) {
976 var tile = findChild(cardGrid, "delegate"+delegate);
977 return tile != null;
978@@ -276,7 +277,7 @@
979 return false;
980 },
981 true);
982- var tile = findChild(findChild(genericScopeView, category), "delegate"+delegate);
983+ var tile = findChild(findChild(genericScopeView, "dashCategory"+category), "delegate"+delegate);
984 mouseClick(tile, tile.width / 2, tile.height / 2);
985 tryCompare(testCase.subPageLoader, "open", true);
986 tryCompare(testCase.subPageLoader, "x", 0);

Subscribers

People subscribed via source and target branches