@@ -44,6 +44,7 @@ Rectangle {
4444 when: windowShown
4545
4646 property Item mascot: findChild(cardHeader, "mascotShape")
47+ property Item mascotImage: findChild(cardHeader, "mascotImage")
4748 property Item titleLabel: findChild(cardHeader, "titleLabel")
4849 property Item subtitleLabel: findChild(cardHeader, "subtitleLabel")
4950 property Item prices: findChild(cardHeader, "prices")
@@ -81,6 +82,25 @@ Rectangle {
8182 tryCompare(testCase.mascot, "visible", data.visible);
8283 }
8384
85+ function test_mascot_image_source_data() {
86+ return [
87+ { tag: "Mascot source width", width: Math.max(mascot.width, mascot.height) },
88+ { tag: "Mascot source height", height: Math.max(mascot.width, mascot.height) },
89+ ]
90+ }
91+
92+ function test_mascot_image_source(data) {
93+ cardHeader.mascot = Qt.resolvedUrl("artwork/avatar.png")
94+
95+ if (data.hasOwnProperty("width")) {
96+ tryCompare(testCase.mascotImage.sourceSize, "width", data.width)
97+ }
98+
99+ if (data.hasOwnProperty("height")) {
100+ tryCompare(testCase.mascotImage.sourceSize, "height", data.height)
101+ }
102+ }
103+
84104 function test_labels_data() {
85105 return [
86106 { tag: "Empty", visible: false },
@@ -123,6 +143,11 @@ Rectangle {
123143 { tag: "Column width", object: column, width: cardHeader.width - testCase.outerRow.spacing * 2 },
124144 { tag: "Column width", object: column, width: cardHeader.width - mascot.width - testCase.outerRow.spacing * 3, mascot: "artwork/avatar.png" },
125145 { tag: "Header height", object: cardHeader, height: function() { return subtitleLabel.y + subtitleLabel.height + outerRow.spacing * 2 } },
146+ { tag: "Mascot width", object: mascot,
147+ "mascot": Qt.resolvedUrl("artwork/avatar.png"), width: units.gu(6), },
148+ { tag: "Mascot height", object: mascot,
149+ // mascot (icon) aspect-ratio is 8:7.5
150+ "mascot": Qt.resolvedUrl("artwork/avatar.png"), height: units.gu(6)*7.5/8.0 },
126151 ]
127152 }
128153
@@ -136,7 +161,11 @@ Rectangle {
136161 }
137162
138163 if (data.hasOwnProperty("height")) {
139− tryCompareFunction(function() { return data.object.height === data.height() }, true);
164+ if (typeof data.height === "function") {
165+ tryCompareFunction(function() { return data.object.height === data.height() }, true)
166+ } else {
167+ tryCompare(data.object, "height", data.height)
168+ }
140169 }
141170 }
142171 }