on xenial help sign in
Hide artShape when artImage not set.
2287a8bMichał Karnicki
qml/Dash/Card.qml+2
@@ -41,10 +41,12 @@ Item {
41 width: image.fillMode === Image.PreserveAspectCrop || aspect < image.aspect ? image.width : height * image.aspect
41 width: image.fillMode === Image.PreserveAspectCrop || aspect < image.aspect ? image.width : height * image.aspect
42 height: image.fillMode === Image.PreserveAspectCrop || aspect > image.aspect ? image.height : width / image.aspect
42 height: image.fillMode === Image.PreserveAspectCrop || aspect > image.aspect ? image.height : width / image.aspect
43 anchors.horizontalCenter: template && template["card-layout"] === "horizontal" ? undefined : parent.horizontalCenter
43 anchors.horizontalCenter: template && template["card-layout"] === "horizontal" ? undefined : parent.horizontalCenter
44+ visible: cardData && cardData["art"] || false
44
45
45 property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1
46 property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1
46
47
47 image: Image {
48 image: Image {
49+ id: artImage
48 width: template && template["card-layout"] === "horizontal" ? height * artShape.aspect : root.width
50 width: template && template["card-layout"] === "horizontal" ? height * artShape.aspect : root.width
49 height: template && template["card-layout"] === "horizontal" ? header.height : width / artShape.aspect
51 height: template && template["card-layout"] === "horizontal" ? header.height : width / artShape.aspect
50 objectName: "artImage"
52 objectName: "artImage"
tests/qmltests/Dash/tst_Card.qml+12
@@ -110,6 +110,11 @@ Rectangle {
110 "name": "Art, header - vertical",
110 "name": "Art, header - vertical",
111 "layout": { "components": Helpers.update(JSON.parse(root.fullMapping), { "summary": undefined }) }
111 "layout": { "components": Helpers.update(JSON.parse(root.fullMapping), { "summary": undefined }) }
112 },
112 },
113+ {
114+ "name": "Header title only - horizontal",
115+ "layout": { "template": { "card-layout": "horizontal" },
116+ "components": { "title": "title" } }
117+ },
113 ]
118 ]
114
119
115 Card {
120 Card {
@@ -350,5 +355,12 @@ Rectangle {
350 tryCompareFunction(function() { return testCase.header.y === data.top() }, true);
355 tryCompareFunction(function() { return testCase.header.y === data.top() }, true);
351 tryCompareFunction(function() { return testCase.header.x === data.left() }, true);
356 tryCompareFunction(function() { return testCase.header.x === data.left() }, true);
352 }
357 }
358+
359+ function test_art_visibility() {
360+ selector.selectedIndex = 7
361+
362+ tryCompare(testCase.artImage, "source", "")
363+ compare(testCase.art.visible, false)
364+ }
353 }
365 }
354}
366}