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

Unified Diff: LayoutTests/svg/zoom/xy-getcomputedstyle.html

Issue 947983002: Move zoom handling for x and y properties to svg (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: move function 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 | « LayoutTests/TestExpectations ('k') | LayoutTests/transitions/svg-layout-transition-zoom.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/transitions/svg-layout-transition-zoom.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698