Merge lp:~cimi/unity8/card_emblems_single_container into lp:unity8

Proposed by Andrea Cimitan
Status: Rejected
Rejected by: Michał Sawicz
Proposed branch: lp:~cimi/unity8/card_emblems_single_container
Merge into: lp:unity8
Diff against target: 1046 lines (+524/-286)
11 files modified
plugins/Dash/CardCreator.js (+111/-28)
tests/plugins/Dash/cardcreator/1.res (+2/-1)
tests/plugins/Dash/cardcreator/2.res (+94/-89)
tests/plugins/Dash/cardcreator/3.res (+50/-48)
tests/plugins/Dash/cardcreator/4.res (+72/-68)
tests/plugins/Dash/cardcreator/5.res (+50/-50)
tests/plugins/Dash/cardcreator/6.res (+115/-0)
tests/plugins/Dash/cardcreator/6.tst (+3/-0)
tests/plugins/Dash/cardcreatortest.cpp (+8/-2)
tests/qmltests/Dash/CardHelpers.js (+1/-0)
tests/qmltests/Dash/tst_Card.qml (+18/-0)
To merge this branch: bzr merge lp:~cimi/unity8/card_emblems_single_container
Reviewer Review Type Date Requested Status
Michał Sawicz Disapprove
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Needs Fixing
Review via email: mp+223899@code.launchpad.net

Commit message

Add emblems using a single container

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
No
 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
 * Did you make sure that your branch does not contain spurious tags?
Yes
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
941. By Andrea Cimitan

var rename

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

hi. For kHeader[2|3]ContainerCode. Can we have a more generic one that can have arbitrary fields?

I've wrote a function in https://code.launchpad.net/~paulliu/unity8/attribute/+merge/223242

For example, the function kHeaderColumnCodeGenerator()

Because I'll also need to add more childs for attribute UI later.

Revision history for this message
Andrea Cimitan (cimi) wrote :

> hi. For kHeader[2|3]ContainerCode. Can we have a more generic one that can
> have arbitrary fields?
>
> I've wrote a function in
> https://code.launchpad.net/~paulliu/unity8/attribute/+merge/223242
>
> For example, the function kHeaderColumnCodeGenerator()
>
> Because I'll also need to add more childs for attribute UI later.
Ok, will do it tomorrow

942. By Andrea Cimitan

