Index: LayoutTests/svg/zoom/xy-getcomputedstyle.html |
diff --git a/LayoutTests/svg/zoom/xy-getcomputedstyle.html b/LayoutTests/svg/zoom/xy-getcomputedstyle.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d79c34136b08c9740735e352c096868c94e6f871 |
--- /dev/null |
+++ b/LayoutTests/svg/zoom/xy-getcomputedstyle.html |
@@ -0,0 +1,49 @@ |
+<!doctype html> |
+<html> |
+<title>Test computed style on x and y properties</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<svg xmlns="http://www.w3.org/2000/svg" height="32" width="32"> |
+ <defs> |
+ <circle id="circle" cx="50" cy="60" r="32"/> |
+ </defs> |
+ <rect class="test" x="37px" y="50%" width="100" height="100"/> |
+ <use class="test" x="17" y="51mm" xlink:href="#circle"/> |
+ <svg class="test" x="22%" y="4cm" width="100" height="100"/> |
+ <pattern class="test" x="27px" y="2in" width="100" height="100"/> |
+ <mask class="test" x="15pc" y="27pt"/> |
+ <image class="test" y="57"/> |
+ <foreignObject class="test" x="32%" y="1"/> |
+</svg> |
+<script> |
+ var elms = document.querySelectorAll(".test"); |
+ var attrs = [ "x", "y" ]; |
+ var expected = [ |
+ [ "37px", "50%" ], |
+ [ "17px", "192.755905151367px" ], |
+ [ "22%", "151.181106567383px" ], |
+ [ "27px", "192px" ], |
+ [ "240px", "36px" ], |
+ [ "0px", "57px" ], |
+ [ "32%", "1px" ], |
+ ]; |
+ |
+ function runTestsWithZoom(zoomLevel) { |
+ document.querySelector("svg").setAttribute("style", "zoom: " + zoomLevel); |
+ for (var i = 0; i < elms.length; i++) { |
+ var style = getComputedStyle(elms[i]); |
+ for (var j = 0; j < attrs.length; j++) { |
+ test(function() { |
+ assert_equals(style.getPropertyValue(attrs[j]), expected[i][j]); |
+ }, "zoom=" + zoomLevel + ": " + elms[i].localName + " getPropertyValue(" + attrs[j] + ")"); |
+ test(function() { |
+ assert_equals(style[attrs[j]], expected[i][j]); |
+ }, "zoom=" + zoomLevel + ": " +elms[i].localName + " style." + attrs[j]); |
+ } |
+ } |
+ } |
+ |
+ runTestsWithZoom(1); |
+ runTestsWithZoom(2); |
+</script> |
+</html> |