@@ -79,6 +79,21 @@ Rectangle {
7979 "layout": { "template": { "overlay": true },
8080 "components": JSON.parse(Helpers.fullMapping) }
8181 },
82+ {
83+ "name": "Art, header - grey background",
84+ "layout": { "template": { "card-background": { "type": "color", "elements": ["grey"] } },
85+ "components": JSON.parse(Helpers.fullMapping) }
86+ },
87+ {
88+ "name": "Art, header - gradient background",
89+ "layout": { "template": { "card-background": { "type": "gradient", "elements": ["grey", "white"] } },
90+ "components": JSON.parse(Helpers.fullMapping) }
91+ },
92+ {
93+ "name": "Art, header - image background",
94+ "layout": { "template": { "card-background": Qt.resolvedUrl("artwork/checkers.png") },
95+ "components": JSON.parse(Helpers.fullMapping) }
96+ },
8297 ]
8398
8499 CardTool {
@@ -171,12 +186,16 @@ Rectangle {
171186 property Item art: findChild(card, "artShape")
172187 property Item artImage: findChild(card, "artImage")
173188 property Item summary: findChild(card, "summaryLabel")
189+ property Item background: findChild(card, "background")
190+ property Item backgroundImage: findChild(card, "backgroundImage")
174191
175192 function initTestCase() {
176193 verify(typeof testCase.header === "object", "Couldn't find header object.");
177194 verify(typeof testCase.art === "object", "Couldn't find art object.");
178195 verify(typeof testCase.artImage === "object", "Couldn't find artImage object.");
179196 verify(typeof testCase.summary === "object", "Couldn't find summary object.");
197+ verify(typeof testCase.artImage === "object", "Couldn't find background object.");
198+ verify(typeof testCase.summary === "object", "Couldn't find backgroundImage object.");
180199 }
181200
182201 function cleanup() {
@@ -356,6 +375,46 @@ Rectangle {
356375 compare(testCase.art.width, 0);
357376 }
358377
378+ function test_background_data() {
379+ return [
380+ { tag: "Art and summary", visible: true, color: "#ffffff", index: 0 },
381+ { tag: "No Summary", visible: false, index: 6 },
382+ { tag: "Horizontal", visible: false, index: 5 },
383+ { tag: "Grey background", visible: true, color: "#808080", index: 10 },
384+ { tag: "Overriden Gradient background", visible: true, color: "#808080", gradientColor: "#ffffff",
385+ background: {type: "color", elements: ["grey", "white"]}, index: 10 },
386+ { tag: "Overriden Image background", visible: true, image: Qt.resolvedUrl("artwork/checkers.png"),
387+ background: Qt.resolvedUrl("artwork/checkers.png"), index: 10 },
388+ { tag: "Gradient background", visible: true, color: "#808080", gradientColor: "#ffffff", index: 11 },
389+ { tag: "Image background", visible: true, image: Qt.resolvedUrl("artwork/checkers.png"), index: 12 },
390+ ];
391+ }
392+
393+ function test_background(data) {
394+ selector.selectedIndex = data.index;
395+
396+ if (data.hasOwnProperty("background")) {
397+ card.cardData["background"] = data.background;
398+ card.cardDataChanged();
399+ }
400+
401+ waitForRendering(card);
402+
403+ tryCompare(background, "visible", data.visible);
404+
405+ if (data.hasOwnProperty("color")) {
406+ tryCompare(background, "color", data.color);
407+ }
408+
409+ if (data.hasOwnProperty("gradientColor")) {
410+ tryCompare(background, "gradientColor", data.gradientColor);
411+ }
412+
413+ if (data.hasOwnProperty("image")) {
414+ tryCompare(backgroundImage, "source", data.image);
415+ }
416+ }
417+
359418 function test_font_weights_data() {
360419 return [
361420 { tag: "Title only", index: 8, weight: Font.Normal },