on xenial help sign in
Resolve cardArtStyle on compile time
71cdedbAlbert Astals Cid
plugins/Dash/CardCreator.js+60−48
@@ -59,14 +59,34 @@ var kBackgroundLoaderCode = 'Loader {\n\
59 } \n\
59 } \n\
60 }\n';
60 }\n';
61
61
62+// %1 is the visible code
63+// %2 is the aspect of the UbuntuShape
64+var kArtUbuntuShapeCode = 'UbuntuShape { \n\
65+ anchors.fill: parent; \n\
66+ visible: %1; \n\
67+ source: artImage; \n\
68+ sourceFillMode: UbuntuShape.PreserveAspectCrop; \n\
69+ radius: "medium"; \n\
70+ aspect: %2; \n\
71+ }';
72+
73+// %1 is the visible code
74+var kArtProportionalShapeCode = 'ProportionalShape { \n\
75+ anchors.fill: parent; \n\
76+ visible: %1; \n\
77+ source: artImage; \n\
78+ aspect: UbuntuShape.DropShadow; \n\
79+ }';
80+
62// %1 is used as anchors of artShapeHolder
81// %1 is used as anchors of artShapeHolder
63// %2 is used as image width
82// %2 is used as image width
64// %3 is used as image height
83// %3 is used as image height
65−// %4 is whether the image or the Loader with the UbuntuShape/ProportionalShape should be visible
84+// %4 is whether the image should be visible
66// %5 is used as aspect ratio fallback
85// %5 is used as aspect ratio fallback
67// %6 is whether the loader should be asynchronous or not
86// %6 is whether the loader should be asynchronous or not
87+// %7 is the shape code we want to use
68−// %7 is injected as code to artImage
88+// %8 is injected as code to artImage
69−// %8 is used as image fallback
89+// %9 is used as image fallback
70var kArtShapeHolderCode = 'Item { \n\
90var kArtShapeHolderCode = 'Item { \n\
71 id: artShapeHolder; \n\
91 id: artShapeHolder; \n\
72 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
92 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
@@ -75,7 +95,7 @@ var kArtShapeHolderCode = 'Item { \n\
75 Loader { \n\
95 Loader { \n\
76 id: artShapeLoader; \n\
96 id: artShapeLoader; \n\
77 objectName: "artShapeLoader"; \n\
97 objectName: "artShapeLoader"; \n\
78− readonly property string cardArt: cardData && cardData["art"] || %8; \n\
98+ readonly property string cardArt: cardData && cardData["art"] || %9; \n\
79 active: cardArt != ""; \n\
99 active: cardArt != ""; \n\
80 asynchronous: %6; \n\
100 asynchronous: %6; \n\
81 visible: status == Loader.Ready; \n\
101 visible: status == Loader.Ready; \n\
@@ -84,31 +104,7 @@ var kArtShapeHolderCode = 'Item { \n\
84 objectName: "artShape"; \n\
104 objectName: "artShape"; \n\
85 visible: image.status == Image.Ready; \n\
105 visible: image.status == Image.Ready; \n\
86 readonly property alias image: artImage; \n\
106 readonly property alias image: artImage; \n\
87− Loader { \n\
88− anchors.fill: parent; \n\
89− visible: %4; \n\
90− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\
91− Component { \n\
92− id: artShapeShapeComponent; \n\
93− UbuntuShape { \n\
94− source: artImage; \n\
95− sourceFillMode: UbuntuShape.PreserveAspectCrop; \n\
96− radius: "medium"; \n\
97− aspect: { \n\
98− switch (root.artShapeStyle) { \n\
99− case "inset": return UbuntuShape.Inset; \n\
100− case "shadow": return UbuntuShape.DropShadow; \n\
101− default: \n\
102− case "flat": return UbuntuShape.Flat; \n\
103− } \n\
104− } \n\
105− } \n\
106− } \n\
107− Component { \n\
108− id: artShapeIconComponent; \n\
109− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } \n\
110− } \n\
111− } \n\
107+ %7 \n\
112 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
108 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
113 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : %5; \n\
109 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : %5; \n\
114 Component.onCompleted: { updateWidthHeightBindings(); } \n\
110 Component.onCompleted: { updateWidthHeightBindings(); } \n\
@@ -127,10 +123,10 @@ var kArtShapeHolderCode = 'Item { \n\
127 objectName: "artImage"; \n\
123 objectName: "artImage"; \n\
128 source: artShapeLoader.cardArt; \n\
124 source: artShapeLoader.cardArt; \n\
129 asynchronous: %6; \n\
125 asynchronous: %6; \n\
130− visible: !%4; \n\
126+ visible: %4; \n\
131 width: %2; \n\
127 width: %2; \n\
132 height: %3; \n\
128 height: %3; \n\
133− %7 \n\
129+ %8 \n\
134 } \n\
130 } \n\
135 } \n\
131 } \n\
136 } \n\
132 } \n\
@@ -316,7 +312,7 @@ var kTouchdownCode = 'UbuntuShape { \n\
316 id: touchdown; \n\
312 id: touchdown; \n\
317 objectName: "touchdown"; \n\
313 objectName: "touchdown"; \n\
318 anchors { %1 } \n\
314 anchors { %1 } \n\
319− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; \n\
315+ visible: root.pressed; \n\
320 radius: "medium"; \n\
316 radius: "medium"; \n\
321 borderSource: "radius_pressed.sci" \n\
317 borderSource: "radius_pressed.sci" \n\
322 }\n';
318 }\n';
@@ -399,7 +395,7 @@ function sanitizeColor(colorString) {
399 return colorString;
395 return colorString;
400}
396}
401
397
402−function cardString(template, components, isCardTool) {
398+function cardString(template, components, isCardTool, artShapeStyle) {
403 var code;
399 var code;
404
400
405 var templateInteractive = (template == null ? true : (template["non-interactive"] !== undefined ? !template["non-interactive"] : true)) ? "true" : "false";
401 var templateInteractive = (template == null ? true : (template["non-interactive"] !== undefined ? !template["non-interactive"] : true)) ? "true" : "false";
@@ -407,7 +403,6 @@ function cardString(template, components, isCardTool) {
407 code = 'AbstractButton { \n\
403 code = 'AbstractButton { \n\
408 id: root; \n\
404 id: root; \n\
409 property var cardData; \n\
405 property var cardData; \n\
410− property string artShapeStyle: "inset"; \n\
411 property string backgroundShapeStyle: "inset"; \n\
406 property string backgroundShapeStyle: "inset"; \n\
412 property real fontScale: 1.0; \n\
407 property real fontScale: 1.0; \n\
413 property var scopeStyle: null; \n\
408 property var scopeStyle: null; \n\
@@ -504,17 +499,32 @@ function cardString(template, components, isCardTool) {
504 var fallbackStatusCode = "";
499 var fallbackStatusCode = "";
505 var fallbackURICode = '""';
500 var fallbackURICode = '""';
506 if (fallback !== "") {
501 if (fallback !== "") {
507− // fallbackStatusCode has %6 in it because we want to substitute it for fallbackURICode
502+ // fallbackStatusCode has %9 in it because we want to substitute it for fallbackURICode
508− // which in kArtShapeHolderCode is %8
503+ // which in kArtShapeHolderCode is %9
509− fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %8;';
504+ fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %9;';
510 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
505 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
511 }
506 }
507+ var artShapeHolderShapeCode;
508+ if (artShapeStyle === "icon") {
509+ artShapeHolderShapeCode = kArtProportionalShapeCode.arg(isConciergeMode ? "false" : "true");
510+ } else {
511+ var artShapeHolderShapeAspect;
512+ switch (artShapeStyle) {
513+ case "inset": artShapeHolderShapeAspect = "UbuntuShape.Inset"; break;
514+ case "shadow": artShapeHolderShapeAspect = "UbuntuShape.DropShadow"; break;
515+ default:
516+ case "flat": artShapeHolderShapeAspect = "UbuntuShape.Flat"; break;
517+ }
518+ artShapeHolderShapeCode = kArtUbuntuShapeCode.arg(isConciergeMode ? "false" : "true")
519+ .arg(artShapeHolderShapeAspect);
520+ }
512 code += kArtShapeHolderCode.arg(artAnchors)
521 code += kArtShapeHolderCode.arg(artAnchors)
513 .arg(widthCode)
522 .arg(widthCode)
514 .arg(heightCode)
523 .arg(heightCode)
515− .arg(isConciergeMode ? "false" : "true")
524+ .arg(isConciergeMode ? "true" : "false")
516 .arg(aspectRatio)
525 .arg(aspectRatio)
517 .arg(asynchronous)
526 .arg(asynchronous)
527+ .arg(artShapeHolderShapeCode)
518 .arg(fallbackStatusCode)
528 .arg(fallbackStatusCode)
519 .arg(fallbackURICode);
529 .arg(fallbackURICode);
520 } else {
530 } else {
@@ -839,15 +849,17 @@ function cardString(template, components, isCardTool) {
839 code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(summaryColor);
849 code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(summaryColor);
840 }
850 }
841
851
852+ if (artShapeStyle != "shadow" && artShapeStyle != "icon") {
842− var touchdownAnchors;
853+ var touchdownAnchors;
843− if (hasBackground) {
854+ if (hasBackground) {
844− touchdownAnchors = 'fill: backgroundLoader';
855+ touchdownAnchors = 'fill: backgroundLoader';
845− } else if (touchdownOnArtShape) {
856+ } else if (touchdownOnArtShape) {
846− touchdownAnchors = 'fill: artShapeHolder';
857+ touchdownAnchors = 'fill: artShapeHolder';
847− } else {
858+ } else {
848− touchdownAnchors = 'fill: root'
859+ touchdownAnchors = 'fill: root'
860+ }
861+ code += kTouchdownCode.arg(touchdownAnchors);
849 }
862 }
850− code += kTouchdownCode.arg(touchdownAnchors);
851
863
852 var implicitHeight = 'implicitHeight: ';
864 var implicitHeight = 'implicitHeight: ';
853 if (hasSummary) {
865 if (hasSummary) {
@@ -880,13 +892,13 @@ function cardString(template, components, isCardTool) {
880 return code;
892 return code;
881}
893}
882
894
883−function createCardComponent(parent, template, components, isCardTool, identifier) {
895+function createCardComponent(parent, template, components, isCardTool, artShapeStyle, identifier) {
884 var imports = 'import QtQuick 2.4; \n\
896 var imports = 'import QtQuick 2.4; \n\
885 import Ubuntu.Components 1.3; \n\
897 import Ubuntu.Components 1.3; \n\
886 import Ubuntu.Settings.Components 0.1; \n\
898 import Ubuntu.Settings.Components 0.1; \n\
887 import Dash 0.1;\n\
899 import Dash 0.1;\n\
888 import Utils 0.1;\n';
900 import Utils 0.1;\n';
889− var card = cardString(template, components, isCardTool);
901+ var card = cardString(template, components, isCardTool, artShapeStyle);
890 var code = imports + 'Component {\n' + card + '}\n';
902 var code = imports + 'Component {\n' + card + '}\n';
891
903
892 try {
904 try {
plugins/Dash/CardCreatorCache.qml+2−2
@@ -23,7 +23,7 @@ QtObject {
23
23
24 property var cache: new Object();
24 property var cache: new Object();
25
25
26− function getCardComponent(template, components, isCardTool) {
26+ function getCardComponent(template, components, isCardTool, artShapeStyle) {
27 if (template === undefined || components === undefined)
27 if (template === undefined || components === undefined)
28 return undefined;
28 return undefined;
29
29
@@ -32,7 +32,7 @@ QtObject {
32 var allString = tString + cString + isCardTool;
32 var allString = tString + cString + isCardTool;
33 var component = cache[allString];
33 var component = cache[allString];
34 if (component === undefined) {
34 if (component === undefined) {
35− component = CardCreator.createCardComponent(root, template, components, isCardTool, allString);
35+ component = CardCreator.createCardComponent(root, template, components, isCardTool, artShapeStyle, allString);
36 cache[allString] = component;
36 cache[allString] = component;
37 }
37 }
38 return component;
38 return component;
qml/Dash/CardCarousel.qml−1
@@ -66,7 +66,6 @@ DashRenderer {
66 item.cardData = Qt.binding(function() { return model; });
66 item.cardData = Qt.binding(function() { return model; });
67 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
67 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
68 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
68 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
69− item.artShapeStyle = "shadow";
70 item.scopeStyle = cardCarousel.scopeStyle;
69 item.scopeStyle = cardCarousel.scopeStyle;
71 }
70 }
72 }
71 }
qml/Dash/CardGrid.qml−2
@@ -25,7 +25,6 @@ DashRenderer {
25 if (!cardTool || !cardTool.template || typeof cardTool.template["collapsed-rows"] != "number") return 2;
25 if (!cardTool || !cardTool.template || typeof cardTool.template["collapsed-rows"] != "number") return 2;
26 return cardTool.template["collapsed-rows"];
26 return cardTool.template["collapsed-rows"];
27 }
27 }
28− property string artShapeStyle: "inset";
29 property string backgroundShapeStyle: "inset";
28 property string backgroundShapeStyle: "inset";
30 property alias minimumHorizontalSpacing: grid.minimumHorizontalSpacing
29 property alias minimumHorizontalSpacing: grid.minimumHorizontalSpacing
31
30
@@ -71,7 +70,6 @@ DashRenderer {
71 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
70 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
72 item.cardData = Qt.binding(function() { return model; });
71 item.cardData = Qt.binding(function() { return model; });
73 item.scopeStyle = root.scopeStyle;
72 item.scopeStyle = root.scopeStyle;
74− item.artShapeStyle = root.artShapeStyle;
75 item.backgroundShapeStyle = root.backgroundShapeStyle;
73 item.backgroundShapeStyle = root.backgroundShapeStyle;
76 }
74 }
77 Connections {
75 Connections {
qml/Dash/CardTool.qml+6−2
@@ -66,7 +66,11 @@ Item {
66 return layout;
66 return layout;
67 }
67 }
68
68
69+
70+ // Not readonly because gets overwritten from GenericScopeView in some cases
71+ property string artShapeStyle: categoryLayout === "carousel" ? "shadow" : "inset"
72+
69− property var cardComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, false);
73+ property var cardComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, false, artShapeStyle);
70
74
71 // FIXME: Saviq
75 // FIXME: Saviq
72 // Only way for the card below to actually be laid out completely.
76 // Only way for the card below to actually be laid out completely.
@@ -193,7 +197,7 @@ Item {
193 "summary": "—\n—\n—\n—\n—",
197 "summary": "—\n—\n—\n—\n—",
194 "attributes": attributesModel.model
198 "attributes": attributesModel.model
195 }
199 }
196− sourceComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, true);
200+ sourceComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, true, artShapeStyle);
197 onLoaded: {
201 onLoaded: {
198 item.objectName = "cardToolCard";
202 item.objectName = "cardToolCard";
199 item.width = Qt.binding(function() { return cardTool.cardWidth !== -1 ? cardTool.cardWidth : item.implicitWidth; });
203 item.width = Qt.binding(function() { return cardTool.cardWidth !== -1 ? cardTool.cardWidth : item.implicitWidth; });
qml/Dash/GenericScopeView.qml+2−2
@@ -364,10 +364,10 @@ FocusScope {
364 if (scope && scope.id === "clickscope") {
364 if (scope && scope.id === "clickscope") {
365 if (categoryId === "predefined" || categoryId === "local") {
365 if (categoryId === "predefined" || categoryId === "local") {
366 cardTool.artShapeSize = Qt.binding(function() { return Qt.size(units.gu(8), units.gu(7.5)) });
366 cardTool.artShapeSize = Qt.binding(function() { return Qt.size(units.gu(8), units.gu(7.5)) });
367− item.artShapeStyle = "icon";
367+ cardTool.artShapeStyle = "icon";
368 } else {
368 } else {
369 // Should be ubuntu store icon
369 // Should be ubuntu store icon
370− item.artShapeStyle = "flat";
370+ cardTool.artShapeStyle = "flat";
371 item.backgroundShapeStyle = "shadow";
371 item.backgroundShapeStyle = "shadow";
372 }
372 }
373 }
373 }
tests/plugins/Dash/cardcreator/1.res+7−25
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -30,30 +29,13 @@ Item {
30 objectName: "artShape";
29 objectName: "artShape";
31 visible: image.status == Image.Ready;
30 visible: image.status == Image.Ready;
32 readonly property alias image: artImage;
31 readonly property alias image: artImage;
33− Loader {
32+ UbuntuShape {
34 anchors.fill: parent;
33 anchors.fill: parent;
35 visible: true;
34 visible: true;
36− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
37− Component {
38− id: artShapeShapeComponent;
39− UbuntuShape {
40− source: artImage;
35+ source: artImage;
41− sourceFillMode: UbuntuShape.PreserveAspectCrop;
36+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
42− radius: "medium";
37+ radius: "medium";
43− aspect: {
44− switch (root.artShapeStyle) {
45− case "inset": return UbuntuShape.Inset;
38+ aspect: UbuntuShape.Inset;
46− case "shadow": return UbuntuShape.DropShadow;
47− default:
48− case "flat": return UbuntuShape.Flat;
49− }
50− }
51− }
52− }
53− Component {
54− id: artShapeIconComponent;
55− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
56− }
57 }
39 }
58 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
40 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
59 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6;
41 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6;
@@ -73,7 +55,7 @@ Item {
73 objectName: "artImage";
55 objectName: "artImage";
74 source: artShapeLoader.cardArt;
56 source: artShapeLoader.cardArt;
75 asynchronous: true;
57 asynchronous: true;
76− visible: !true;
58+ visible: false;
77 width: root.width;
59 width: root.width;
78 height: width / artShape.aspect;
60 height: width / artShape.aspect;
79 }
61 }
@@ -105,7 +87,7 @@ UbuntuShape {
105 id: touchdown;
87 id: touchdown;
106 objectName: "touchdown";
88 objectName: "touchdown";
107 anchors { fill: artShapeHolder }
89 anchors { fill: artShapeHolder }
108− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
90+ visible: root.pressed;
109 radius: "medium";
91 radius: "medium";
110 borderSource: "radius_pressed.sci"
92 borderSource: "radius_pressed.sci"
111}
93}
tests/plugins/Dash/cardcreator/1.res.cardcreator+7−25
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -29,30 +28,13 @@ Item {
29 objectName: "artShape";
28 objectName: "artShape";
30 visible: image.status == Image.Ready;
29 visible: image.status == Image.Ready;
31 readonly property alias image: artImage;
30 readonly property alias image: artImage;
32− Loader {
31+ UbuntuShape {
33 anchors.fill: parent;
32 anchors.fill: parent;
34 visible: true;
33 visible: true;
35− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
36− Component {
37− id: artShapeShapeComponent;
38− UbuntuShape {
39− source: artImage;
34+ source: artImage;
40− sourceFillMode: UbuntuShape.PreserveAspectCrop;
35+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
41− radius: "medium";
36+ radius: "medium";
42− aspect: {
43− switch (root.artShapeStyle) {
44− case "inset": return UbuntuShape.Inset;
37+ aspect: UbuntuShape.Inset;
45− case "shadow": return UbuntuShape.DropShadow;
46− default:
47− case "flat": return UbuntuShape.Flat;
48− }
49− }
50− }
51− }
52− Component {
53− id: artShapeIconComponent;
54− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
55− }
56 }
38 }
57 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
39 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
58 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6;
40 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6;
@@ -72,7 +54,7 @@ Item {
72 objectName: "artImage";
54 objectName: "artImage";
73 source: artShapeLoader.cardArt;
55 source: artShapeLoader.cardArt;
74 asynchronous: false;
56 asynchronous: false;
75− visible: !true;
57+ visible: false;
76 width: root.width;
58 width: root.width;
77 height: width / artShape.aspect;
59 height: width / artShape.aspect;
78 }
60 }
@@ -104,7 +86,7 @@ UbuntuShape {
104 id: touchdown;
86 id: touchdown;
105 objectName: "touchdown";
87 objectName: "touchdown";
106 anchors { fill: artShapeHolder }
88 anchors { fill: artShapeHolder }
107− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
89+ visible: root.pressed;
108 radius: "medium";
90 radius: "medium";
109 borderSource: "radius_pressed.sci"
91 borderSource: "radius_pressed.sci"
110}
92}
tests/plugins/Dash/cardcreator/1.tst+1
@@ -1,3 +1,4 @@
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1.6,"field":"art"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":1.6,"field":"art"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: inset
3result: 1.res
4result: 1.res
tests/plugins/Dash/cardcreator/10.res−9
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -127,13 +126,5 @@ top: titleLabel.bottom;
127
126
128 ]
127 ]
129 }
128 }
130−UbuntuShape {
131− id: touchdown;
132− objectName: "touchdown";
133− anchors { fill: backgroundLoader }
134− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
135− radius: "medium";
136− borderSource: "radius_pressed.sci"
137− }
138implicitHeight: row.y + row.height + units.gu(1);
129implicitHeight: row.y + row.height + units.gu(1);
139}
130}
tests/plugins/Dash/cardcreator/10.res.cardcreator−9
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -125,13 +124,5 @@ top: titleLabel.bottom;
125
124
126 ]
125 ]
127 }
126 }
128−UbuntuShape {
129− id: touchdown;
130− objectName: "touchdown";
131− anchors { fill: backgroundLoader }
132− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
133− radius: "medium";
134− borderSource: "radius_pressed.sci"
135− }
136implicitHeight: row.y + row.height + units.gu(1);
127implicitHeight: row.y + row.height + units.gu(1);
137}
128}
tests/plugins/Dash/cardcreator/10.tst+1
@@ -1,3 +1,4 @@
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2, "card-background": { "type": "color", "elements": [ "\\", ": 3; } Item { } function moo () { \"" ] } }
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2, "card-background": { "type": "color", "elements": [ "\\", ": 3; } Item { } function moo () { \"" ] } }
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: shadow
3result: 10.res
4result: 10.res
tests/plugins/Dash/cardcreator/11.res+10−28
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -68,32 +67,15 @@ Item {
68 objectName: "artShape";
67 objectName: "artShape";
69 visible: image.status == Image.Ready;
68 visible: image.status == Image.Ready;
70 readonly property alias image: artImage;
69 readonly property alias image: artImage;
71− Loader {
70+ UbuntuShape {
72− anchors.fill: parent;
71+ anchors.fill: parent;
73 visible: true;
72 visible: true;
74− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
75− Component {
76− id: artShapeShapeComponent;
77− UbuntuShape {
78− source: artImage;
73+ source: artImage;
79− sourceFillMode: UbuntuShape.PreserveAspectCrop;
74+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
80− radius: "medium";
75+ radius: "medium";
81− aspect: {
82− switch (root.artShapeStyle) {
83− case "inset": return UbuntuShape.Inset;
84− case "shadow": return UbuntuShape.DropShadow;
85− default:
86− case "flat": return UbuntuShape.Flat;
76+ aspect: UbuntuShape.Flat;
87− }
88− }
89− }
90− }
91− Component {
92− id: artShapeIconComponent;
93− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
94− }
95− }
77+ }
96− readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
78+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
97 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
79 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
98 Component.onCompleted: { updateWidthHeightBindings(); }
80 Component.onCompleted: { updateWidthHeightBindings(); }
99 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
81 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
@@ -111,7 +93,7 @@ Item {
111 objectName: "artImage";
93 objectName: "artImage";
112 source: artShapeLoader.cardArt;
94 source: artShapeLoader.cardArt;
113 asynchronous: true;
95 asynchronous: true;
114− visible: !true;
96+ visible: false;
115 width: root.width;
97 width: root.width;
116 height: width / artShape.aspect;
98 height: width / artShape.aspect;
117 onStatusChanged: if (status === Image.Error) source = decodeURI("%5C");
99 onStatusChanged: if (status === Image.Error) source = decodeURI("%5C");
@@ -199,7 +181,7 @@ UbuntuShape {
199 id: touchdown;
181 id: touchdown;
200 objectName: "touchdown";
182 objectName: "touchdown";
201 anchors { fill: backgroundLoader }
183 anchors { fill: backgroundLoader }
202− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
184+ visible: root.pressed;
203 radius: "medium";
185 radius: "medium";
204 borderSource: "radius_pressed.sci"
186 borderSource: "radius_pressed.sci"
205 }
187 }
tests/plugins/Dash/cardcreator/11.res.cardcreator+9−27
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -67,31 +66,14 @@ Item {
67 objectName: "artShape";
66 objectName: "artShape";
68 visible: image.status == Image.Ready;
67 visible: image.status == Image.Ready;
69 readonly property alias image: artImage;
68 readonly property alias image: artImage;
70− Loader {
69+ UbuntuShape {
71− anchors.fill: parent;
70+ anchors.fill: parent;
72 visible: true;
71 visible: true;
73− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
74− Component {
75− id: artShapeShapeComponent;
76− UbuntuShape {
77− source: artImage;
72+ source: artImage;
78− sourceFillMode: UbuntuShape.PreserveAspectCrop;
73+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
79− radius: "medium";
74+ radius: "medium";
80− aspect: {
81− switch (root.artShapeStyle) {
82− case "inset": return UbuntuShape.Inset;
83− case "shadow": return UbuntuShape.DropShadow;
84− default:
85− case "flat": return UbuntuShape.Flat;
75+ aspect: UbuntuShape.Flat;
86− }
87− }
88− }
89− }
90− Component {
91− id: artShapeIconComponent;
92− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
93− }
94− }
76+ }
95 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
77 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
96 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
78 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
97 Component.onCompleted: { updateWidthHeightBindings(); }
79 Component.onCompleted: { updateWidthHeightBindings(); }
@@ -110,7 +92,7 @@ Item {
110 objectName: "artImage";
92 objectName: "artImage";
111 source: artShapeLoader.cardArt;
93 source: artShapeLoader.cardArt;
112 asynchronous: false;
94 asynchronous: false;
113− visible: !true;
95+ visible: false;
114 width: root.width;
96 width: root.width;
115 height: width / artShape.aspect;
97 height: width / artShape.aspect;
116 }
98 }
@@ -195,7 +177,7 @@ UbuntuShape {
195 id: touchdown;
177 id: touchdown;
196 objectName: "touchdown";
178 objectName: "touchdown";
197 anchors { fill: backgroundLoader }
179 anchors { fill: backgroundLoader }
198− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
180+ visible: root.pressed;
199 radius: "medium";
181 radius: "medium";
200 borderSource: "radius_pressed.sci"
182 borderSource: "radius_pressed.sci"
201 }
183 }
tests/plugins/Dash/cardcreator/11.tst+1
@@ -1,3 +1,4 @@
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2 }
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2 }
2components: {"art":{"aspect-ratio":1,"field":"art","fallback":"\\"},"background":{"field":"background"},"mascot":{"field":"icon","fallback":"\""},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":1,"field":"art","fallback":"\\"},"background":{"field":"background"},"mascot":{"field":"icon","fallback":"\""},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: flat
3result: 11.res
4result: 11.res
tests/plugins/Dash/cardcreator/2.res−9
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -126,13 +125,5 @@ CroppedImageMinimumSourceSize {
126
125
127 ]
126 ]
128 }
127 }
129−UbuntuShape {
130− id: touchdown;
131− objectName: "touchdown";
132− anchors { fill: backgroundLoader }
133− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
134− radius: "medium";
135− borderSource: "radius_pressed.sci"
136−}
137implicitHeight: row.y + row.height + units.gu(1);
128implicitHeight: row.y + row.height + units.gu(1);
138}
129}
tests/plugins/Dash/cardcreator/2.res.cardcreator−9
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -124,13 +123,5 @@ CroppedImageMinimumSourceSize {
124
123
125 ]
124 ]
126 }
125 }
127−UbuntuShape {
128− id: touchdown;
129− objectName: "touchdown";
130− anchors { fill: backgroundLoader }
131− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
132− radius: "medium";
133− borderSource: "radius_pressed.sci"
134−}
135implicitHeight: row.y + row.height + units.gu(1);
126implicitHeight: row.y + row.height + units.gu(1);
136}
127}
tests/plugins/Dash/cardcreator/2.tst+1
@@ -1,3 +1,4 @@
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: icon
3result: 2.res
4result: 2.res
tests/plugins/Dash/cardcreator/3.res+4−32
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -30,30 +29,11 @@ Item {
30 objectName: "artShape";
29 objectName: "artShape";
31 visible: image.status == Image.Ready;
30 visible: image.status == Image.Ready;
32 readonly property alias image: artImage;
31 readonly property alias image: artImage;
33− Loader {
32+ ProportionalShape {
34 anchors.fill: parent;
33 anchors.fill: parent;
35 visible: true;
34 visible: true;
36− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
37− Component {
38− id: artShapeShapeComponent;
39− UbuntuShape {
40− source: artImage;
35+ source: artImage;
41− sourceFillMode: UbuntuShape.PreserveAspectCrop;
42− radius: "medium";
43− aspect: {
44− switch (root.artShapeStyle) {
45− case "inset": return UbuntuShape.Inset;
46− case "shadow": return UbuntuShape.DropShadow;
47− default:
48− case "flat": return UbuntuShape.Flat;
49− }
50− }
51− }
52− }
53− Component {
54− id: artShapeIconComponent;
55− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
36+ aspect: UbuntuShape.DropShadow;
56− }
57 }
37 }
58 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
38 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
59 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
39 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
@@ -73,7 +53,7 @@ Item {
73 objectName: "artImage";
53 objectName: "artImage";
74 source: artShapeLoader.cardArt;
54 source: artShapeLoader.cardArt;
75 asynchronous: true;
55 asynchronous: true;
76− visible: !true;
56+ visible: false;
77 width: root.width;
57 width: root.width;
78 height: width / artShape.aspect;
58 height: width / artShape.aspect;
79 onStatusChanged: if (status === Image.Error) source = decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
59 onStatusChanged: if (status === Image.Error) source = decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
@@ -120,13 +100,5 @@ Label {
120 text: cardData && cardData["subtitle"] || "";
100 text: cardData && cardData["subtitle"] || "";
121 font.weight: Font.Light;
101 font.weight: Font.Light;
122 }
102 }
123−UbuntuShape {
124− id: touchdown;
125− objectName: "touchdown";
126− anchors { fill: artShapeHolder }
127− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
128− radius: "medium";
129− borderSource: "radius_pressed.sci"
130−}
131implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
103implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
132}
104}
tests/plugins/Dash/cardcreator/3.res.cardcreator+4−32
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -29,30 +28,11 @@ Item {
29 objectName: "artShape";
28 objectName: "artShape";
30 visible: image.status == Image.Ready;
29 visible: image.status == Image.Ready;
31 readonly property alias image: artImage;
30 readonly property alias image: artImage;
32− Loader {
31+ ProportionalShape {
33 anchors.fill: parent;
32 anchors.fill: parent;
34 visible: true;
33 visible: true;
35− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
36− Component {
37− id: artShapeShapeComponent;
38− UbuntuShape {
39− source: artImage;
34+ source: artImage;
40− sourceFillMode: UbuntuShape.PreserveAspectCrop;
41− radius: "medium";
42− aspect: {
43− switch (root.artShapeStyle) {
44− case "inset": return UbuntuShape.Inset;
45− case "shadow": return UbuntuShape.DropShadow;
46− default:
47− case "flat": return UbuntuShape.Flat;
48− }
49− }
50− }
51− }
52− Component {
53− id: artShapeIconComponent;
54− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
35+ aspect: UbuntuShape.DropShadow;
55− }
56 }
36 }
57 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
37 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
58 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
38 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
@@ -72,7 +52,7 @@ Item {
72 objectName: "artImage";
52 objectName: "artImage";
73 source: artShapeLoader.cardArt;
53 source: artShapeLoader.cardArt;
74 asynchronous: false;
54 asynchronous: false;
75− visible: !true;
55+ visible: false;
76 width: root.width;
56 width: root.width;
77 height: width / artShape.aspect;
57 height: width / artShape.aspect;
78 }
58 }
@@ -118,13 +98,5 @@ Label {
118 text: cardData && cardData["subtitle"] || "";
98 text: cardData && cardData["subtitle"] || "";
119 font.weight: Font.Light;
99 font.weight: Font.Light;
120 }
100 }
121−UbuntuShape {
122− id: touchdown;
123− objectName: "touchdown";
124− anchors { fill: artShapeHolder }
125− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
126− radius: "medium";
127− borderSource: "radius_pressed.sci"
128−}
129implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
101implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
130}
102}
tests/plugins/Dash/cardcreator/3.tst+1
@@ -1,3 +1,4 @@
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":0.75,"field":"art","fallback":"IHAVE\\\"ESCAPED\\\"QUOTES\\\""},"subtitle":{"field":"price"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":0.75,"field":"art","fallback":"IHAVE\\\"ESCAPED\\\"QUOTES\\\""},"subtitle":{"field":"price"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: icon
3result: 3.res
4result: 3.res
tests/plugins/Dash/cardcreator/4.res+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -103,7 +102,7 @@ UbuntuShape {
103 id: touchdown;
102 id: touchdown;
104 objectName: "touchdown";
103 objectName: "touchdown";
105 anchors { fill: root }
104 anchors { fill: root }
106− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
105+ visible: root.pressed;
107 radius: "medium";
106 radius: "medium";
108 borderSource: "radius_pressed.sci"
107 borderSource: "radius_pressed.sci"
109}
108}
tests/plugins/Dash/cardcreator/4.res.cardcreator+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -101,7 +100,7 @@ UbuntuShape {
101 id: touchdown;
100 id: touchdown;
102 objectName: "touchdown";
101 objectName: "touchdown";
103 anchors { fill: root }
102 anchors { fill: root }
104− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
103+ visible: root.pressed;
105 radius: "medium";
104 radius: "medium";
106 borderSource: "radius_pressed.sci"
105 borderSource: "radius_pressed.sci"
107}
106}
tests/plugins/Dash/cardcreator/4.tst+1
@@ -1,3 +1,4 @@
1template: {"card-layout":"horizontal","card-size":"large","category-layout":"grid","collapsed-rows":2}
1template: {"card-layout":"horizontal","card-size":"large","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1},"mascot":{"field":"mascot"},"subtitle":{"field":"domain"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":1},"mascot":{"field":"mascot"},"subtitle":{"field":"domain"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: flat
3result: 4.res
4result: 4.res
tests/plugins/Dash/cardcreator/5.res+6−32
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -30,30 +29,13 @@ Item {
30 objectName: "artShape";
29 objectName: "artShape";
31 visible: image.status == Image.Ready;
30 visible: image.status == Image.Ready;
32 readonly property alias image: artImage;
31 readonly property alias image: artImage;
33− Loader {
32+ UbuntuShape {
34 anchors.fill: parent;
33 anchors.fill: parent;
35 visible: false;
34 visible: false;
36− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
37− Component {
38− id: artShapeShapeComponent;
39− UbuntuShape {
40− source: artImage;
35+ source: artImage;
41− sourceFillMode: UbuntuShape.PreserveAspectCrop;
36+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
42− radius: "medium";
37+ radius: "medium";
43− aspect: {
44− switch (root.artShapeStyle) {
45− case "inset": return UbuntuShape.Inset;
46− case "shadow": return UbuntuShape.DropShadow;
47− default:
48− case "flat": return UbuntuShape.Flat;
49− }
50− }
51− }
52− }
53− Component {
54− id: artShapeIconComponent;
55− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
38+ aspect: UbuntuShape.DropShadow;
56− }
57 }
39 }
58 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
40 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
59 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
41 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
@@ -73,7 +55,7 @@ Item {
73 objectName: "artImage";
55 objectName: "artImage";
74 source: artShapeLoader.cardArt;
56 source: artShapeLoader.cardArt;
75 asynchronous: true;
57 asynchronous: true;
76− visible: !false;
58+ visible: true;
77 width: root.width;
59 width: root.width;
78 height: width / artShape.aspect;
60 height: width / artShape.aspect;
79 }
61 }
@@ -138,13 +120,5 @@ Label {
138 text: cardData && cardData["subtitle"] || "";
120 text: cardData && cardData["subtitle"] || "";
139 font.weight: Font.Light;
121 font.weight: Font.Light;
140 }
122 }
141−UbuntuShape {
142− id: touchdown;
143− objectName: "touchdown";
144− anchors { fill: artShapeHolder }
145− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
146− radius: "medium";
147− borderSource: "radius_pressed.sci"
148−}
149implicitHeight: artShapeHolder.height;
123implicitHeight: artShapeHolder.height;
150}
124}
tests/plugins/Dash/cardcreator/5.res.cardcreator+6−32
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -29,30 +28,13 @@ Item {
29 objectName: "artShape";
28 objectName: "artShape";
30 visible: image.status == Image.Ready;
29 visible: image.status == Image.Ready;
31 readonly property alias image: artImage;
30 readonly property alias image: artImage;
32− Loader {
31+ UbuntuShape {
33 anchors.fill: parent;
32 anchors.fill: parent;
34 visible: false;
33 visible: false;
35− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
36− Component {
37− id: artShapeShapeComponent;
38− UbuntuShape {
39− source: artImage;
34+ source: artImage;
40− sourceFillMode: UbuntuShape.PreserveAspectCrop;
35+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
41− radius: "medium";
36+ radius: "medium";
42− aspect: {
43− switch (root.artShapeStyle) {
44− case "inset": return UbuntuShape.Inset;
45− case "shadow": return UbuntuShape.DropShadow;
46− default:
47− case "flat": return UbuntuShape.Flat;
48− }
49− }
50− }
51− }
52− Component {
53− id: artShapeIconComponent;
54− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
37+ aspect: UbuntuShape.DropShadow;
55− }
56 }
38 }
57 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
39 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
58 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
40 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
@@ -72,7 +54,7 @@ Item {
72 objectName: "artImage";
54 objectName: "artImage";
73 source: artShapeLoader.cardArt;
55 source: artShapeLoader.cardArt;
74 asynchronous: false;
56 asynchronous: false;
75− visible: !false;
57+ visible: true;
76 width: root.width;
58 width: root.width;
77 height: width / artShape.aspect;
59 height: width / artShape.aspect;
78 }
60 }
@@ -137,13 +119,5 @@ Label {
137 text: cardData && cardData["subtitle"] || "";
119 text: cardData && cardData["subtitle"] || "";
138 font.weight: Font.Light;
120 font.weight: Font.Light;
139 }
121 }
140−UbuntuShape {
141− id: touchdown;
142− objectName: "touchdown";
143− anchors { fill: artShapeHolder }
144− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
145− radius: "medium";
146− borderSource: "radius_pressed.sci"
147−}
148implicitHeight: artShapeHolder.height;
122implicitHeight: artShapeHolder.height;
149}
123}
tests/plugins/Dash/cardcreator/5.tst+1
@@ -1,3 +1,4 @@
1template: {"non-interactive":true,"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true}
1template: {"non-interactive":true,"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true}
2components: {"art":{"aspect-ratio":1,"field":"art","conciergeMode":true},"subtitle":{"field":"artist"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":1,"field":"art","conciergeMode":true},"subtitle":{"field":"artist"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: shadow
3result: 5.res
4result: 5.res
tests/plugins/Dash/cardcreator/6.res+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -119,7 +118,7 @@ UbuntuShape {
119 id: touchdown;
118 id: touchdown;
120 objectName: "touchdown";
119 objectName: "touchdown";
121 anchors { fill: backgroundLoader }
120 anchors { fill: backgroundLoader }
122− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
121+ visible: root.pressed;
123 radius: "medium";
122 radius: "medium";
124 borderSource: "radius_pressed.sci"
123 borderSource: "radius_pressed.sci"
125}
124}
tests/plugins/Dash/cardcreator/6.res.cardcreator+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -118,7 +117,7 @@ UbuntuShape {
118 id: touchdown;
117 id: touchdown;
119 objectName: "touchdown";
118 objectName: "touchdown";
120 anchors { fill: backgroundLoader }
119 anchors { fill: backgroundLoader }
121− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
120+ visible: root.pressed;
122 radius: "medium";
121 radius: "medium";
123 borderSource: "radius_pressed.sci"
122 borderSource: "radius_pressed.sci"
124}
123}
tests/plugins/Dash/cardcreator/6.tst+1
@@ -1,3 +1,4 @@
1template: {"card-background":"http://assets.ubuntu.com/sites/ubuntu/latest/u/img/logos/logo-ubuntu-grey.png","card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
1template: {"card-background":"http://assets.ubuntu.com/sites/ubuntu/latest/u/img/logos/logo-ubuntu-grey.png","card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"subtitle":{"field":"author"},"title":{"field":"title"},"emblem":{"field":"source"},"attributes":{}}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"subtitle":{"field":"author"},"title":{"field":"title"},"emblem":{"field":"source"},"attributes":{}}
3+artShapeStyle: inset
3result: 6.res
4result: 6.res
tests/plugins/Dash/cardcreator/7.res−9
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -139,13 +138,5 @@ CroppedImageMinimumSourceSize {
139
138
140 ]
139 ]
141 }
140 }
142−UbuntuShape {
143− id: touchdown;
144− objectName: "touchdown";
145− anchors { fill: backgroundLoader }
146− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
147− radius: "medium";
148− borderSource: "radius_pressed.sci"
149−}
150implicitHeight: row.y + row.height + units.gu(1);
141implicitHeight: row.y + row.height + units.gu(1);
151}
142}
tests/plugins/Dash/cardcreator/7.res.cardcreator−9
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -137,13 +136,5 @@ CroppedImageMinimumSourceSize {
137
136
138 ]
137 ]
139 }
138 }
140−UbuntuShape {
141− id: touchdown;
142− objectName: "touchdown";
143− anchors { fill: backgroundLoader }
144− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
145− radius: "medium";
146− borderSource: "radius_pressed.sci"
147−}
148implicitHeight: row.y + row.height + units.gu(1);
139implicitHeight: row.y + row.height + units.gu(1);
149}
140}
tests/plugins/Dash/cardcreator/7.tst+1
@@ -1,3 +1,4 @@
1template: {"card-background":{"elements":["#E9E9E9","#E9AAE9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
1template: {"card-background":{"elements":["#E9E9E9","#E9AAE9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{"field":"attributes","max-count":2}}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{"field":"attributes","max-count":2}}
3+artShapeStyle: icon
3result: 7.res
4result: 7.res
tests/plugins/Dash/cardcreator/8.res+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -101,7 +100,7 @@ UbuntuShape {
101 id: touchdown;
100 id: touchdown;
102 objectName: "touchdown";
101 objectName: "touchdown";
103 anchors { fill: backgroundLoader }
102 anchors { fill: backgroundLoader }
104− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
103+ visible: root.pressed;
105 radius: "medium";
104 radius: "medium";
106 borderSource: "radius_pressed.sci"
105 borderSource: "radius_pressed.sci"
107}
106}
tests/plugins/Dash/cardcreator/8.res.cardcreator+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -99,7 +98,7 @@ UbuntuShape {
99 id: touchdown;
98 id: touchdown;
100 objectName: "touchdown";
99 objectName: "touchdown";
101 anchors { fill: backgroundLoader }
100 anchors { fill: backgroundLoader }
102− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
101+ visible: root.pressed;
103 radius: "medium";
102 radius: "medium";
104 borderSource: "radius_pressed.sci"
103 borderSource: "radius_pressed.sci"
105}
104}
tests/plugins/Dash/cardcreator/8.tst+1
@@ -1,3 +1,4 @@
1template: {"card-background":{"elements":["#E9E9E9","#E9AAE9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
1template: {"card-background":{"elements":["#E9E9E9","#E9AAE9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2components: {"background":{"field":"background"},"mascot":{"field":"icon"},"title":{"field":"title"},"attributes":{}}
2components: {"background":{"field":"background"},"mascot":{"field":"icon"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: inset
3result: 8.res
4result: 8.res
tests/plugins/Dash/cardcreator/9.res+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -111,7 +110,7 @@ CardAudioProgress {
111 id: touchdown;
110 id: touchdown;
112 objectName: "touchdown";
111 objectName: "touchdown";
113 anchors { fill: root }
112 anchors { fill: root }
114− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
113+ visible: root.pressed;
115 radius: "medium";
114 radius: "medium";
116 borderSource: "radius_pressed.sci"
115 borderSource: "radius_pressed.sci"
117 }
116 }
tests/plugins/Dash/cardcreator/9.res.cardcreator+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -110,7 +109,7 @@ CardAudioProgress {
110 id: touchdown;
109 id: touchdown;
111 objectName: "touchdown";
110 objectName: "touchdown";
112 anchors { fill: root }
111 anchors { fill: root }
113− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
112+ visible: root.pressed;
114 radius: "medium";
113 radius: "medium";
115 borderSource: "radius_pressed.sci"
114 borderSource: "radius_pressed.sci"
116 }
115 }
tests/plugins/Dash/cardcreator/9.tst+1
@@ -1,3 +1,4 @@
1template: {"card-layout":"horizontal","card-size":"medium","category-layout":"grid","collapsed-rows":2,"quick-preview-type": "audio"}
1template: {"card-layout":"horizontal","card-size":"medium","category-layout":"grid","collapsed-rows":2,"quick-preview-type": "audio"}
2components: {"art":{"aspect-ratio":1},"subtitle":{"field":"author"},"title":{"field":"title"}, "quickPreviewData": "quickPreviewData"}
2components: {"art":{"aspect-ratio":1},"subtitle":{"field":"author"},"title":{"field":"title"}, "quickPreviewData": "quickPreviewData"}
3+artShapeStyle: inset
3result: 9.res
4result: 9.res
tests/plugins/Dash/cardcreatortest.cpp+9−6
@@ -73,6 +73,7 @@ private Q_SLOTS:
73 {
73 {
74 const QString templateString("template: ");
74 const QString templateString("template: ");
75 const QString componentsString("components: ");
75 const QString componentsString("components: ");
76+ const QString artShapeStyleString("artShapeStyle: ");
76 const QString resultString("result: ");
77 const QString resultString("result: ");
77
78
78 const QString testDirPath = DASHVIEWSTEST_FOLDER "/cardcreator/";
79 const QString testDirPath = DASHVIEWSTEST_FOLDER "/cardcreator/";
@@ -87,24 +88,26 @@ private Q_SLOTS:
87
88
88 QVERIFY(lines[0].startsWith(templateString));
89 QVERIFY(lines[0].startsWith(templateString));
89 QVERIFY(lines[1].startsWith(componentsString));
90 QVERIFY(lines[1].startsWith(componentsString));
90− QVERIFY(lines[2].startsWith(resultString));
91+ QVERIFY(lines[2].startsWith(artShapeStyleString));
92+ QVERIFY(lines[3].startsWith(resultString));
91
93
92 const QString templateJSON = lines[0].mid(templateString.length());
94 const QString templateJSON = lines[0].mid(templateString.length());
93 const QString componentsJSON = lines[1].mid(componentsString.length());
95 const QString componentsJSON = lines[1].mid(componentsString.length());
96+ const QString artShapeStyle = lines[2].mid(artShapeStyleString.length());
94− const QString resultFileName = lines[2].mid(resultString.length());
97+ const QString resultFileName = lines[3].mid(resultString.length());
95 QVariant cardStringResult;
98 QVariant cardStringResult;
96 QVariant createCardComponentResult;
99 QVariant createCardComponentResult;
97
100
98− QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false));
101+ QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false), Q_ARG(QVariant, artShapeStyle));
99 compareFileContents(testDirPath + resultFileName, cardStringResult.toString());
102 compareFileContents(testDirPath + resultFileName, cardStringResult.toString());
100
103
101− QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true));
104+ QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true), Q_ARG(QVariant, artShapeStyle));
102 compareFileContents(testDirPath + resultFileName + ".cardcreator", cardStringResult.toString());
105 compareFileContents(testDirPath + resultFileName + ".cardcreator", cardStringResult.toString());
103
106
104− QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false));
107+ QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false), Q_ARG(QVariant, artShapeStyle));
105 QVERIFY(createCardComponentResult.toBool());
108 QVERIFY(createCardComponentResult.toBool());
106
109
107− QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true));
110+ QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true), Q_ARG(QVariant, artShapeStyle));
108 QVERIFY(createCardComponentResult.toBool());
111 QVERIFY(createCardComponentResult.toBool());
109 }
112 }
110 }
113 }
tests/plugins/Dash/cardcreatortest.qml+4−4
@@ -19,11 +19,11 @@ import "../../../plugins/Dash/CardCreator.js" as CardCreator
19
19
20Item {
20Item {
21 id: root
21 id: root
22− function cardString(template, components, isCardCreator) {
22+ function cardString(template, components, isCardCreator, artShapeStyle) {
23− return CardCreator.cardString(JSON.parse(template), JSON.parse(components), isCardCreator);
23+ return CardCreator.cardString(JSON.parse(template), JSON.parse(components), isCardCreator, artShapeStyle);
24 }
24 }
25
25
26− function createCardComponent(template, components, isCardCreator) {
26+ function createCardComponent(template, components, isCardCreator, artShapeStyle) {
27− return CardCreator.createCardComponent(root, JSON.parse(template), JSON.parse(components), isCardCreator) !== null;
27+ return CardCreator.createCardComponent(root, JSON.parse(template), JSON.parse(components), isCardCreator, artShapeStyle) !== null;
28 }
28 }
29}
29}