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

Proposed by Albert Astals Cid
Status: Superseded
Proposed branch: lp:~aacid/unity8/do_not_use_components_generated_code
Merge into: lp:unity8
Prerequisite: lp:~aacid/unity8/createQmlObjectDifferentFile
Diff against target: 749 lines (+129/-68)
26 files modified
plugins/Dash/CardCreator.js (+33/-17)
qml/Dash/CardCarousel.qml (+0/-1)
qml/Dash/CardGrid.qml (+0/-1)
qml/Dash/CardHorizontalList.qml (+0/-1)
qml/Dash/CardTool.qml (+0/-1)
qml/Dash/CardVerticalJournal.qml (+0/-1)
qml/Dash/Previews/PreviewHeader.qml (+1/-1)
qml/Dash/Previews/PreviewImageGallery.qml (+2/-2)
qml/Dash/Previews/PreviewZoomableImage.qml (+2/-2)
tests/plugins/Dash/cardcreator/1.res (+6/-7)
tests/plugins/Dash/cardcreator/10.res (+0/-1)
tests/plugins/Dash/cardcreator/11.res (+7/-8)
tests/plugins/Dash/cardcreator/2.res (+0/-1)
tests/plugins/Dash/cardcreator/3.res (+6/-7)
tests/plugins/Dash/cardcreator/4.res (+0/-1)
tests/plugins/Dash/cardcreator/5.res (+6/-7)
tests/plugins/Dash/cardcreator/5.tst (+1/-1)
tests/plugins/Dash/cardcreator/6.res (+0/-1)
tests/plugins/Dash/cardcreator/7.res (+0/-1)
tests/plugins/Dash/cardcreator/8.res (+1/-2)
tests/plugins/Dash/cardcreator/9.res (+0/-1)
tests/qmltests/Dash/Previews/tst_PreviewHeader.qml (+15/-0)
tests/qmltests/Dash/Previews/tst_PreviewImageGallery.qml (+19/-0)
tests/qmltests/Dash/Previews/tst_PreviewZoomableImage.qml (+12/-0)
tests/qmltests/Dash/tst_Card.qml (+18/-1)
tests/qmltests/Dash/tst_CardBenchmark.qml (+0/-2)
To merge this branch: bzr merge lp:~aacid/unity8/do_not_use_components_generated_code
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity8 CI Bot continuous-integration Needs Fixing
Review via email: mp+284289@code.launchpad.net

This proposal has been superseded by a proposal from 2016-02-11.

Commit message

Do not use components in card creator generated code

We can resolve it on compile time

Description of the change

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

 * 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.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2139
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/220/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/220/rebuild

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

FAILED: Continuous integration, rev:2139
http://jenkins.qa.ubuntu.com/job/unity8-ci/7170/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6240
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/585/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1875
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/578
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1770
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1770
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/577
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/576
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4808
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6251
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6251/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27124
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/304/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/583
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/583/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27123

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/7170/rebuild

review: Needs Fixing (continuous-integration)
2140. By Albert Astals Cid

Merge

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2140
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/241/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/241/rebuild

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

FAILED: Continuous integration, rev:2140
http://jenkins.qa.ubuntu.com/job/unity8-ci/7189/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6291
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/604/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1894
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/597
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1789
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1789
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/596
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/595
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4835
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6302
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6302/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27225
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/318/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/602
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/602/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27227

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/7189/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) :
review: Needs Information
2141. By Albert Astals Cid

We can use !isConciergeMode

I was worried about components["art"] && components["art"]["conciergeMode"] being a string but ! will convert it always to a boolean

2142. By Albert Astals Cid

Actually, no, we need this, the creator is putting 1 instead of true

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2141
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/249/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/249/rebuild

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

FAILED: Continuous integration, rev:2142
http://jenkins.qa.ubuntu.com/job/unity8-ci/7192/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6294/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/607/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1897
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/600
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1792
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1792
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/599
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/598
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4838/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6305
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6305/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27233
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/321/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/605
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/605/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27232

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/7192/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2142
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/251/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/251/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

We need to look into the failing qmltests, but the logic for now is good

review: Needs Fixing
2143. By Albert Astals Cid

Merge

2144. By Albert Astals Cid

Use a better is not a number checker

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2144
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/312/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/433/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/456
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/474
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/474
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/470
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/470/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/470/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/470
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/470/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/470/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/470
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/470/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/470/console

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/312/rebuild

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

FAILED: Continuous integration, rev:2144
http://jenkins.qa.ubuntu.com/job/unity8-ci/7252/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/6404
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/667/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1957
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/660
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1852
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1852
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/659
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/658
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4909
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6415
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/6415/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27460
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/344/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/665
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/665/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27461

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/7252/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Y
 * Did CI run pass? If not, please explain why.
