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

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

Issue 896773002: [svg2] Make 'x' and 'y' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 10 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
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>
« 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