Index: third_party/WebKit/LayoutTests/fast/css/parsing-stroke-width.html |
diff --git a/third_party/WebKit/LayoutTests/fast/css/parsing-stroke-width.html b/third_party/WebKit/LayoutTests/fast/css/parsing-stroke-width.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..585592d69cd98e9c2499860c423c0fd9108ec8d4 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/css/parsing-stroke-width.html |
@@ -0,0 +1,58 @@ |
+<!DOCTYPE html> |
+<title>Tests that all of the input values for stroke-width parse correctly</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<body style="font-size:10px;"></body> |
+<script> |
+function assert_stroke_width_property_value(value, expected) |
+{ |
+ var div = document.createElement("div"); |
+ div.setAttribute("style", value); |
+ document.body.appendChild(div); |
+ |
+ var result = div.style.getPropertyValue("stroke-width"); |
+ assert_equals(result, expected); |
+ document.body.removeChild(div); |
+} |
+ |
+function assert_get_computed_style(value, expected) |
+{ |
+ var div = document.createElement("div"); |
+ div.setAttribute("style", value); |
+ document.body.appendChild(div); |
+ |
+ var result = window.getComputedStyle(div).strokeWidth; |
+ assert_equals(result, expected); |
+ document.body.removeChild(div); |
+} |
+ |
+function assert_get_computed_style_inherited(value, expected) |
+{ |
+ var div = document.createElement("div"); |
+ div.setAttribute("style", value); |
+ |
+ var div2 = document.createElement("div"); |
+ div.appendChild(div2); |
+ |
+ document.body.appendChild(div); |
+ |
+ var result = window.getComputedStyle(div2).strokeWidth; |
+ assert_equals(result, expected); |
+ document.body.removeChild(div); |
+} |
+ |
+test(function(){ |
+ assert_get_computed_style_inherited("stroke-width: 4px;", "4px"); |
+ assert_get_computed_style_inherited("stroke-width: 1em;", "10px"); |
+ assert_get_computed_style_inherited("stroke-width: 10%;", "10%"); |
+ |
+ assert_get_computed_style(";", "1px"); |
+ assert_stroke_width_property_value("stroke-width: 4px;", "4px"); |
+ assert_stroke_width_property_value("stroke-width: 0.01em;", "0.01em"); |
+ assert_stroke_width_property_value("stroke-width: 10%;", "10%"); |
+ |
+ assert_stroke_width_property_value("stroke-width: 4;", "4"); |
+ assert_stroke_width_property_value("stroke-width: em;", ""); |
+ assert_stroke_width_property_value("stroke-width: %;", ""); |
+}); |
+</script> |