ap
 * Did you make sure that the branch does not contain spurious tags?
clean

review: Approve
2145. By Albert Astals Cid

Merge fallback for empty

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Dash/CardCreator.js'
2--- plugins/Dash/CardCreator.js 2016-01-29 11:52:58 +0000
3+++ plugins/Dash/CardCreator.js 2016-02-11 13:14:08 +0000
4@@ -61,7 +61,10 @@
5 // %1 is used as anchors of artShapeHolder
6 // %2 is used as image width
7 // %3 is used as image height
8-// %4 is injected as code to artImage
9+// %4 is used for artShapeSource.hideSource and inner Loader visible
10+// %5 is used as aspect ratio fallback
11+// %6 is injected as code to artImage
12+// %7 is used as image fallback
13 var kArtShapeHolderCode = 'Item { \n\
14 id: artShapeHolder; \n\
15 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
16@@ -70,13 +73,13 @@
17 Loader { \n\
18 id: artShapeLoader; \n\
19 objectName: "artShapeLoader"; \n\
20- active: cardData && cardData["art"] || false; \n\
21+ readonly property string cardArt: cardData && cardData["art"] || %7; \n\
22+ active: cardArt != ""; \n\
23 asynchronous: root.asynchronous; \n\
24 visible: status == Loader.Ready; \n\
25 sourceComponent: Item { \n\
26 id: artShape; \n\
27 objectName: "artShape"; \n\
28- readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true; \n\
29 visible: image.status == Image.Ready; \n\
30 readonly property alias image: artImage; \n\
31 ShaderEffectSource { \n\
32@@ -85,11 +88,11 @@
33 anchors.centerIn: parent; \n\
34 width: 1; \n\
35 height: 1; \n\
36- hideSource: doShapeItem; \n\
37+ hideSource: %4; \n\
38 } \n\
39 Loader { \n\
40 anchors.fill: parent; \n\
41- visible: artShape.doShapeItem; \n\
42+ visible: %4; \n\
43 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\
44 Component { \n\
45 id: artShapeShapeComponent; \n\
46@@ -113,7 +116,7 @@
47 } \n\
48 } \n\
49 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
50- readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
51+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : %5; \n\
52 Component.onCompleted: { updateWidthHeightBindings(); } \n\
53 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } \n\
54 function updateWidthHeightBindings() { \n\
55@@ -128,11 +131,11 @@
56 CroppedImageMinimumSourceSize { \n\
57 id: artImage; \n\
58 objectName: "artImage"; \n\
59- source: cardData && cardData["art"] || ""; \n\
60+ source: artShapeLoader.cardArt; \n\
61 asynchronous: root.asynchronous; \n\
62 width: %2; \n\
63 height: %3; \n\
64- %4 \n\
65+ %6 \n\
66 } \n\
67 } \n\
68 } \n\
69@@ -245,11 +248,12 @@
70 // %1 is used as anchors of mascotImage
71 // %2 is used as visible of mascotImage
72 // %3 is injected as code to mascotImage
73+// %4 is used as fallback image
74 var kMascotImageCode = 'CroppedImageMinimumSourceSize { \n\
75 id: mascotImage; \n\
76 objectName: "mascotImage"; \n\
77 anchors { %1 } \n\
78- source: cardData && cardData["mascot"] || ""; \n\
79+ source: cardData && cardData["mascot"] || %4; \n\
80 width: units.gu(6); \n\
81 height: units.gu(5.625); \n\
82 horizontalAlignment: Image.AlignHCenter; \n\
83@@ -392,7 +396,6 @@
84
85 code = 'AbstractButton { \n\
86 id: root; \n\
87- property var components; \n\
88 property var cardData; \n\
89 property string artShapeStyle: "inset"; \n\
90 property string backgroundShapeStyle: "inset"; \n\
91@@ -410,7 +413,8 @@
92
93 var hasArt = components["art"] && components["art"]["field"] || false;
94 var hasSummary = components["summary"] || false;
95- var artAndSummary = hasArt && hasSummary && components["art"]["conciergeMode"] !== true;
96+ var isConciergeMode = components["art"] && components["art"]["conciergeMode"] || false;
97+ var artAndSummary = hasArt && hasSummary && !isConciergeMode;
98 var isHorizontal = template["card-layout"] === "horizontal";
99 var hasBackground = (!isHorizontal && (template["card-background"] || components["background"] || artAndSummary)) ||
100 (hasSummary && (template["card-background"] || components["background"]));
101@@ -480,13 +484,21 @@
102 heightCode = 'width / artShape.aspect';
103 }
104
105+ var aspectRatio = components["art"] && components["art"]["aspect-ratio"] || 1;
106+ if (isNaN(aspectRatio)) {
107+ aspectRatio = 1;
108+ }
109 var fallback = components["art"] && components["art"]["fallback"] || "";
110 fallback = encodeURI(fallback);
111- var fallbackCode = "";
112+ var fallbackStatusCode = "";
113+ var fallbackURICode = '""';
114 if (fallback !== "") {
115- fallbackCode += 'onStatusChanged: if (status === Image.Error) source = decodeURI("%1");'.arg(fallback);
116+ // fallbackStatusCode has %6 in it because we want to substitute it for fallbackURICode
117+ // which in kArtShapeHolderCode is %7
118+ fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %7;';
119+ fallbackURICode = 'decodeURI("%1")'.arg(fallback);
120 }
121- code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode).arg(fallbackCode);
122+ code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode).arg(isConciergeMode ? "false" : "true").arg(aspectRatio).arg(fallbackStatusCode).arg(fallbackURICode);
123 } else {
124 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
125 }
126@@ -580,11 +592,15 @@
127 var mascotImageVisible = useMascotShape ? 'false' : 'showHeader';
128 var fallback = components["mascot"] && components["mascot"]["fallback"] || "";
129 fallback = encodeURI(fallback);
130- var fallbackCode = "";
131+ var fallbackStatusCode = "";
132+ var fallbackURICode = '""';
133 if (fallback !== "") {
134- fallbackCode += 'onStatusChanged: if (status === Image.Error) source = decodeURI("%1");'.arg(fallback);
135+ // fallbackStatusCode has %4 in it because we want to substitute it for fallbackURICode
136+ // which in kMascotImageCode is %4
137+ fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %4;';
138+ fallbackURICode = 'decodeURI("%1")'.arg(fallback);
139 }
140- mascotCode = kMascotImageCode.arg(mascotAnchors).arg(mascotImageVisible).arg(fallbackCode);
141+ mascotCode = kMascotImageCode.arg(mascotAnchors).arg(mascotImageVisible).arg(fallbackStatusCode).arg(fallbackURICode);
142 }
143
144 var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white")';
145
146=== modified file 'qml/Dash/CardCarousel.qml'
147--- qml/Dash/CardCarousel.qml 2015-11-19 16:55:31 +0000
148+++ qml/Dash/CardCarousel.qml 2016-02-11 13:14:08 +0000
149@@ -64,7 +64,6 @@
150 item.fixedHeaderHeight = Qt.binding(function() { return carousel.headerHeight; });
151 item.height = Qt.binding(function() { return cardTool.cardHeight; });
152 item.cardData = Qt.binding(function() { return model; });
153- item.components = Qt.binding(function() { return cardTool.components; });
154 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
155 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
156 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
157
158=== modified file 'qml/Dash/CardGrid.qml'
159--- qml/Dash/CardGrid.qml 2016-01-22 18:18:47 +0000
160+++ qml/Dash/CardGrid.qml 2016-02-11 13:14:08 +0000
161@@ -70,7 +70,6 @@
162 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
163 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
164 item.cardData = Qt.binding(function() { return model; });
165- item.components = Qt.binding(function() { return cardTool.components; });
166 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
167 item.scopeStyle = root.scopeStyle;
168 item.artShapeStyle = root.artShapeStyle;
169
170=== modified file 'qml/Dash/CardHorizontalList.qml'
171--- qml/Dash/CardHorizontalList.qml 2015-07-15 15:07:19 +0000
172+++ qml/Dash/CardHorizontalList.qml 2016-02-11 13:14:08 +0000
173@@ -53,7 +53,6 @@
174 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
175 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
176 item.cardData = Qt.binding(function() { return model; });
177- item.components = Qt.binding(function() { return cardTool.components; });
178 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
179 item.scopeStyle = root.scopeStyle;
180 }
181
182=== modified file 'qml/Dash/CardTool.qml'
183--- qml/Dash/CardTool.qml 2015-11-06 10:20:36 +0000
184+++ qml/Dash/CardTool.qml 2016-02-11 13:14:08 +0000
185@@ -220,7 +220,6 @@
186 onLoaded: {
187 item.objectName = "cardToolCard";
188 item.asynchronous = false;
189- item.components = Qt.binding(function() { return cardTool.components; });
190 item.width = Qt.binding(function() { return cardTool.cardWidth !== -1 ? cardTool.cardWidth : item.implicitWidth; });
191 item.height = Qt.binding(function() { return cardTool.cardHeight !== -1 ? cardTool.cardHeight : item.implicitHeight; });
192 }
193
194=== modified file 'qml/Dash/CardVerticalJournal.qml'
195--- qml/Dash/CardVerticalJournal.qml 2015-07-15 15:07:19 +0000
196+++ qml/Dash/CardVerticalJournal.qml 2016-02-11 13:14:08 +0000
197@@ -72,7 +72,6 @@
198 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
199 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
200 item.cardData = Qt.binding(function() { return model; });
201- item.components = Qt.binding(function() { return cardTool.components; });
202 item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
203 item.scopeStyle = root.scopeStyle;
204 }
205
206=== modified file 'qml/Dash/Previews/PreviewHeader.qml'
207--- qml/Dash/Previews/PreviewHeader.qml 2015-11-04 14:57:13 +0000
208+++ qml/Dash/Previews/PreviewHeader.qml 2016-02-11 13:14:08 +0000
209@@ -35,7 +35,7 @@
210 Item {
211 id: headerRoot
212 objectName: "innerPreviewHeader"
213- readonly property url mascot: root.widgetData["mascot"] || ""
214+ readonly property url mascot: root.widgetData["mascot"] || fallback
215 readonly property url fallback: root.widgetData["fallback"] || ""
216 readonly property string title: root.widgetData["title"] || ""
217 readonly property string subtitle: root.widgetData["subtitle"] || ""
218
219=== modified file 'qml/Dash/Previews/PreviewImageGallery.qml'
220--- qml/Dash/Previews/PreviewImageGallery.qml 2015-11-04 14:57:13 +0000
221+++ qml/Dash/Previews/PreviewImageGallery.qml 2016-02-11 13:14:08 +0000
222@@ -59,7 +59,7 @@
223 top: parent.top
224 bottom: parent.bottom
225 }
226- source: modelData ? modelData : ""
227+ source: modelData || root.widgetData["fallback"] || ""
228 scaleTo: "height"
229 initialWidth: units.gu(13)
230 pressed: mouseArea.pressed
231@@ -128,7 +128,7 @@
232 bottom: parent.bottom
233 }
234 width: overlay.width
235- source: modelData ? modelData : ""
236+ source: modelData || root.widgetData["fallback"] || ""
237 fillMode: Image.PreserveAspectFit
238 sourceSize { width: screenshot.width; height: screenshot.height }
239
240
241=== modified file 'qml/Dash/Previews/PreviewZoomableImage.qml'
242--- qml/Dash/Previews/PreviewZoomableImage.qml 2015-12-09 16:37:59 +0000
243+++ qml/Dash/Previews/PreviewZoomableImage.qml 2016-02-11 13:14:08 +0000
244@@ -42,7 +42,7 @@
245 right: parent.right
246 }
247 scaleTo: "width"
248- source: widgetData["source"]
249+ source: widgetData["source"] || widgetData["fallback"] || ""
250 asynchronous: true
251 useUbuntuShape: false
252 pressed: mouseArea.pressed
253@@ -86,7 +86,7 @@
254
255 delegate: ZoomableImage {
256 anchors.fill: parent
257- source: widgetData["source"]
258+ source: widgetData["source"] || widgetData["fallback"] || ""
259 zoomable: widgetData["zoomable"] ? widgetData["zoomable"] : false
260 // If modelData would change after failing to load it would not be
261 // reloaded since the source binding is destroyed by the source = fallback
262
263=== modified file 'tests/plugins/Dash/cardcreator/1.res'
264--- tests/plugins/Dash/cardcreator/1.res 2015-11-20 16:33:38 +0000
265+++ tests/plugins/Dash/cardcreator/1.res 2016-02-11 13:14:08 +0000
266@@ -1,6 +1,5 @@
267 AbstractButton {
268 id: root;
269- property var components;
270 property var cardData;
271 property string artShapeStyle: "inset";
272 property string backgroundShapeStyle: "inset";
273@@ -24,13 +23,13 @@
274 Loader {
275 id: artShapeLoader;
276 objectName: "artShapeLoader";
277- active: cardData && cardData["art"] || false;
278+ readonly property string cardArt: cardData && cardData["art"] || "";
279+ active: cardArt != "";
280 asynchronous: root.asynchronous;
281 visible: status == Loader.Ready;
282 sourceComponent: Item {
283 id: artShape;
284 objectName: "artShape";
285- readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true;
286 visible: image.status == Image.Ready;
287 readonly property alias image: artImage;
288 ShaderEffectSource {
289@@ -39,11 +38,11 @@
290 anchors.centerIn: parent;
291 width: 1;
292 height: 1;
293- hideSource: doShapeItem;
294+ hideSource: true;
295 }
296 Loader {
297 anchors.fill: parent;
298- visible: artShape.doShapeItem;
299+ visible: true;
300 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
301 Component {
302 id: artShapeShapeComponent;
303@@ -67,7 +66,7 @@
304 }
305 }
306 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
307- readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
308+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6;
309 Component.onCompleted: { updateWidthHeightBindings(); }
310 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
311 function updateWidthHeightBindings() {
312@@ -82,7 +81,7 @@
313 CroppedImageMinimumSourceSize {
314 id: artImage;
315 objectName: "artImage";
316- source: cardData && cardData["art"] || "";
317+ source: artShapeLoader.cardArt;
318 asynchronous: root.asynchronous;
319 width: root.width;
320 height: width / artShape.aspect;
321
322=== modified file 'tests/plugins/Dash/cardcreator/10.res'
323--- tests/plugins/Dash/cardcreator/10.res 2016-01-25 16:49:26 +0000
324+++ tests/plugins/Dash/cardcreator/10.res 2016-02-11 13:14:08 +0000
325@@ -1,6 +1,5 @@
326 AbstractButton {
327 id: root;
328- property var components;
329 property var cardData;
330 property string artShapeStyle: "inset";
331 property string backgroundShapeStyle: "inset";
332
333=== modified file 'tests/plugins/Dash/cardcreator/11.res'
334--- tests/plugins/Dash/cardcreator/11.res 2016-01-25 16:49:26 +0000
335+++ tests/plugins/Dash/cardcreator/11.res 2016-02-11 13:14:08 +0000
336@@ -1,6 +1,5 @@
337 AbstractButton {
338 id: root;
339- property var components;
340 property var cardData;
341 property string artShapeStyle: "inset";
342 property string backgroundShapeStyle: "inset";
343@@ -62,13 +61,13 @@
344 Loader {
345 id: artShapeLoader;
346 objectName: "artShapeLoader";
347- active: cardData && cardData["art"] || false;
348+ readonly property string cardArt: cardData && cardData["art"] || decodeURI("%5C");
349+ active: cardArt != "";
350 asynchronous: root.asynchronous;
351 visible: status == Loader.Ready;
352 sourceComponent: Item {
353 id: artShape;
354 objectName: "artShape";
355- readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true;
356 visible: image.status == Image.Ready;
357 readonly property alias image: artImage;
358 ShaderEffectSource {
359@@ -77,11 +76,11 @@
360 anchors.centerIn: parent;
361 width: 1;
362 height: 1;
363- hideSource: doShapeItem;
364+ hideSource: true;
365 }
366 Loader {
367 anchors.fill: parent;
368- visible: artShape.doShapeItem;
369+ visible: true;
370 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
371 Component {
372 id: artShapeShapeComponent;
373@@ -105,7 +104,7 @@
374 }
375 }
376 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
377- readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
378+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
379 Component.onCompleted: { updateWidthHeightBindings(); }
380 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
381 function updateWidthHeightBindings() {
382@@ -120,7 +119,7 @@
383 CroppedImageMinimumSourceSize {
384 id: artImage;
385 objectName: "artImage";
386- source: cardData && cardData["art"] || "";
387+ source: artShapeLoader.cardArt;
388 asynchronous: root.asynchronous;
389 width: root.width;
390 height: width / artShape.aspect;
391@@ -148,7 +147,7 @@
392 id: mascotImage;
393 objectName: "mascotImage";
394 anchors { verticalCenter: parent.verticalCenter; }
395- source: cardData && cardData["mascot"] || "";
396+ source: cardData && cardData["mascot"] || decodeURI("%22");
397 width: units.gu(6);
398 height: units.gu(5.625);
399 horizontalAlignment: Image.AlignHCenter;
400
401=== modified file 'tests/plugins/Dash/cardcreator/2.res'
402--- tests/plugins/Dash/cardcreator/2.res 2015-11-20 16:33:38 +0000
403+++ tests/plugins/Dash/cardcreator/2.res 2016-02-11 13:14:08 +0000
404@@ -1,6 +1,5 @@
405 AbstractButton {
406 id: root;
407- property var components;
408 property var cardData;
409 property string artShapeStyle: "inset";
410 property string backgroundShapeStyle: "inset";
411
412=== modified file 'tests/plugins/Dash/cardcreator/3.res'
413--- tests/plugins/Dash/cardcreator/3.res 2016-01-25 16:49:26 +0000
414+++ tests/plugins/Dash/cardcreator/3.res 2016-02-11 13:14:08 +0000
415@@ -1,6 +1,5 @@
416 AbstractButton {
417 id: root;
418- property var components;
419 property var cardData;
420 property string artShapeStyle: "inset";
421 property string backgroundShapeStyle: "inset";
422@@ -24,13 +23,13 @@
423 Loader {
424 id: artShapeLoader;
425 objectName: "artShapeLoader";
426- active: cardData && cardData["art"] || false;
427+ readonly property string cardArt: cardData && cardData["art"] || decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
428+ active: cardArt != "";
429 asynchronous: root.asynchronous;
430 visible: status == Loader.Ready;
431 sourceComponent: Item {
432 id: artShape;
433 objectName: "artShape";
434- readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true;
435 visible: image.status == Image.Ready;
436 readonly property alias image: artImage;
437 ShaderEffectSource {
438@@ -39,11 +38,11 @@
439 anchors.centerIn: parent;
440 width: 1;
441 height: 1;
442- hideSource: doShapeItem;
443+ hideSource: true;
444 }
445 Loader {
446 anchors.fill: parent;
447- visible: artShape.doShapeItem;
448+ visible: true;
449 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
450 Component {
451 id: artShapeShapeComponent;
452@@ -67,7 +66,7 @@
453 }
454 }
455 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
456- readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
457+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
458 Component.onCompleted: { updateWidthHeightBindings(); }
459 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
460 function updateWidthHeightBindings() {
461@@ -82,7 +81,7 @@
462 CroppedImageMinimumSourceSize {
463 id: artImage;
464 objectName: "artImage";
465- source: cardData && cardData["art"] || "";
466+ source: artShapeLoader.cardArt;
467 asynchronous: root.asynchronous;
468 width: root.width;
469 height: width / artShape.aspect;
470
471=== modified file 'tests/plugins/Dash/cardcreator/4.res'
472--- tests/plugins/Dash/cardcreator/4.res 2015-11-20 16:33:38 +0000
473+++ tests/plugins/Dash/cardcreator/4.res 2016-02-11 13:14:08 +0000
474@@ -1,6 +1,5 @@
475 AbstractButton {
476 id: root;
477- property var components;
478 property var cardData;
479 property string artShapeStyle: "inset";
480 property string backgroundShapeStyle: "inset";
481
482=== modified file 'tests/plugins/Dash/cardcreator/5.res'
483--- tests/plugins/Dash/cardcreator/5.res 2015-11-20 16:33:38 +0000
484+++ tests/plugins/Dash/cardcreator/5.res 2016-02-11 13:14:08 +0000
485@@ -1,6 +1,5 @@
486 AbstractButton {
487 id: root;
488- property var components;
489 property var cardData;
490 property string artShapeStyle: "inset";
491 property string backgroundShapeStyle: "inset";
492@@ -24,13 +23,13 @@
493 Loader {
494 id: artShapeLoader;
495 objectName: "artShapeLoader";
496- active: cardData && cardData["art"] || false;
497+ readonly property string cardArt: cardData && cardData["art"] || "";
498+ active: cardArt != "";
499 asynchronous: root.asynchronous;
500 visible: status == Loader.Ready;
501 sourceComponent: Item {
502 id: artShape;
503 objectName: "artShape";
504- readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true;
505 visible: image.status == Image.Ready;
506 readonly property alias image: artImage;
507 ShaderEffectSource {
508@@ -39,11 +38,11 @@
509 anchors.centerIn: parent;
510 width: 1;
511 height: 1;
512- hideSource: doShapeItem;
513+ hideSource: false;
514 }
515 Loader {
516 anchors.fill: parent;
517- visible: artShape.doShapeItem;
518+ visible: false;
519 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
520 Component {
521 id: artShapeShapeComponent;
522@@ -67,7 +66,7 @@
523 }
524 }
525 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
526- readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
527+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
528 Component.onCompleted: { updateWidthHeightBindings(); }
529 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
530 function updateWidthHeightBindings() {
531@@ -82,7 +81,7 @@
532 CroppedImageMinimumSourceSize {
533 id: artImage;
534 objectName: "artImage";
535- source: cardData && cardData["art"] || "";
536+ source: artShapeLoader.cardArt;
537 asynchronous: root.asynchronous;
538 width: root.width;
539 height: width / artShape.aspect;
540
541=== modified file 'tests/plugins/Dash/cardcreator/5.tst'
542--- tests/plugins/Dash/cardcreator/5.tst 2015-05-13 10:21:18 +0000
543+++ tests/plugins/Dash/cardcreator/5.tst 2016-02-11 13:14:08 +0000
544@@ -1,3 +1,3 @@
545 template: {"non-interactive":true,"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true}
546-components: {"art":{"aspect-ratio":1,"field":"art"},"subtitle":{"field":"artist"},"title":{"field":"title"},"attributes":{}}
547+components: {"art":{"aspect-ratio":1,"field":"art","conciergeMode":true},"subtitle":{"field":"artist"},"title":{"field":"title"},"attributes":{}}
548 result: 5.res
549
550=== modified file 'tests/plugins/Dash/cardcreator/6.res'
551--- tests/plugins/Dash/cardcreator/6.res 2016-01-25 16:49:26 +0000
552+++ tests/plugins/Dash/cardcreator/6.res 2016-02-11 13:14:08 +0000
553@@ -1,6 +1,5 @@
554 AbstractButton {
555 id: root;
556- property var components;
557 property var cardData;
558 property string artShapeStyle: "inset";
559 property string backgroundShapeStyle: "inset";
560
561=== modified file 'tests/plugins/Dash/cardcreator/7.res'
562--- tests/plugins/Dash/cardcreator/7.res 2015-11-20 16:33:38 +0000
563+++ tests/plugins/Dash/cardcreator/7.res 2016-02-11 13:14:08 +0000
564@@ -1,6 +1,5 @@
565 AbstractButton {
566 id: root;
567- property var components;
568 property var cardData;
569 property string artShapeStyle: "inset";
570 property string backgroundShapeStyle: "inset";
571
572=== modified file 'tests/plugins/Dash/cardcreator/8.res'
573--- tests/plugins/Dash/cardcreator/8.res 2015-11-20 16:33:38 +0000
574+++ tests/plugins/Dash/cardcreator/8.res 2016-02-11 13:14:08 +0000
575@@ -1,7 +1,6 @@
576 AbstractButton {
577 id: root;
578- property var components;
579- property var cardData;
580+ property var cardData;
581 property string artShapeStyle: "inset";
582 property string backgroundShapeStyle: "inset";
583 property real fontScale: 1.0;
584
585=== modified file 'tests/plugins/Dash/cardcreator/9.res'
586--- tests/plugins/Dash/cardcreator/9.res 2016-01-11 15:40:59 +0000
587+++ tests/plugins/Dash/cardcreator/9.res 2016-02-11 13:14:08 +0000
588@@ -1,6 +1,5 @@
589 AbstractButton {
590 id: root;
591- property var components;
592 property var cardData;
593 property string artShapeStyle: "inset";
594 property string backgroundShapeStyle: "inset";
595
596=== modified file 'tests/qmltests/Dash/Previews/tst_PreviewHeader.qml'
597--- tests/qmltests/Dash/Previews/tst_PreviewHeader.qml 2015-11-04 14:57:13 +0000
598+++ tests/qmltests/Dash/Previews/tst_PreviewHeader.qml 2016-02-11 13:14:08 +0000
599@@ -54,6 +54,14 @@
600 "attributes": [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"}]
601 }
602
603+ property var emptyfallbackheaderjson: {
604+ "title": "THE TITLE",
605+ "subtitle": "Something catchy",
606+ "mascot": "",
607+ "fallback": "../graphics/play_button.png",
608+ "attributes": [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"}]
609+ }
610+
611 PreviewHeader {
612 id: previewHeader
613 widgetData: headerjson
614@@ -150,6 +158,13 @@
615 var mascot = findChild(previewHeader, "mascotShape");
616 tryCompare(mascot, "visible", true);
617 tryCompare(mascot.source, "status", Image.Ready);
618+
619+ previewHeader.widgetData = {};
620+ previewHeader.widgetData = emptyfallbackheaderjson;
621+ tryCompareFunction(function() { return findChild(previewHeader, "mascotShape") != null }, true);
622+ var mascot = findChild(previewHeader, "mascotShape");
623+ tryCompare(mascot, "visible", true);
624+ tryCompare(mascot.source, "status", Image.Ready);
625 }
626 }
627 }
628
629=== modified file 'tests/qmltests/Dash/Previews/tst_PreviewImageGallery.qml'
630--- tests/qmltests/Dash/Previews/tst_PreviewImageGallery.qml 2015-11-23 15:41:34 +0000
631+++ tests/qmltests/Dash/Previews/tst_PreviewImageGallery.qml 2016-02-11 13:14:08 +0000
632@@ -48,6 +48,16 @@
633 , "fallback": "../../../tests/graphics/clock@18.png"
634 }
635
636+ property var sourcesModelEmptyWithFallback: {
637+ "sources": [
638+ "../../graphics/phone_background.jpg",
639+ "../../graphics/tablet_background.jpg",
640+ "../../../tests/graphics/clock@18.png",
641+ ""
642+ ]
643+ , "fallback": "../../../tests/graphics/clock@18.png"
644+ }
645+
646 PreviewImageGallery {
647 id: imageGallery
648 width: parent.width
649@@ -123,5 +133,14 @@
650 image3 = findChild(imageGallery, "previewImage3");
651 tryCompare(image3, "state", "ready");
652 }
653+
654+ function test_empty_fallback() {
655+ var image3 = findChild(imageGallery, "previewImage3");
656+ tryCompare(image3, "state", "error");
657+ imageGallery.widgetData = sourcesModel0;
658+ imageGallery.widgetData = sourcesModelEmptyWithFallback;
659+ image3 = findChild(imageGallery, "previewImage3");
660+ tryCompare(image3, "state", "ready");
661+ }
662 }
663 }
664
665=== modified file 'tests/qmltests/Dash/Previews/tst_PreviewZoomableImage.qml'
666--- tests/qmltests/Dash/Previews/tst_PreviewZoomableImage.qml 2015-11-04 14:57:13 +0000
667+++ tests/qmltests/Dash/Previews/tst_PreviewZoomableImage.qml 2016-02-11 13:14:08 +0000
668@@ -39,6 +39,11 @@
669 "fallback": "../../graphics/phone_background.jpg"
670 }
671
672+ property var widgetData3: {
673+ "source": "",
674+ "fallback": "../../graphics/phone_background.jpg"
675+ }
676+
677 Loader {
678 id: loader
679 width: parent.width
680@@ -100,5 +105,12 @@
681 waitForRendering(lazyImage);
682 tryCompare(lazyImage, "state", "ready");
683 }
684+
685+ function test_emptyfallback() {
686+ zoomableImage.widgetData = widgetData3;
687+ waitForRendering(zoomableImage);
688+ waitForRendering(lazyImage);
689+ tryCompare(lazyImage, "state", "ready");
690+ }
691 }
692 }
693
694=== modified file 'tests/qmltests/Dash/tst_Card.qml'
695--- tests/qmltests/Dash/tst_Card.qml 2016-01-29 11:50:37 +0000
696+++ tests/qmltests/Dash/tst_Card.qml 2016-02-11 13:14:08 +0000
697@@ -130,7 +130,6 @@
698 sourceComponent: cardTool.cardComponent
699 clip: true
700 onLoaded: {
701- item.components = Qt.binding(function() { return cardTool.components; });
702 item.cardData = Qt.binding(function() { return Helpers.mapData(dataArea.text, cardTool.components, dataError); });
703 item.width = Qt.binding(function() { return cardTool.cardWidth || item.implicitWidth; });
704 item.height = Qt.binding(function() { return cardTool.cardHeight || item.implicitHeight; });
705@@ -476,6 +475,15 @@
706 card.cardDataChanged();
707 waitForRendering(card);
708 tryCompare(art, "visible", true);
709+ compare(artImage.source, Qt.resolvedUrl("artwork/emblem.png"));
710+
711+ cardTool.components["art"]["fallback"] = Qt.resolvedUrl("artwork/checkers.png");
712+ cardTool.componentsChanged();
713+ card.cardData["art"] = "";
714+ card.cardDataChanged();
715+ waitForRendering(card);
716+ tryCompare(art, "visible", true);
717+ compare(artImage.source, Qt.resolvedUrl("artwork/checkers.png"));
718
719 card.cardData["mascot"] = "somethingbroken2";
720 card.cardDataChanged();
721@@ -487,6 +495,15 @@
722 card.cardDataChanged();
723 waitForRendering(card);
724 tryCompare(mascotImage, "status", Image.Ready);
725+ compare(mascotImage.source, Qt.resolvedUrl("artwork/emblem.png"));
726+
727+ cardTool.components["mascot"] = {"fallback": Qt.resolvedUrl("artwork/checkers.png")};
728+ cardTool.componentsChanged();
729+ card.cardData["mascot"] = "";
730+ card.cardDataChanged();
731+ waitForRendering(card);
732+ tryCompare(mascotImage, "status", Image.Ready);
733+ compare(mascotImage.source, Qt.resolvedUrl("artwork/checkers.png"));
734 }
735
736 function test_font_weights_data() {
737
738=== modified file 'tests/qmltests/Dash/tst_CardBenchmark.qml'
739--- tests/qmltests/Dash/tst_CardBenchmark.qml 2015-07-15 15:07:19 +0000
740+++ tests/qmltests/Dash/tst_CardBenchmark.qml 2016-02-11 13:14:08 +0000
741@@ -61,8 +61,6 @@
742 item.width = Qt.binding(function() { return cardTool.cardWidth || implicitWidth; });
743 item.height = Qt.binding(function() { return cardTool.cardHeight || implicitHeight; });
744 item.cardData = Qt.binding(function() { return Helpers.mapData(root.cardData, cardTool.components); });
745- item.template = Qt.binding(function() { return cardTool.template; });
746- item.components = Qt.binding(function() { return cardTool.components; });
747 }
748 }
749 }

Subscribers

People subscribed via source and target branches