@@ -33,8 +33,15 @@ Rectangle {
33 name: "Background"
33 name: "Background"
34 when: windowShown
34 when: windowShown
36 function cleanup() {
42 function cleanup() {
37 background.style = "";
43 background.style = "";
40 function test_style_data() {
47 function test_style_data() {
@@ -49,8 +56,35 @@ Rectangle {
49 function test_style(data) {
56 function test_style(data) {
50 background.style = data.style;
57 background.style = data.style;
51 expectFail("empty", "Empty style should not create a background.");
58 expectFail("empty", "Empty style should not create a background.");
52− tryCompareFunction(function() { return background.item === null }, false);
59+ loadedSpy.wait();
53 compare(background.item.objectName, data.tag, "Background should be %1".arg(data.style));
60 compare(background.item.objectName, data.tag, "Background should be %1".arg(data.style));
63+ function test_solid() {
64+ background.style = "color:///black";
67+ verify(Qt.colorEqual(background.item.color, "black"),
68+ "Solid color not equal: %1 != black".arg(background.item.color));
71+ function test_gradient() {
72+ background.style = "gradient:///black/red";
75+ var stops = background.item.gradient.stops;
77+ verify(Qt.colorEqual(stops[0].color, "black"),
78+ "Top gradient color not equal: %1 != black".arg(stops[0].color));
79+ verify(Qt.colorEqual(stops[1].color, "red"),
80+ "Bottom gradient color not equal: %1 != black".arg(stops[1].color));
83+ function test_image() {
84+ background.style = "/some/path";
87+ compare(background.item.source, Qt.resolvedUrl("/some/path"), "Image path is incorrect.");