blob: e10306dc144dacc66f71c3ee2dc045b1b104cf68 [file] [log] [blame]
<!DOCTYPE html>
<html>
<style>
* { font-size: 16px; }
div { font-size: 8px; }
</style>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description('Test parsing and computed style of stop-opacity');
function computedStyle(property, value) {
var div = document.createElement("div");
document.body.appendChild(div);
div.style.setProperty(property, value);
var computedValue = getComputedStyle(div).getPropertyValue(property);
document.body.removeChild(div);
return computedValue;
}
function innerStyle(property, value) {
var div = document.createElement("div");
div.style.setProperty(property, value);
return div.style.getPropertyValue(property);
}
function testComputed(property, value, expected) {
shouldBeEqualToString('computedStyle("' + property + '", "' + value + '")', expected);
}
function testInner(property, value, expected) {
if (expected === null)
expected = "";
shouldBeEqualToString('innerStyle("' + property + '", "' + value + '")', expected);
}
function negativeTest(property, value) {
testInner(property, value, null);
// FIXME: Computed style not yet implemented.
// testComputed(property, value, 'none');
}
testInner("stop-opacity", "0", "0");
testInner("stop-opacity", "0.5", "0.5");
testInner("stop-opacity", "1", "1");
testInner("stop-opacity", "1000", "1000");
testInner("stop-opacity", "-400", "-400");
testInner("stop-opacity", "20%", "0.2");
testInner("stop-opacity", "-600%", "-6");
testInner("stop-opacity", "700%", "7");
testInner("stop-opacity", "2.5e-1", "0.25");
testInner("stop-opacity", "2.5e1%", "0.25");
testInner("stop-opacity", "100.25%", "1.0025");
testComputed("stop-opacity", "0", "0");
testComputed("stop-opacity", "0.5", "0.5");
testComputed("stop-opacity", "1", "1");
testComputed("stop-opacity", "1000", "1");
testComputed("stop-opacity", "-400", "0");
testComputed("stop-opacity", "25%", "0.25");
testComputed("stop-opacity", "-600%", "0");
testComputed("stop-opacity", "700%", "1");
testComputed("stop-opacity", "2.5e-1", "0.25");
testComputed("stop-opacity", "2.5e1%", "0.25");
testComputed("stop-opacity", "100.25%", "1");
negativeTest("stop-opacity", "2px");
negativeTest("stop-opacity", "auto");
negativeTest("stop-opacity", "none");
negativeTest("stop-opacity", "'str'");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>