blob: 6ddfb2075f11ca0ed489deba64e49d5fdd68b2cc [file] [log] [blame]
<pre id="output"></pre>
<script>
function debug(msg)
{
var output = document.getElementById("output");
output.appendChild(document.createTextNode(msg + "\n"));
}
function testComputedStyle(property, fullRule)
{
var div = document.createElement("div");
document.body.appendChild(div);
div.setAttribute("style", property + ": " + fullRule);
var computedValue = div.style[property];
document.body.removeChild(div);
return computedValue;
}
function testImageSetRule(description, property, rule, expected)
{
debug("");
debug(`${description} : ${rule}`);
var rule = `image-set(${rule})`;
if (property == 'cursor')
rule += ', default';
if (testComputedStyle(property, rule) == rule)
debug("Unprefixed: PASS");
else
debug("Unprefixed: FAIL");
if (testComputedStyle(property, "-webkit-" + rule) == rule)
debug("Prefixed: PASS");
else
debug("Prefixed: FAIL");
}
if (window.testRunner)
window.testRunner.dumpAsText();
testImageSetRule("Single value for background-image",
"background-image",
"url(http://www.webkit.org/a) 1x");
testImageSetRule("Multiple values for background-image",
"background-image",
"url(http://www.webkit.org/a) 1x, url(http://www.webkit.org/b) 2x");
testImageSetRule("Multiple values for background-image, out of order",
"background-image",
"url(http://www.webkit.org/c) 3x, url(http://www.webkit.org/b) 2x, url(http://www.webkit.org/a) 1x");
testImageSetRule("Duplicate values for background-image",
"background-image",
"url(http://www.webkit.org/c) 1x, url(http://www.webkit.org/b) 2x, url(http://www.webkit.org/a) 1x");
testImageSetRule("Fractional values for background-image",
"background-image",
"url(http://www.webkit.org/c) 0.2x, url(http://www.webkit.org/b) 2.3x, url(http://www.webkit.org/a) 12.3456x");
testImageSetRule("Single value for cursor",
"cursor",
"url(http://www.webkit.org/a) 1x");
testImageSetRule("Multiple values for cursor",
"cursor",
"url(http://www.webkit.org/a) 1x, url(http://www.webkit.org/b) 2x");
testImageSetRule("Multiple values for cursor, out of order",
"cursor",
"url(http://www.webkit.org/c) 3x, url(http://www.webkit.org/b) 2x, url(http://www.webkit.org/a) 1x");
testImageSetRule("Duplicate values for cursor",
"cursor",
"url(http://www.webkit.org/c) 1x, url(http://www.webkit.org/b) 2x, url(http://www.webkit.org/a) 1x");
testImageSetRule("Fractional values for cursor",
"cursor",
"url(http://www.webkit.org/c) 0.2x, url(http://www.webkit.org/b) 2.3x, url(http://www.webkit.org/a) 12.3456x");
testImageSetRule("Single value for list-style-image",
"list-style-image",
"url(http://www.webkit.org/a) 1x");
testImageSetRule("Multiple values for list-style-image",
"list-style-image",
"url(http://www.webkit.org/a) 1x, url(http://www.webkit.org/b) 2x");
testImageSetRule("Multiple values for list-style-image, out of order",
"list-style-image",
"url(http://www.webkit.org/c) 3x, url(http://www.webkit.org/b) 2x, url(http://www.webkit.org/a) 1x");
testImageSetRule("Duplicate values for list-style-image",
"list-style-image",
"url(http://www.webkit.org/c) 1x, url(http://www.webkit.org/b) 2x, url(http://www.webkit.org/a) 1x");
testImageSetRule("Fractional values for list-style-image",
"list-style-image",
"url(http://www.webkit.org/c) 0.2x, url(http://www.webkit.org/b) 2.3x, url(http://www.webkit.org/a) 12.3456x");
testImageSetRule("Single value for content",
"content",
"url(http://www.webkit.org/a) 1x");
testImageSetRule("Multiple values for content",
"content",
"url(http://www.webkit.org/a) 1x, url(http://www.webkit.org/b) 2x");
testImageSetRule("Multiple values for content, out of order",
"content",
"url(http://www.webkit.org/c) 3x, url(http://www.webkit.org/b) 2x, url(http://www.webkit.org/a) 1x");
testImageSetRule("Duplicate values for content",
"content",
"url(http://www.webkit.org/c) 1x, url(http://www.webkit.org/b) 2x, url(http://www.webkit.org/a) 1x");
testImageSetRule("Fractional values for content",
"content",
"url(http://www.webkit.org/c) 0.2x, url(http://www.webkit.org/b) 2.3x, url(http://www.webkit.org/a) 12.3456x");
</script>