@@ -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 {
@@ -171,12 +186,16 @@ Rectangle {
171 property Item art: findChild(card, "artShape")
186 property Item art: findChild(card, "artShape")
172 property Item artImage: findChild(card, "artImage")
187 property Item artImage: findChild(card, "artImage")
173 property Item summary: findChild(card, "summaryLabel")
188 property Item summary: findChild(card, "summaryLabel")
189+ property Item background: findChild(card, "background")
190+ property Item backgroundImage: findChild(card, "backgroundImage")
175 function initTestCase() {
192 function initTestCase() {
176 verify(typeof testCase.header === "object", "Couldn't find header object.");
193 verify(typeof testCase.header === "object", "Couldn't find header object.");
177 verify(typeof testCase.art === "object", "Couldn't find art object.");
194 verify(typeof testCase.art === "object", "Couldn't find art object.");
178 verify(typeof testCase.artImage === "object", "Couldn't find artImage object.");
195 verify(typeof testCase.artImage === "object", "Couldn't find artImage object.");
179 verify(typeof testCase.summary === "object", "Couldn't find summary object.");
196 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.");
182 function cleanup() {
201 function cleanup() {
@@ -356,6 +375,46 @@ Rectangle {
356 compare(testCase.art.width, 0);
375 compare(testCase.art.width, 0);
378+ function test_background_data() {
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 },
393+ function test_background(data) {
394+ selector.selectedIndex = data.index;
396+ if (data.hasOwnProperty("background")) {
397+ card.cardData["background"] = data.background;
398+ card.cardDataChanged();
401+ waitForRendering(card);
403+ tryCompare(background, "visible", data.visible);
405+ if (data.hasOwnProperty("color")) {
406+ tryCompare(background, "color", data.color);
409+ if (data.hasOwnProperty("gradientColor")) {
410+ tryCompare(background, "gradientColor", data.gradientColor);
413+ if (data.hasOwnProperty("image")) {
414+ tryCompare(backgroundImage, "source", data.image);
359 function test_font_weights_data() {
418 function test_font_weights_data() {
361 { tag: "Title only", index: 8, weight: Font.Normal },
420 { tag: "Title only", index: 8, weight: Font.Normal },