74 lines
2.4 KiB
HTML
74 lines
2.4 KiB
HTML
<!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 stroke-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("stroke-opacity", "0", "0");
|
|
testInner("stroke-opacity", "0.5", "0.5");
|
|
testInner("stroke-opacity", "1", "1");
|
|
testInner("stroke-opacity", "1000", "1000");
|
|
testInner("stroke-opacity", "-400", "-400");
|
|
testInner("stroke-opacity", "20%", "0.2");
|
|
testInner("stroke-opacity", "-600%", "-6");
|
|
testInner("stroke-opacity", "700%", "7");
|
|
testInner("stroke-opacity", "2.5e-1", "0.25");
|
|
testInner("stroke-opacity", "2.5e1%", "0.25");
|
|
testInner("stroke-opacity", "100.25%", "1.0025");
|
|
testComputed("stroke-opacity", "0", "0");
|
|
testComputed("stroke-opacity", "0.5", "0.5");
|
|
testComputed("stroke-opacity", "1", "1");
|
|
testComputed("stroke-opacity", "1000", "1");
|
|
testComputed("stroke-opacity", "-400", "0");
|
|
testComputed("stroke-opacity", "25%", "0.25");
|
|
testComputed("stroke-opacity", "-600%", "0");
|
|
testComputed("stroke-opacity", "700%", "1");
|
|
testComputed("stroke-opacity", "2.5e-1", "0.25");
|
|
testComputed("stroke-opacity", "2.5e1%", "0.25");
|
|
testComputed("stroke-opacity", "100.25%", "1");
|
|
negativeTest("stroke-opacity", "2px");
|
|
negativeTest("stroke-opacity", "auto");
|
|
negativeTest("stroke-opacity", "none");
|
|
negativeTest("stroke-opacity", "'str'");
|
|
|
|
</script>
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|