Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: LayoutTests/svg/css/parse-length.html

Issue 980233002: [svg2] Make 'cx', 'cy' and 'r' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/svg/css/parse-length-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/svg/css/parse-length.html
diff --git a/LayoutTests/svg/css/parse-length.html b/LayoutTests/svg/css/parse-length.html
index f7044b9f57a3b2d0f1313667a17736fa1e3c1268..11569aac144f38b100690adf6a83a3a7c5638e94 100644
--- a/LayoutTests/svg/css/parse-length.html
+++ b/LayoutTests/svg/css/parse-length.html
@@ -11,90 +11,56 @@ div { font-size: 8px; }
<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 computedStyle(elementname, property, value) {
+ var elm = document.createElementNS('http://www.w3.org/2000/svg', elementname);
+ document.getElementById('svg').appendChild(elm);
+ elm.setAttribute(property, value);
+ var computedValue = getComputedStyle(elm).getPropertyValue(property);
+ document.getElementById('svg').removeChild(elm);
+ return computedValue;
}
-function testComputed(property, value, expected) {
- shouldBeEqualToString('computedStyle("' + property + '", "' + value + '")', expected);
+function testComputed(elementname, property, value, expected) {
+ shouldBeEqualToString('computedStyle("' + elementname + '", "' + property + '", "' + value + '")', expected);
}
-function negativeTest(property, value) {
- testComputed(property, value, "auto");
+function negativeTest(elementname, property, value) {
+ testComputed(elementname, property, value, "auto");
}
-function negativeTestZero(property, value) {
- testComputed(property, value, "0px");
+function negativeTestZero(elementname, property, value) {
+ testComputed(elementname, 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");
+function testAttributeOnElement(elementname, attributename) {
+ testComputed(elementname, attributename, " 100", "100px");
+ testComputed(elementname, attributename, "100 ", "100px");
+ testComputed(elementname, attributename, "100px", "100px");
+ testComputed(elementname, attributename, "1em", "16px");
+ // testComputed(elementname, attributename, "1ex", "12.8000001907349px"); // enable this again once http://crbug.com/441840 is fixed
+ testComputed(elementname, attributename, "20%", "20%");
+ testComputed(elementname, attributename, "-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 }");
-
-// Test 'rx'.
-testComputed("rx", " 100", "100px");
-testComputed("rx", "100 ", "100px");
-testComputed("rx", "100px", "100px");
-testComputed("rx", "1em", "16px");
-// testComputed("rx", "1ex", "12.8000001907349px"); // enable this again once http://crbug.com/441840 is fixed
-testComputed("rx", "20%", "20%");
-testComputed("rx", "-200px", "-200px");
+ negativeTestZero(elementname, attributename, "auto", "auto");
+ negativeTestZero(elementname, attributename, "100 px");
+ negativeTestZero(elementname, attributename, "100px;");
+ negativeTestZero(elementname, attributename, "100px !important");
+ negativeTestZero(elementname, attributename, "{ 100px }");
+}
-// Test 'ry'.
-testComputed("ry", " 100", "100px");
-testComputed("ry", "100 ", "100px");
-testComputed("ry", "100px", "100px");
-testComputed("ry", "1em", "16px");
-// testComputed("ry", "1ex", "12.8000001907349px"); // enable this again once http://crbug.com/441840 is fixed
-testComputed("ry", "20%", "20%");
-testComputed("ry", "-200px", "-200px");
+var xyelements = [ "mask", "svg", "rect", "image", "foreignObject" ];
+for (var elm of xyelements) {
+ testAttributeOnElement(elm, "x");
+ testAttributeOnElement(elm, "y");
+}
-// Negative tests for 'rx'.
-negativeTestZero("rx", "auto", "auto");
-negativeTestZero("rx", "100 px");
-negativeTestZero("rx", "100px;");
-negativeTestZero("rx", "100px !important");
-negativeTestZero("rx", "{ 100px }");
+var rxryelements = [ "rect", "ellipse" ];
+for (var elm of rxryelements) {
+ testAttributeOnElement(elm, "rx");
+ testAttributeOnElement(elm, "ry");
+}
-// Negative tests for 'ry'.
-negativeTestZero("ry", "auto");
-negativeTestZero("ry", "100 px");
-negativeTestZero("ry", "100px;");
-negativeTestZero("ry", "100px !important");
-negativeTestZero("ry", "{ 100px }");
+testAttributeOnElement("circle", "r");
</script>
</body>
</html>
« no previous file with comments | « no previous file | LayoutTests/svg/css/parse-length-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698