| Index: LayoutTests/svg/css/parse-length.html
|
| diff --git a/LayoutTests/svg/css/parse-length.html b/LayoutTests/svg/css/parse-length.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ab942b1cfd413668479ad3bd7782109ed7fd1984
|
| --- /dev/null
|
| +++ b/LayoutTests/svg/css/parse-length.html
|
| @@ -0,0 +1,68 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<style>
|
| +* { font-size: 16px; }
|
| +svg, rect { font-family: 'Ahem'; }
|
| +div { font-size: 8px; }
|
| +</style>
|
| +<html>
|
| +<svg id="svg" width="0" height="0"></svg>
|
| +<script src="../../resources/js-test.js"></script>
|
| +<script>
|
| +description("Test that 'length' presentation attribute values are parsed with CSS presentation rules.");
|
| +
|
| +function computedStyle(property, value) {
|
| + var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
| + document.getElementById('svg').appendChild(rect);
|
| + rect.setAttribute(property, value);
|
| + var computedValue = getComputedStyle(rect).getPropertyValue(property);
|
| + document.getElementById('svg').removeChild(rect);
|
| + return computedValue;
|
| +}
|
| +
|
| +function testComputed(property, value, expected) {
|
| + shouldBeEqualToString('computedStyle("' + property + '", "' + value + '")', expected);
|
| +}
|
| +
|
| +function negativeTest(property, value) {
|
| + testComputed(property, value, "auto");
|
| +}
|
| +
|
| +function negativeTestZero(property, value) {
|
| + testComputed(property, value, "0px");
|
| +}
|
| +
|
| +// Test 'x'.
|
| +testComputed("x", " 100", "100px");
|
| +testComputed("x", "100 ", "100px");
|
| +testComputed("x", "100px", "100px");
|
| +testComputed("x", "1em", "16px");
|
| +// testComputed("x", "1ex", "12.8000001907349px"); // enable this again once http://crbug.com/441840 is fixed
|
| +testComputed("x", "20%", "20%");
|
| +testComputed("x", "-200px", "-200px");
|
| +
|
| +// Test 'y'.
|
| +testComputed("y", " 100", "100px");
|
| +testComputed("y", "100 ", "100px");
|
| +testComputed("y", "100px", "100px");
|
| +testComputed("y", "1em", "16px");
|
| +// testComputed("y", "1ex", "12.8000001907349px"); // enable this again once http://crbug.com/441840 is fixed
|
| +testComputed("y", "20%", "20%");
|
| +testComputed("y", "-200px", "-200px");
|
| +
|
| +// Negative tests for 'x'.
|
| +negativeTestZero("x", "auto", "auto");
|
| +negativeTestZero("x", "100 px");
|
| +negativeTestZero("x", "100px;");
|
| +negativeTestZero("x", "100px !important");
|
| +negativeTestZero("x", "{ 100px }");
|
| +
|
| +// Negative tests for 'y'.
|
| +negativeTestZero("y", "auto");
|
| +negativeTestZero("y", "100 px");
|
| +negativeTestZero("y", "100px;");
|
| +negativeTestZero("y", "100px !important");
|
| +negativeTestZero("y", "{ 100px }");
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|