@@ -33,8 +33,15 @@ Rectangle {
3333 name: "Background"
3434 when: windowShown
3535
36+ SignalSpy {
37+ id: loadedSpy
38+ target: background
39+ signalName: "loaded"
40+ }
41+
3642 function cleanup() {
3743 background.style = "";
44+ loadedSpy.clear();
3845 }
3946
4047 function test_style_data() {
@@ -49,8 +56,35 @@ Rectangle {
4956 function test_style(data) {
5057 background.style = data.style;
5158 expectFail("empty", "Empty style should not create a background.");
52− tryCompareFunction(function() { return background.item === null }, false);
59+ loadedSpy.wait();
5360 compare(background.item.objectName, data.tag, "Background should be %1".arg(data.style));
5461 }
62+
63+ function test_solid() {
64+ background.style = "color:///black";
65+ loadedSpy.wait();
66+
67+ verify(Qt.colorEqual(background.item.color, "black"),
68+ "Solid color not equal: %1 != black".arg(background.item.color));
69+ }
70+
71+ function test_gradient() {
72+ background.style = "gradient:///black/red";
73+ loadedSpy.wait();
74+
75+ var stops = background.item.gradient.stops;
76+
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));
81+ }
82+
83+ function test_image() {
84+ background.style = "/some/path";
85+ loadedSpy.wait();
86+
87+ compare(background.item.source, Qt.resolvedUrl("/some/path"), "Image path is incorrect.");
88+ }
5589 }
5690}