1 description("Test the setting of the -webkit-image-set function.");
3 function testComputedStyle(property, fullRule)
5 var div = document.createElement("div");
6 document.body.appendChild(div);
7 div.setAttribute("style", property + ": " + fullRule);
8 var computedValue = div.style.backgroundImage;
9 document.body.removeChild(div);
13 function testImageSetRule(description, property, rule, expected)
16 debug(description + " : " + rule);
18 var fullRule = "-webkit-image-set(" + rule + ")";
19 shouldBeEqualToString('testComputedStyle("' + property + '", "' + fullRule + '")', fullRule);
22 testImageSetRule("Single value for background-image",
24 "url(http://www.webkit.org/a) 1x");
26 testImageSetRule("Multiple values for background-image",
28 "url(http://www.webkit.org/a) 1x, url(http://www.webkit.org/b) 2x");
30 testImageSetRule("Multiple values for background-image, out of order",
32 "url(http://www.webkit.org/c) 3x, url(http://www.webkit.org/b) 2x, url(http://www.webkit.org/a) 1x");
34 testImageSetRule("Duplicate values for background-image",
36 "url(http://www.webkit.org/c) 1x, url(http://www.webkit.org/b) 2x, url(http://www.webkit.org/a) 1x");
38 testImageSetRule("Fractional values for background-image",
40 "url(http://www.webkit.org/c) 0.2x, url(http://www.webkit.org/b) 2.3x, url(http://www.webkit.org/a) 12.3456x");
42 // FIXME: We should also be testing the behavior of negative values somewhere, but it's currently
43 // broken. http://wkb.ug/100132
45 successfullyParsed = true;