[ Ying-Chun Liu ]
* Add logout support. Reviewed by: Daniel d'Andrada (LP: #1302213)
[ Michał Sawicz ]
* Make so that fixedArtShapeSize actually fixes artShapeSize.
[ Albert Astals ]
* Add VerticalJournal integration to Dash/scopes/QML (LP: #1326467)
* Make so that fixedArtShapeSize actually fixes artShapeSize.
[ Mirco Müller ]
* Added the frontend-part of sound-hint support for notifications with
  updated QML-tests.
* New rebuild forced
[ Albert Astals ]
* Departments support (LP: #1320847)

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

Text conflict in tests/plugins/Dash/cardcreator/3.res
1 conflicts encountered.

review: Needs Fixing
943. By Andrea Cimitan

[ Michael Terry ]
* Fix path in launcher mock after moving our mock icons, to avoid a
  lot of "icon not found" warnings during qmluitests.
* Fix the testMultiGreeter qmluitest. Incoming method variables are
  apparently read-only in Qt5.3. (LP: #1332488)
[ CI bot ]
* Resync trunk
[ Michał Sawicz ]
* Adapt scope mock to new api and quiet unused variable warnings.
* Fix dynamic overlay height. (LP: #1334879)
* Don't center items in CardVerticalJournal, kind of beats the
  purpose... Also don't bind unnecessarily.
[ Ying-Chun Liu ]
* Fix LP:1330957 Fix some failed test cases. (LP: #1330957)
[ Albert Astals ]
* Don't seem to need this waitForRendering And makes test fail in 5.3
[ Alberto Aguirre ]
* Update Powerd plugin and Shell.qml to accommodate changes in the
  display power state notification.

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)
Revision history for this message
Michał Sawicz (saviq) wrote :

All the whitespace changes should not be here.

Can you experiment using a GridLayout for mascot, title, subtitle and emblem? Or maybe just (sub)title and emblem, vcentering might be tricky otherwise.

Also see inline.

review: Needs Fixing
Revision history for this message
Albert Astals Cid (aacid) wrote :

Text conflict in tests/plugins/Dash/cardcreator/2.res
Text conflict in tests/plugins/Dash/cardcreator/3.res
Text conflict in tests/plugins/Dash/cardcreator/4.res
Text conflict in tests/plugins/Dash/cardcreator/5.res
Conflict adding file tests/plugins/Dash/cardcreator/6.res. Moved existing file to tests/plugins/Dash/cardcreator/6.res.moved.
Conflict adding file tests/plugins/Dash/cardcreator/6.tst. Moved existing file to tests/plugins/Dash/cardcreator/6.tst.moved.
6 conflicts encountered.

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

Unmerged revisions

943. By Andrea Cimitan

[ Michael Terry ]
* Fix path in launcher mock after moving our mock icons, to avoid a
  lot of "icon not found" warnings during qmluitests.
* Fix the testMultiGreeter qmluitest. Incoming method variables are
  apparently read-only in Qt5.3. (LP: #1332488)
[ CI bot ]
* Resync trunk
[ Michał Sawicz ]
* Adapt scope mock to new api and quiet unused variable warnings.
* Fix dynamic overlay height. (LP: #1334879)
* Don't center items in CardVerticalJournal, kind of beats the
  purpose... Also don't bind unnecessarily.
[ Ying-Chun Liu ]
* Fix LP:1330957 Fix some failed test cases. (LP: #1330957)
[ Albert Astals ]
* Don't seem to need this waitForRendering And makes test fail in 5.3
[ Alberto Aguirre ]
* Update Powerd plugin and Shell.qml to accommodate changes in the
  display power state notification.

942. By Andrea Cimitan

[ Ying-Chun Liu ]
* Add logout support. Reviewed by: Daniel d'Andrada (LP: #1302213)
[ Michał Sawicz ]
* Make so that fixedArtShapeSize actually fixes artShapeSize.
[ Albert Astals ]
* Add VerticalJournal integration to Dash/scopes/QML (LP: #1326467)
* Make so that fixedArtShapeSize actually fixes artShapeSize.
[ Mirco Müller ]
* Added the frontend-part of sound-hint support for notifications with
  updated QML-tests.
* New rebuild forced
[ Albert Astals ]
* Departments support (LP: #1320847)

941. By Andrea Cimitan

var rename

940. By Andrea Cimitan

Works

939. By Andrea Cimitan

WIP AND BROKEN

938. By Andrea Cimitan

Add parsing test for emblem

937. By Andrea Cimitan

Add tests for emblem

936. By Andrea Cimitan

Test pass again

935. By Andrea Cimitan

Some fixes for the emblem

934. By Andrea Cimitan

Better tests

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 2014-06-27 08:47:33 +0000
3+++ plugins/Dash/CardCreator.js 2014-06-27 14:25:45 +0000
4@@ -181,15 +181,35 @@
5 ] \n\
6 }\n';
7
8-// %1 is used as first child of the column
9-// %2 is used as second child of the column
10-var kHeaderColumnCode = 'Column { \n\
11- anchors.verticalCenter: parent.verticalCenter; \n\
12- spacing: units.dp(2); \n\
13- width: parent.width - x;\n\
14- data: [ %1\n\
15- ,\n\
16- %2 \n\
17+// %1 is used as anchors
18+// %2 is used as height of the container
19+// %3 is used as first child of the container
20+// %4 is used as second child of the container
21+var kHeader2ContainerCode = 'Item { \n\
22+ id: headerTitleContainer; \n\
23+ anchors { %1 } \n\
24+ width: parent.width - x; \n\
25+ implicitHeight: %2; \n\
26+ data: [ %3\n\
27+ ,\n\
28+ %4 \n\
29+ ] \n\
30+ }\n';
31+
32+// %1 is used as anchors
33+// %2 is used as first child of the container
34+// %3 is used as second child of the container
35+// %4 is used as third child of the container
36+var kHeader3ContainerCode = 'Item { \n\
37+ id: headerTitleContainer; \n\
38+ anchors { %1 } \n\
39+ width: parent.width - x; \n\
40+ implicitHeight: titleLabel.height + subtitleLabel.height; \n\
41+ data: [ %2\n\
42+ ,\n\
43+ %3 \n\
44+ ,\n\
45+ %4 \n\
46 ] \n\
47 }\n';
48
49@@ -242,12 +262,25 @@
50 horizontalAlignment: root.headerAlignment; \n\
51 }\n';
52
53+var kEmblemImageCode = 'Image { \n\
54+ id: emblemImage; \n\
55+ objectName: "emblemImage"; \n\
56+ anchors { \n\
57+ bottom: titleLabel.baseline; \n\
58+ right: parent.right; \n\ } \n\
59+ source: cardData && cardData["emblem"]; \n\
60+ width: height; \n\
61+ height: titleLabel.font.pixelSize; \n\
62+ fillMode: Image.PreserveAspectFit; \n\
63+ }\n';
64+
65 // %1 is used as anchors of subtitleLabel
66 // %2 is used as color of subtitleLabel
67 var kSubtitleLabelCode = 'Label { \n\
68 id: subtitleLabel; \n\
69 objectName: "subtitleLabel"; \n\
70 anchors { %1 } \n\
71+ anchors.topMargin: units.dp(2); \n\
72 elide: Text.ElideRight; \n\
73 fontSize: "small"; \n\
74 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\
75@@ -304,6 +337,7 @@
76 var hasBackground = !isHorizontal && (template["card-background"] || components["background"] || artAndSummary);
77 var hasTitle = components["title"] || false;
78 var hasMascot = components["mascot"] || false;
79+ var hasEmblem = components["emblem"] && !(hasMascot && template["card-size"] === "small") || false;
80 var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot);
81 var hasSubtitle = components["subtitle"] || false;
82 var hasHeaderRow = hasMascot && hasTitle;
83@@ -424,24 +458,44 @@
84
85 var titleAnchors;
86 var subtitleAnchors;
87- if (hasMascot && hasSubtitle) {
88- // Using row + column
89- titleAnchors = 'left: parent.left; right: parent.right';
90- subtitleAnchors = titleAnchors;
91+ var titleRightAnchor;
92+ var titleContainerAnchors;
93+
94+ if (hasMascot) {
95+ titleContainerAnchors = 'verticalCenter: parent.verticalCenter; ';
96+ } else {
97+ titleContainerAnchors = 'right: parent.right; ';
98+ titleContainerAnchors += headerLeftAnchor;
99+ titleContainerAnchors += headerVerticalAnchors;
100+ }
101+ if (hasEmblem) {
102+ titleRightAnchor = 'right: emblemImage.left;\n';
103+ } else {
104+ titleRightAnchor = 'right: parent.right;\n';
105+ }
106+
107+ if (hasEmblem || (hasMascot && hasSubtitle)) {
108+ // Using titleContainer (and maybe row)
109+ titleAnchors = titleRightAnchor;
110+ titleAnchors += 'left: parent.left;\n\
111+ top: parent.top;';
112+ subtitleAnchors = 'right: parent.right;\n\
113+ left: parent.left;\n\
114+ top: titleLabel.bottom;\n';
115 } else if (hasMascot) {
116- // Using row + label
117- titleAnchors = 'verticalCenter: parent.verticalCenter;\n'
118+ // Using row + titleContainer
119+ titleAnchors = 'verticalCenter: parent.verticalCenter;\n';
120 } else {
121 if (headerAsOverlay) {
122 // Using anchors to the overlay
123- titleAnchors = 'left: parent.left; \n\
124- leftMargin: units.gu(1); \n\
125- right: parent.right; \n\
126- top: overlayLoader.top; \n\
127- topMargin: units.gu(1);\n';
128+ titleAnchors = titleRightAnchor;
129+ titleAnchors += 'left: parent.left; \n\
130+ leftMargin: units.gu(1); \n\
131+ top: overlayLoader.top; \n\
132+ topMargin: units.gu(1);\n';
133 } else {
134 // Using anchors to the mascot/parent
135- titleAnchors = "right: parent.right;";
136+ titleAnchors = titleRightAnchor;
137 titleAnchors += headerLeftAnchor;
138 titleAnchors += headerVerticalAnchors;
139 if (!headerLeftAnchorHasMargin) {
140@@ -450,22 +504,34 @@
141 }
142 subtitleAnchors = 'left: titleLabel.left; \n\
143 leftMargin: titleLabel.leftMargin; \n\
144- right: titleLabel.right; \n\
145- top: titleLabel.bottom; \n\
146- topMargin: units.dp(2);\n';
147+ top: titleLabel.bottom;\n';
148+ if (hasEmblem) {
149+ // using container
150+ subtitleAnchors += 'right: parent.right; \n';
151+ } else {
152+ subtitleAnchors += 'right: titleLabel.right; \n';
153+ }
154 }
155
156 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
157- var titleCode = kTitleLabelCode.arg(titleAnchors).arg(color).arg(titleLabelVisibleExtra);
158+ var titleCode;
159+ titleCode = kTitleLabelCode.arg(titleAnchors).arg(color).arg(titleLabelVisibleExtra);
160 var subtitleCode = "";
161 if (hasSubtitle) {
162 subtitleCode += kSubtitleLabelCode.arg(subtitleAnchors).arg(color);
163 }
164
165- if (hasMascot && hasSubtitle) {
166- // If using row + column wrap the code in the column
167- titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
168+ if (hasEmblem && hasSubtitle) {
169+ // using container 3
170+ titleSubtitleCode = kHeader3ContainerCode.arg(titleContainerAnchors).arg(titleCode).arg(kEmblemImageCode).arg(kSubtitleLabelCode.arg(subtitleAnchors).arg(color));
171+ } else if (hasEmblem) {
172+ // container with emblem
173+ titleSubtitleCode = kHeader2ContainerCode.arg(titleContainerAnchors).arg('titleLabel.height').arg(titleCode).arg(kEmblemImageCode);
174+ } else if (hasMascot && hasSubtitle) {
175+ // container with subtitle
176+ titleSubtitleCode = kHeader2ContainerCode.arg(titleContainerAnchors).arg('titleLabel.height + subtitleLabel.height').arg(titleCode).arg(subtitleCode);
177 } else {
178+ // no container
179 titleSubtitleCode = titleCode + subtitleCode;
180 }
181 }
182@@ -485,6 +551,7 @@
183 if (isHorizontal && hasArt) summaryTopAnchor = "artShapeHolder.bottom";
184 else if (headerAsOverlay && hasArt) summaryTopAnchor = "artShapeHolder.bottom";
185 else if (hasHeaderRow) summaryTopAnchor = "row.bottom";
186+ else if (hasEmblem || (hasMascot && hasSubtitle)) summaryTopAnchor = "headerTitleContainer.bottom";
187 else if (hasMascot) summaryTopAnchor = "mascotImage.bottom";
188 else if (hasSubtitle) summaryTopAnchor = "subtitleLabel.bottom";
189 else if (hasTitle) summaryTopAnchor = "titleLabel.bottom";
190@@ -526,5 +593,21 @@
191 import Ubuntu.Thumbnailer 0.1;\n';
192 var card = cardString(template, components);
193 var code = imports + 'Component {\n' + card + '}\n';
194+
195+// var splitCode = code.split("\n");
196+// for (var i = 0; i < splitCode.length; ++i) {
197+// var lineNumber = i;
198+// if (i < 10) {
199+// lineNumber = lineNumber + " |";
200+// } else if (i < 100) {
201+// lineNumber = lineNumber + " |";
202+// } else if (i < 1000) {
203+// lineNumber = lineNumber + " |";
204+// } else {
205+// lineNumber = lineNumber + "|";
206+// }
207+// console.log(lineNumber, splitCode[i]);
208+// }
209+
210 return Qt.createQmlObject(code, parent, "createCardComponent");
211 }
212
213=== modified file 'tests/plugins/Dash/cardcreator/1.res'
214--- tests/plugins/Dash/cardcreator/1.res 2014-06-27 08:47:04 +0000
215+++ tests/plugins/Dash/cardcreator/1.res 2014-06-27 14:25:45 +0000
216@@ -65,7 +65,8 @@
217 Label {
218 id: titleLabel;
219 objectName: "titleLabel";
220- anchors { right: parent.right;left: parent.left;
221+ anchors { right: parent.right;
222+left: parent.left;
223 top: artShapeHolder.bottom;
224 topMargin: units.gu(1);
225 leftMargin: units.gu(1);
226
227=== modified file 'tests/plugins/Dash/cardcreator/2.res'
228--- tests/plugins/Dash/cardcreator/2.res 2014-06-18 10:26:01 +0000
229+++ tests/plugins/Dash/cardcreator/2.res 2014-06-27 14:25:45 +0000
230@@ -1,49 +1,49 @@
231-AbstractButton {
232- id: root;
233- property var template;
234- property var components;
235- property var cardData;
236- property var artShapeBorderSource: undefined;
237- property real fontScale: 1.0;
238- property int headerAlignment: Text.AlignLeft;
239- property int fixedHeaderHeight: -1;
240- property size fixedArtShapeSize: Qt.size(-1, -1);
241- readonly property string title: cardData && cardData["title"] || "";
242- property bool asynchronous: true;
243- property bool showHeader: true;
244- implicitWidth: childrenRect.width;
245+AbstractButton {
246+ id: root;
247+ property var template;
248+ property var components;
249+ property var cardData;
250+ property var artShapeBorderSource: undefined;
251+ property real fontScale: 1.0;
252+ property int headerAlignment: Text.AlignLeft;
253+ property int fixedHeaderHeight: -1;
254+ property size fixedArtShapeSize: Qt.size(-1, -1);
255+ readonly property string title: cardData && cardData["title"] || "";
256+ property bool asynchronous: true;
257+ property bool showHeader: true;
258+ implicitWidth: childrenRect.width;
259 Loader {
260- id: backgroundLoader;
261- objectName: "backgroundLoader";
262- anchors.fill: parent;
263- asynchronous: root.asynchronous;
264- visible: status == Loader.Ready;
265- sourceComponent: UbuntuShape {
266- objectName: "background";
267- radius: "medium";
268- color: getColor(0) || "white";
269- gradientColor: getColor(1) || color;
270- anchors.fill: parent;
271- image: backgroundImage.source ? backgroundImage : null;
272- property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
273- property Image backgroundImage: Image {
274- objectName: "backgroundImage";
275- source: {
276- if (cardData && typeof cardData["background"] === "string") return cardData["background"];
277- else if (template && typeof template["card-background"] === "string") return template["card-background"];
278- else return "";
279- }
280- }
281- function getColor(index) {
282- if (cardData && typeof cardData["background"] === "object"
283- && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
284- return cardData["background"]["elements"][index];
285- } else if (template && typeof template["card-background"] === "object"
286- && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) {
287- return template["card-background"]["elements"][index];
288- } else return undefined;
289- }
290- }
291+ id: backgroundLoader;
292+ objectName: "backgroundLoader";
293+ anchors.fill: parent;
294+ asynchronous: root.asynchronous;
295+ visible: status == Loader.Ready;
296+ sourceComponent: UbuntuShape {
297+ objectName: "background";
298+ radius: "medium";
299+ color: getColor(0) || "white";
300+ gradientColor: getColor(1) || color;
301+ anchors.fill: parent;
302+ image: backgroundImage.source ? backgroundImage : null;
303+ property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
304+ property Image backgroundImage: Image {
305+ objectName: "backgroundImage";
306+ source: {
307+ if (cardData && typeof cardData["background"] === "string") return cardData["background"];
308+ else if (template && typeof template["card-background"] === "string") return template["card-background"];
309+ else return "";
310+ }
311+ }
312+ function getColor(index) {
313+ if (cardData && typeof cardData["background"] === "object"
314+ && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
315+ return cardData["background"]["elements"][index];
316+ } else if (template && typeof template["card-background"] === "object"
317+ && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) {
318+ return template["card-background"]["elements"][index];
319+ } else return undefined;
320+ }
321+ }
322 }
323 readonly property size artShapeSize: Qt.size(-1, -1);
324 readonly property int headerHeight: row.height;
325@@ -57,57 +57,62 @@
326 topMargin: units.gu(1);
327 left: parent.left;
328 }
329- anchors.right: parent.right;
330+ anchors.right: parent.right;
331 anchors.margins: margins;
332-data: [ Image {
333- id: mascotImage;
334- objectName: "mascotImage";
335+data: [ Image {
336+ id: mascotImage;
337+ objectName: "mascotImage";
338 anchors { verticalCenter: parent.verticalCenter; }
339- readonly property int maxSize: Math.max(width, height) * 4;
340- source: cardData && cardData["mascot"];
341- width: units.gu(6);
342- height: units.gu(5.625);
343- sourceSize { width: maxSize; height: maxSize }
344- fillMode: Image.PreserveAspectCrop;
345- horizontalAlignment: Image.AlignHCenter;
346- verticalAlignment: Image.AlignVCenter;
347- visible: showHeader;
348+ readonly property int maxSize: Math.max(width, height) * 4;
349+ source: cardData && cardData["mascot"];
350+ width: units.gu(6);
351+ height: units.gu(5.625);
352+ sourceSize { width: maxSize; height: maxSize }
353+ fillMode: Image.PreserveAspectCrop;
354+ horizontalAlignment: Image.AlignHCenter;
355+ verticalAlignment: Image.AlignVCenter;
356+ visible: showHeader;
357 }
358 ,
359-Column {
360- anchors.verticalCenter: parent.verticalCenter;
361- spacing: units.dp(2);
362+Item {
363+ id: headerTitleContainer;
364+ anchors { verticalCenter: parent.verticalCenter; }
365 width: parent.width - x;
366- data: [
367-Label {
368- id: titleLabel;
369- objectName: "titleLabel";
370- anchors { left: parent.left; right: parent.right }
371- elide: Text.ElideRight;
372- fontSize: "small";
373- wrapMode: Text.Wrap;
374- maximumLineCount: 2;
375- font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
376- color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : "grey";
377- visible: showHeader ;
378- text: root.title;
379- font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
380- horizontalAlignment: root.headerAlignment;
381+ implicitHeight: titleLabel.height + subtitleLabel.height;
382+ data: [ Label {
383+ id: titleLabel;
384+ objectName: "titleLabel";
385+ anchors { right: parent.right;
386+ left: parent.left;
387+ top: parent.top; }
388+ elide: Text.ElideRight;
389+ fontSize: "small";
390+ wrapMode: Text.Wrap;
391+ maximumLineCount: 2;
392+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
393+ color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : "grey";
394+ visible: showHeader ;
395+ text: root.title;
396+ font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
397+ horizontalAlignment: root.headerAlignment;
398 }
399 ,
400-Label {
401- id: subtitleLabel;
402- objectName: "subtitleLabel";
403- anchors { left: parent.left; right: parent.right }
404-
405- elide: Text.ElideRight;
406- fontSize: "small";
407- font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
408- color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : "grey";
409- visible: titleLabel.visible && titleLabel.text;
410- text: cardData && cardData["subtitle"] || "";
411- font.weight: Font.Light;
412- horizontalAlignment: root.headerAlignment;
413+Label {
414+ id: subtitleLabel;
415+ objectName: "subtitleLabel";
416+ anchors { right: parent.right;
417+ left: parent.left;
418+ top: titleLabel.bottom;
419+ }
420+ anchors.topMargin: units.dp(2);
421+ elide: Text.ElideRight;
422+ fontSize: "small";
423+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
424+ color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : "grey";
425+ visible: titleLabel.visible && titleLabel.text;
426+ text: cardData && cardData["subtitle"] || "";
427+ font.weight: Font.Light;
428+ horizontalAlignment: root.headerAlignment;
429 }
430 ]
431 }
432
433=== modified file 'tests/plugins/Dash/cardcreator/3.res'
434--- tests/plugins/Dash/cardcreator/3.res 2014-06-27 08:47:04 +0000
435+++ tests/plugins/Dash/cardcreator/3.res 2014-06-27 14:25:45 +0000
436@@ -1,18 +1,18 @@
437-AbstractButton {
438- id: root;
439- property var template;
440- property var components;
441- property var cardData;
442- property var artShapeBorderSource: undefined;
443- property real fontScale: 1.0;
444- property int headerAlignment: Text.AlignLeft;
445- property int fixedHeaderHeight: -1;
446- property size fixedArtShapeSize: Qt.size(-1, -1);
447- readonly property string title: cardData && cardData["title"] || "";
448- property bool asynchronous: true;
449- property bool showHeader: true;
450- implicitWidth: childrenRect.width;
451-onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
452+AbstractButton {
453+ id: root;
454+ property var template;
455+ property var components;
456+ property var cardData;
457+ property var artShapeBorderSource: undefined;
458+ property real fontScale: 1.0;
459+ property int headerAlignment: Text.AlignLeft;
460+ property int fixedHeaderHeight: -1;
461+ property size fixedArtShapeSize: Qt.size(-1, -1);
462+ readonly property string title: cardData && cardData["title"] || "";
463+ property bool asynchronous: true;
464+ property bool showHeader: true;
465+ implicitWidth: childrenRect.width;
466+onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
467 readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
468 Item {
469 id: artShapeHolder;
470@@ -57,46 +57,48 @@
471 readonly property real aspect: implicitWidth / implicitHeight;
472 width: root.width;
473 height: width / artShape.aspect;
474- }
475- }
476- }
477+ }
478+ }
479+ }
480 }
481 readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
482 Label {
483 id: titleLabel;
484 objectName: "titleLabel";
485- anchors { right: parent.right;left: parent.left;
486-top: artShapeHolder.bottom;
487- topMargin: units.gu(1);
488-leftMargin: units.gu(1);
489+ anchors { right: parent.right;
490+ left: parent.left;
491+ top: artShapeHolder.bottom;
492+ topMargin: units.gu(1);
493+ leftMargin: units.gu(1);
494 }
495- elide: Text.ElideRight;
496- fontSize: "small";
497- wrapMode: Text.Wrap;
498- maximumLineCount: 2;
499- font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
500- color: "grey";
501- visible: showHeader ;
502- text: root.title;
503- font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
504- horizontalAlignment: root.headerAlignment;
505+ elide: Text.ElideRight;
506+ fontSize: "small";
507+ wrapMode: Text.Wrap;
508+ maximumLineCount: 2;
509+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
510+ color: "grey";
511+ visible: showHeader ;
512+ text: root.title;
513+ font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
514+ horizontalAlignment: root.headerAlignment;
515 }
516-Label {
517- id: subtitleLabel;
518- objectName: "subtitleLabel";
519- anchors { left: titleLabel.left;
520- leftMargin: titleLabel.leftMargin;
521- right: titleLabel.right;
522- top: titleLabel.bottom;
523- topMargin: units.dp(2); }
524- elide: Text.ElideRight;
525- fontSize: "small";
526- font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
527- color: "grey";
528- visible: titleLabel.visible && titleLabel.text;
529- text: cardData && cardData["subtitle"] || "";
530- font.weight: Font.Light;
531- horizontalAlignment: root.headerAlignment;
532+Label {
533+ id: subtitleLabel;
534+ objectName: "subtitleLabel";
535+ anchors { left: titleLabel.left;
536+ leftMargin: titleLabel.leftMargin;
537+ top: titleLabel.bottom;
538+ right: titleLabel.right;
539+ }
540+ anchors.topMargin: units.dp(2);
541+ elide: Text.ElideRight;
542+ fontSize: "small";
543+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
544+ color: "grey";
545+ visible: titleLabel.visible && titleLabel.text;
546+ text: cardData && cardData["subtitle"] || "";
547+ font.weight: Font.Light;
548+ horizontalAlignment: root.headerAlignment;
549 }
550 implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
551 }
552
553=== modified file 'tests/plugins/Dash/cardcreator/4.res'
554--- tests/plugins/Dash/cardcreator/4.res 2014-06-18 10:26:01 +0000
555+++ tests/plugins/Dash/cardcreator/4.res 2014-06-27 14:25:45 +0000
556@@ -1,17 +1,17 @@
557-AbstractButton {
558- id: root;
559- property var template;
560- property var components;
561- property var cardData;
562- property var artShapeBorderSource: undefined;
563- property real fontScale: 1.0;
564- property int headerAlignment: Text.AlignLeft;
565- property int fixedHeaderHeight: -1;
566- property size fixedArtShapeSize: Qt.size(-1, -1);
567- readonly property string title: cardData && cardData["title"] || "";
568- property bool asynchronous: true;
569- property bool showHeader: true;
570- implicitWidth: childrenRect.width;
571+AbstractButton {
572+ id: root;
573+ property var template;
574+ property var components;
575+ property var cardData;
576+ property var artShapeBorderSource: undefined;
577+ property real fontScale: 1.0;
578+ property int headerAlignment: Text.AlignLeft;
579+ property int fixedHeaderHeight: -1;
580+ property size fixedArtShapeSize: Qt.size(-1, -1);
581+ readonly property string title: cardData && cardData["title"] || "";
582+ property bool asynchronous: true;
583+ property bool showHeader: true;
584+ implicitWidth: childrenRect.width;
585 readonly property size artShapeSize: Qt.size(-1, -1);
586 readonly property int headerHeight: row.height;
587 Row {
588@@ -24,70 +24,74 @@
589 topMargin: units.gu(1);
590 left: parent.left;
591 }
592- anchors.right: parent.right;
593+ anchors.right: parent.right;
594 anchors.margins: margins;
595-data: [ Loader {
596- id: mascotShapeLoader;
597- objectName: "mascotShapeLoader";
598- asynchronous: root.asynchronous;
599- active: mascotImage.status === Image.Ready;
600- visible: showHeader && active && status == Loader.Ready;
601- width: units.gu(6);
602- height: units.gu(5.625);
603- sourceComponent: UbuntuShape { image: mascotImage }
604+data: [ Loader {
605+ id: mascotShapeLoader;
606+ objectName: "mascotShapeLoader";
607+ asynchronous: root.asynchronous;
608+ active: mascotImage.status === Image.Ready;
609+ visible: showHeader && active && status == Loader.Ready;
610+ width: units.gu(6);
611+ height: units.gu(5.625);
612+ sourceComponent: UbuntuShape { image: mascotImage }
613 anchors { verticalCenter: parent.verticalCenter; }
614 }
615-
616 ,
617-Image {
618- id: mascotImage;
619- objectName: "mascotImage";
620+Image {
621+ id: mascotImage;
622+ objectName: "mascotImage";
623 anchors { verticalCenter: parent.verticalCenter; }
624- readonly property int maxSize: Math.max(width, height) * 4;
625- source: cardData && cardData["mascot"];
626- width: units.gu(6);
627- height: units.gu(5.625);
628- sourceSize { width: maxSize; height: maxSize }
629- fillMode: Image.PreserveAspectCrop;
630- horizontalAlignment: Image.AlignHCenter;
631- verticalAlignment: Image.AlignVCenter;
632- visible: false;
633+ readonly property int maxSize: Math.max(width, height) * 4;
634+ source: cardData && cardData["mascot"];
635+ width: units.gu(6);
636+ height: units.gu(5.625);
637+ sourceSize { width: maxSize; height: maxSize }
638+ fillMode: Image.PreserveAspectCrop;
639+ horizontalAlignment: Image.AlignHCenter;
640+ verticalAlignment: Image.AlignVCenter;
641+ visible: false;
642 }
643-
644 ,
645-Column {
646- anchors.verticalCenter: parent.verticalCenter;
647- spacing: units.dp(2);
648+Item {
649+ id: headerTitleContainer;
650+ anchors { verticalCenter: parent.verticalCenter; }
651 width: parent.width - x;
652-data: [ Label {
653- id: titleLabel;
654- objectName: "titleLabel";
655- anchors { left: parent.left; right: parent.right }
656- elide: Text.ElideRight;
657- fontSize: "small";
658- wrapMode: Text.Wrap;
659- maximumLineCount: 2;
660- font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
661- color: "grey";
662- visible: showHeader ;
663- text: root.title;
664- font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
665- horizontalAlignment: root.headerAlignment;
666+ implicitHeight: titleLabel.height + subtitleLabel.height;
667+data: [ Label {
668+ id: titleLabel;
669+ objectName: "titleLabel";
670+ anchors { right: parent.right;
671+ left: parent.left;
672+ top: parent.top; }
673+ elide: Text.ElideRight;
674+ fontSize: "small";
675+ wrapMode: Text.Wrap;
676+ maximumLineCount: 2;
677+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
678+ color: "grey";
679+ visible: showHeader ;
680+ text: root.title;
681+ font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
682+ horizontalAlignment: root.headerAlignment;
683 }
684 ,
685-Label {
686- id: subtitleLabel;
687- objectName: "subtitleLabel";
688- anchors { left: parent.left; right: parent.right }
689-
690- elide: Text.ElideRight;
691- fontSize: "small";
692- font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
693- color: "grey";
694- visible: titleLabel.visible && titleLabel.text;
695- text: cardData && cardData["subtitle"] || "";
696- font.weight: Font.Light;
697- horizontalAlignment: root.headerAlignment;
698+Label {
699+ id: subtitleLabel;
700+ objectName: "subtitleLabel";
701+ anchors { right: parent.right;
702+ left: parent.left;
703+ top: titleLabel.bottom;
704+ }
705+ anchors.topMargin: units.dp(2);
706+ elide: Text.ElideRight;
707+ fontSize: "small";
708+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
709+ color: "grey";
710+ visible: titleLabel.visible && titleLabel.text;
711+ text: cardData && cardData["subtitle"] || "";
712+ font.weight: Font.Light;
713+ horizontalAlignment: root.headerAlignment;
714 }
715 ]
716 }
717
718=== modified file 'tests/plugins/Dash/cardcreator/5.res'
719--- tests/plugins/Dash/cardcreator/5.res 2014-06-24 11:08:23 +0000
720+++ tests/plugins/Dash/cardcreator/5.res 2014-06-27 14:25:45 +0000
721@@ -1,18 +1,18 @@
722-AbstractButton {
723- id: root;
724- property var template;
725- property var components;
726- property var cardData;
727- property var artShapeBorderSource: undefined;
728- property real fontScale: 1.0;
729- property int headerAlignment: Text.AlignLeft;
730- property int fixedHeaderHeight: -1;
731- property size fixedArtShapeSize: Qt.size(-1, -1);
732- readonly property string title: cardData && cardData["title"] || "";
733- property bool asynchronous: true;
734- property bool showHeader: true;
735- implicitWidth: childrenRect.width;
736-onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
737+AbstractButton {
738+ id: root;
739+ property var template;
740+ property var components;
741+ property var cardData;
742+ property var artShapeBorderSource: undefined;
743+ property real fontScale: 1.0;
744+ property int headerAlignment: Text.AlignLeft;
745+ property int fixedHeaderHeight: -1;
746+ property size fixedArtShapeSize: Qt.size(-1, -1);
747+ readonly property string title: cardData && cardData["title"] || "";
748+ property bool asynchronous: true;
749+ property bool showHeader: true;
750+ implicitWidth: childrenRect.width;
751+onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
752 readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
753 Item {
754 id: artShapeHolder;
755@@ -57,9 +57,9 @@
756 readonly property real aspect: implicitWidth / implicitHeight;
757 width: root.width;
758 height: width / artShape.aspect;
759- }
760- }
761- }
762+ }
763+ }
764+ }
765 }
766 Loader {
767 id: overlayLoader;
768@@ -105,40 +105,40 @@
769 Label {
770 id: titleLabel;
771 objectName: "titleLabel";
772- anchors { left: parent.left;
773- leftMargin: units.gu(1);
774- right: parent.right;
775- top: overlayLoader.top;
776- topMargin: units.gu(1);
777+ anchors { right: parent.right;
778+ left: parent.left;
779+ leftMargin: units.gu(1);
780+ top: overlayLoader.top;
781+ topMargin: units.gu(1);
782 }
783- elide: Text.ElideRight;
784- fontSize: "small";
785- wrapMode: Text.Wrap;
786- maximumLineCount: 2;
787- font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
788- color: "white";
789- visible: showHeader && overlayLoader.active;
790- text: root.title;
791- font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
792- horizontalAlignment: root.headerAlignment;
793+ elide: Text.ElideRight;
794+ fontSize: "small";
795+ wrapMode: Text.Wrap;
796+ maximumLineCount: 2;
797+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
798+ color: "white";
799+ visible: showHeader && overlayLoader.active;
800+ text: root.title;
801+ font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
802+ horizontalAlignment: root.headerAlignment;
803 }
804-Label {
805- id: subtitleLabel;
806- objectName: "subtitleLabel";
807- anchors { left: titleLabel.left;
808- leftMargin: titleLabel.leftMargin;
809- right: titleLabel.right;
810- top: titleLabel.bottom;
811- topMargin: units.dp(2);
812- }
813- elide: Text.ElideRight;
814- fontSize: "small";
815- font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
816- color: "white";
817- visible: titleLabel.visible && titleLabel.text;
818- text: cardData && cardData["subtitle"] || "";
819- font.weight: Font.Light;
820- horizontalAlignment: root.headerAlignment;
821+Label {
822+ id: subtitleLabel;
823+ objectName: "subtitleLabel";
824+ anchors { left: titleLabel.left;
825+ leftMargin: titleLabel.leftMargin;
826+ top: titleLabel.bottom;
827+ right: titleLabel.right;
828+ }
829+ anchors.topMargin: units.dp(2);
830+ elide: Text.ElideRight;
831+ fontSize: "small";
832+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
833+ color: "white";
834+ visible: titleLabel.visible && titleLabel.text;
835+ text: cardData && cardData["subtitle"] || "";
836+ font.weight: Font.Light;
837+ horizontalAlignment: root.headerAlignment;
838 }
839 implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
840 }
841
842=== added file 'tests/plugins/Dash/cardcreator/6.res'
843--- tests/plugins/Dash/cardcreator/6.res 1970-01-01 00:00:00 +0000
844+++ tests/plugins/Dash/cardcreator/6.res 2014-06-27 14:25:45 +0000
845@@ -0,0 +1,115 @@
846+AbstractButton {
847+ id: root;
848+ property var template;
849+ property var components;
850+ property var cardData;
851+ property var artShapeBorderSource: undefined;
852+ property real fontScale: 1.0;
853+ property int headerAlignment: Text.AlignLeft;
854+ property int fixedHeaderHeight: -1;
855+ property size fixedArtShapeSize: Qt.size(-1, -1);
856+ readonly property string title: cardData && cardData["title"] || "";
857+ property bool asynchronous: true;
858+ property bool showHeader: true;
859+ implicitWidth: childrenRect.width;
860+readonly property size artShapeSize: Qt.size(-1, -1);
861+readonly property int headerHeight: row.height;
862+Row {
863+ id: row;
864+ objectName: "outerRow";
865+ property real margins: units.gu(1);
866+ spacing: margins;
867+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
868+ anchors { top: parent.top;
869+ topMargin: units.gu(1);
870+ left: parent.left;
871+}
872+ anchors.right: parent.right;
873+ anchors.margins: margins;
874+data: [ Loader {
875+ id: mascotShapeLoader;
876+ objectName: "mascotShapeLoader";
877+ asynchronous: root.asynchronous;
878+ active: mascotImage.status === Image.Ready;
879+ visible: showHeader && active && status == Loader.Ready;
880+ width: units.gu(6);
881+ height: units.gu(5.625);
882+ sourceComponent: UbuntuShape { image: mascotImage }
883+ anchors { verticalCenter: parent.verticalCenter; }
884+ }
885+,
886+Image {
887+ id: mascotImage;
888+ objectName: "mascotImage";
889+ anchors { verticalCenter: parent.verticalCenter; }
890+ readonly property int maxSize: Math.max(width, height) * 4;
891+ source: cardData && cardData["mascot"];
892+ width: units.gu(6);
893+ height: units.gu(5.625);
894+ sourceSize { width: maxSize; height: maxSize }
895+ fillMode: Image.PreserveAspectCrop;
896+ horizontalAlignment: Image.AlignHCenter;
897+ verticalAlignment: Image.AlignVCenter;
898+ visible: false;
899+ }
900+,
901+Item {
902+ id: headerTitleContainer;
903+ anchors { verticalCenter: parent.verticalCenter; }
904+ width: parent.width - x;
905+ implicitHeight: titleLabel.height + subtitleLabel.height;
906+data: [ Label {
907+ id: titleLabel;
908+ objectName: "titleLabel";
909+ anchors { right: emblemImage.left;
910+ left: parent.left;
911+ top: parent.top; }
912+ elide: Text.ElideRight;
913+ fontSize: "small";
914+ wrapMode: Text.Wrap;
915+ maximumLineCount: 2;
916+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
917+ color: "grey";
918+ visible: showHeader ;
919+ text: root.title;
920+ font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
921+ horizontalAlignment: root.headerAlignment;
922+ }
923+ ,
924+ Image {
925+ id: emblemImage;
926+ objectName: "emblemImage";
927+ anchors {
928+ bottom: titleLabel.baseline;
929+ right: parent.right;
930+ }
931+ source: cardData && cardData["emblem"];
932+ width: height;
933+ height: titleLabel.font.pixelSize;
934+ fillMode: Image.PreserveAspectFit;
935+ }
936+
937+,
938+Label {
939+ id: subtitleLabel;
940+ objectName: "subtitleLabel";
941+ anchors { right: parent.right;
942+ left: parent.left;
943+ top: titleLabel.bottom;
944+ }
945+ anchors.topMargin: units.dp(2);
946+ elide: Text.ElideRight;
947+ fontSize: "small";
948+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
949+ color: "grey";
950+ visible: titleLabel.visible && titleLabel.text;
951+ text: cardData && cardData["subtitle"] || "";
952+ font.weight: Font.Light;
953+ horizontalAlignment: root.headerAlignment;
954+ }
955+]
956+}
957+]
958+}
959+implicitHeight: row.y + row.height + units.gu(1);
960+}
961
962=== added file 'tests/plugins/Dash/cardcreator/6.tst'
963--- tests/plugins/Dash/cardcreator/6.tst 1970-01-01 00:00:00 +0000
964+++ tests/plugins/Dash/cardcreator/6.tst 2014-06-27 14:25:45 +0000
965@@ -0,0 +1,3 @@
966+template: {"card-layout":"horizontal","card-size":"large","category-layout":"grid","collapsed-rows":2}
967+components: {"art":{"aspect-ratio":1,"fill-mode":"crop"},"mascot":{"field":"mascot"},"subtitle":{"field":"domain"},"title":{"field":"title"},"emblem":{"field":"emblem"}}
968+result: 6.res
969
970=== modified file 'tests/plugins/Dash/cardcreatortest.cpp'
971--- tests/plugins/Dash/cardcreatortest.cpp 2014-05-06 13:09:08 +0000
972+++ tests/plugins/Dash/cardcreatortest.cpp 2014-06-27 14:25:45 +0000
973@@ -19,6 +19,7 @@
974 #include <QQuickItem>
975 #include <QQuickView>
976 #include <QtTestGui>
977+#include <QDebug>
978
979 class CardCreatorTest : public QObject
980 {
981@@ -73,8 +74,13 @@
982 QFile testResultFile(testDirPath + resultFileName);
983 QVERIFY(testResultFile.open(QIODevice::ReadOnly));
984 QTextStream ts2(&testResultFile);
985- const QString expectedResult = ts2.readAll();
986- QCOMPARE(cardStringResult.toString().simplified(), expectedResult.simplified());
987+ const QStringList expectedLines = ts2.readAll().trimmed().replace(QRegExp("\n\\s*\n"),"\n").split("\n");
988+ const QStringList cardStringResultLines = cardStringResult.toString().trimmed().replace(QRegExp("\n\\s*\n"),"\n").split("\n");
989+ //QCOMPARE(cardStringResultLines.size(), expectedLines.size()); // This is not really needed... following for does that deeply
990+ for (int i = 0; i < expectedLines.size(); ++i) {
991+ //qDebug() << cardStringResultLines[i].simplified() << expectedLines[i].simplified();
992+ QCOMPARE(cardStringResultLines[i].simplified(), expectedLines[i].simplified());
993+ }
994
995 QVariant createCardComponentResult;
996 QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON));
997
998=== modified file 'tests/qmltests/Dash/CardHelpers.js'
999--- tests/qmltests/Dash/CardHelpers.js 2014-02-04 18:14:07 +0000
1000+++ tests/qmltests/Dash/CardHelpers.js 2014-06-27 14:25:45 +0000
1001@@ -59,6 +59,7 @@
1002 "art": "art", \
1003 "subtitle": "subtitle", \
1004 "mascot": "mascot", \
1005+ "emblem": "emblem", \
1006 "summary": "summary" \
1007 }'
1008
1009
1010=== added file 'tests/qmltests/Dash/artwork/emblem.png'
1011Binary files tests/qmltests/Dash/artwork/emblem.png 1970-01-01 00:00:00 +0000 and tests/qmltests/Dash/artwork/emblem.png 2014-06-27 14:25:45 +0000 differ
1012=== modified file 'tests/qmltests/Dash/tst_Card.qml'
1013--- tests/qmltests/Dash/tst_Card.qml 2014-06-27 08:47:04 +0000
1014+++ tests/qmltests/Dash/tst_Card.qml 2014-06-27 14:25:45 +0000
1015@@ -31,6 +31,7 @@
1016 {
1017 "art": "../../../tests/qmltests/Dash/artwork/music-player-design.png",
1018 "mascot": "../../../tests/qmltests/Dash/artwork/avatar.png",
1019+ "emblem": "../../../tests/qmltests/Dash/artwork/emblem.png",
1020 "title": "foo",
1021 "subtitle": "bar",
1022 "summary": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
1023@@ -456,6 +457,23 @@
1024 tryCompareFunction(function() { return Qt.colorEqual(subtitle.color, fontColor); }, true);
1025 }
1026
1027+ function test_emblemImage_data() {
1028+ return [
1029+ { tag: "Art and summary", emblem: true, index: 0 },
1030+ { tag: "Art and summary, small", emblem: false, index: 1 },
1031+ { tag: "No header", emblem: false, index: 7 },
1032+ { tag: "With background", emblem: true, index: 10 },
1033+ ];
1034+ }
1035+
1036+ function test_emblemImage(data) {
1037+ selector.selectedIndex = data.index;
1038+ waitForRendering(card);
1039+
1040+ var emblemImage = findChild(card, "emblemImage");
1041+ compare(emblemImage !== null, data.emblem);
1042+ }
1043+
1044 function test_mascotShape_data() {
1045 return [
1046 { tag: "Art and summary", shape: false, index: 0 },

Subscribers

People subscribed via source and target branches