on xenial help sign in
Hide artShape when artImage not set.
commit2287a8b435a659896e3339831a5e29108b13e5c9 authorMichał Karnicki <michal.karnicki@canonical.com> dateTue 28 Jan 2014, 12:55 (13 years ago) parentbe2d485
2 files changed+14
qml/Dash/Card.qml+2 tests/qmltests/Dash/tst_Card.qml+12
qml/Dash/Card.qml+2
@@ -41,10 +41,12 @@ Item {
4141 width: image.fillMode === Image.PreserveAspectCrop || aspect < image.aspect ? image.width : height * image.aspect
4242 height: image.fillMode === Image.PreserveAspectCrop || aspect > image.aspect ? image.height : width / image.aspect
4343 anchors.horizontalCenter: template && template["card-layout"] === "horizontal" ? undefined : parent.horizontalCenter
44+ visible: cardData && cardData["art"] || false
4445
4546 property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1
4647
4748 image: Image {
49+ id: artImage
4850 width: template && template["card-layout"] === "horizontal" ? height * artShape.aspect : root.width
4951 height: template && template["card-layout"] === "horizontal" ? header.height : width / artShape.aspect
5052 objectName: "artImage"
tests/qmltests/Dash/tst_Card.qml+12
@@ -110,6 +110,11 @@ Rectangle {
110110 "name": "Art, header - vertical",
111111 "layout": { "components": Helpers.update(JSON.parse(root.fullMapping), { "summary": undefined }) }
112112 },
113+ {
114+ "name": "Header title only - horizontal",
115+ "layout": { "template": { "card-layout": "horizontal" },
116+ "components": { "title": "title" } }
117+ },
113118 ]
114119
115120 Card {
@@ -350,5 +355,12 @@ Rectangle {
350355 tryCompareFunction(function() { return testCase.header.y === data.top() }, true);
351356 tryCompareFunction(function() { return testCase.header.x === data.left() }, true);
352357 }
358+
359+ function test_art_visibility() {
360+ selector.selectedIndex = 7
361+
362+ tryCompare(testCase.artImage, "source", "")
363+ compare(testCase.art.visible, false)
364+ }
353365 }
354366}