@@ -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 {
@@ -170,12 +185,16 @@ Rectangle {
170185 property Item art: findChild(card, "artShape")
171186 property Item artImage: findChild(card, "artImage")
172187 property Item summary: findChild(card, "summaryLabel")
188+ property Item background: findChild(card, "background")
189+ property Item backgroundImage: findChild(card, "backgroundImage")
173190
174191 function initTestCase() {
175192 verify(typeof testCase.header === "object", "Couldn't find header object.");
176193 verify(typeof testCase.art === "object", "Couldn't find art object.");
177194 verify(typeof testCase.artImage === "object", "Couldn't find artImage object.");
178195 verify(typeof testCase.summary === "object", "Couldn't find summary object.");
196+ verify(typeof testCase.artImage === "object", "Couldn't find background object.");
197+ verify(typeof testCase.summary === "object", "Couldn't find backgroundImage object.");
179198 }
180199
181200 function cleanup() {
@@ -354,5 +373,45 @@ Rectangle {
354373 compare(testCase.art.height, 0);
355374 compare(testCase.art.width, 0);
356375 }
376+
377+ function test_background_data() {
378+ return [
379+ { tag: "Art and summary", visible: true, color: "#ffffff", index: 0 },
380+ { tag: "No Summary", visible: false, index: 6 },
381+ { tag: "Horizontal", visible: false, index: 5 },
382+ { tag: "Grey background", visible: true, color: "#808080", index: 10 },
383+ { tag: "Overriden Gradient background", visible: true, color: "#808080", gradientColor: "#ffffff",
384+ background: {type: "color", elements: ["grey", "white"]}, index: 10 },
385+ { tag: "Overriden Image background", visible: true, image: Qt.resolvedUrl("artwork/checkers.png"),
386+ background: Qt.resolvedUrl("artwork/checkers.png"), index: 10 },
387+ { tag: "Gradient background", visible: true, color: "#808080", gradientColor: "#ffffff", index: 11 },
388+ { tag: "Image background", visible: true, image: Qt.resolvedUrl("artwork/checkers.png"), index: 12 },
389+ ];
390+ }
391+
392+ function test_background(data) {
393+ selector.selectedIndex = data.index;
394+
395+ if (data.hasOwnProperty("background")) {
396+ card.cardData["background"] = data.background;
397+ card.cardDataChanged();
398+ }
399+
400+ waitForRendering(card);
401+
402+ tryCompare(background, "visible", data.visible);
403+
404+ if (data.hasOwnProperty("color")) {
405+ tryCompare(background, "color", data.color);
406+ }
407+
408+ if (data.hasOwnProperty("gradientColor")) {
409+ tryCompare(background, "gradientColor", data.gradientColor);
410+ }
411+
412+ if (data.hasOwnProperty("image")) {
413+ tryCompare(backgroundImage, "source", data.image);
414+ }
415+ }
357416 }
358417}