@@ -79,6 +79,21 @@ Rectangle {
79 "layout": { "template": { "overlay": true },
79 "layout": { "template": { "overlay": true },
80 "components": JSON.parse(Helpers.fullMapping) }
80 "components": JSON.parse(Helpers.fullMapping) }
83+ "name": "Art, header - grey background",
84+ "layout": { "template": { "card-background": { "type": "color", "elements": ["grey"] } },
85+ "components": JSON.parse(Helpers.fullMapping) }
88+ "name": "Art, header - gradient background",
89+ "layout": { "template": { "card-background": { "type": "gradient", "elements": ["grey", "white"] } },
90+ "components": JSON.parse(Helpers.fullMapping) }
93+ "name": "Art, header - image background",
94+ "layout": { "template": { "card-background": Qt.resolvedUrl("artwork/checkers.png") },
95+ "components": JSON.parse(Helpers.fullMapping) }
84 CardTool {
99 CardTool {
@@ -170,12 +185,16 @@ Rectangle {
170 property Item art: findChild(card, "artShape")
185 property Item art: findChild(card, "artShape")
171 property Item artImage: findChild(card, "artImage")
186 property Item artImage: findChild(card, "artImage")
172 property Item summary: findChild(card, "summaryLabel")
187 property Item summary: findChild(card, "summaryLabel")
188+ property Item background: findChild(card, "background")
189+ property Item backgroundImage: findChild(card, "backgroundImage")
174 function initTestCase() {
191 function initTestCase() {
175 verify(typeof testCase.header === "object", "Couldn't find header object.");
192 verify(typeof testCase.header === "object", "Couldn't find header object.");
176 verify(typeof testCase.art === "object", "Couldn't find art object.");
193 verify(typeof testCase.art === "object", "Couldn't find art object.");
177 verify(typeof testCase.artImage === "object", "Couldn't find artImage object.");
194 verify(typeof testCase.artImage === "object", "Couldn't find artImage object.");
178 verify(typeof testCase.summary === "object", "Couldn't find summary object.");
195 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.");
181 function cleanup() {
200 function cleanup() {
@@ -354,5 +373,45 @@ Rectangle {
354 compare(testCase.art.height, 0);
373 compare(testCase.art.height, 0);
355 compare(testCase.art.width, 0);
374 compare(testCase.art.width, 0);
377+ function test_background_data() {
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 },
392+ function test_background(data) {
393+ selector.selectedIndex = data.index;
395+ if (data.hasOwnProperty("background")) {
396+ card.cardData["background"] = data.background;
397+ card.cardDataChanged();
400+ waitForRendering(card);
402+ tryCompare(background, "visible", data.visible);
404+ if (data.hasOwnProperty("color")) {
405+ tryCompare(background, "color", data.color);
408+ if (data.hasOwnProperty("gradientColor")) {
409+ tryCompare(background, "gradientColor", data.gradientColor);
412+ if (data.hasOwnProperty("image")) {
413+ tryCompare(backgroundImage, "source", data.image);