Index: LayoutTests/fast/svg/getScreenCTM.html |
diff --git a/LayoutTests/fast/svg/getScreenCTM.html b/LayoutTests/fast/svg/getScreenCTM.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..14095473219bb8b0281b2a397c321b1fabdad46b |
--- /dev/null |
+++ b/LayoutTests/fast/svg/getScreenCTM.html |
@@ -0,0 +1,61 @@ |
+<!doctype html> |
+<title>getScreenCTM tests</title> |
+<script src=../../resources/testharness.js></script> |
+<script src=../../resources/testharnessreport.js></script> |
+<div id="testcontainer"> |
+<style> |
+ svg { |
+ visibility: hidden; |
+ position: absolute; |
+ top:0; |
+ left:0; |
+ } |
+ #a, #c, #d, #e { width: 50px; height: 100px } |
+</style> |
+<svg id="a" width="100" height="200"/> |
+<svg id="b" width="100" height="200"/> |
+<svg id="c" width="100" height="200" viewBox="0 0 100 200"/> |
+<svg id="d" viewBox="0 0 100 200"/> |
+<svg id="e" viewBox="0 0 200 400"> |
+ <svg id="f" viewBox="0 0 100 200"> |
+ <g id="g"/> |
+ </svg> |
+</svg> |
+</div> |
+<div id=log></div> |
+<script> |
+function ctmToString(ctm) { |
+ return [ ctm.a, ctm.b, ctm.c, ctm.d, ctm.e, ctm.f ].join(' '); |
+} |
+ |
+test(function() { |
+ var ctm = ctmToString(document.getElementById("a").getScreenCTM()); |
+ assert_equals(ctm, "1 0 0 1 0 0", ""); |
+}, "css defined viewport"); |
+ |
+test(function() { |
+ var ctm = ctmToString(document.getElementById("b").getScreenCTM()); |
+ assert_equals(ctm, "1 0 0 1 0 0", ""); |
+}, "svg defined viewport"); |
+ |
+test(function() { |
+ var ctm = ctmToString(document.getElementById("c").getScreenCTM()); |
+ assert_equals(ctm, "0.5 0 0 0.5 0 0", ""); |
+}, "css defined viewport + svg has w, h, viewBox"); |
+ |
+test(function() { |
+ var ctm = ctmToString(document.getElementById("d").getScreenCTM()); |
+ assert_equals(ctm, "0.5 0 0 0.5 0 0", ""); |
+}, "css defined viewport + svg has viewBox"); |
+ |
+test(function() { |
+ var ctm = ctmToString(document.getElementById("f").getScreenCTM()); |
+ assert_equals(ctm, "0.5 0 0 0.5 0 0", ""); |
+}, "nested svg"); |
+ |
+test(function() { |
+ var ctm = ctmToString(document.getElementById("g").getScreenCTM()); |
+ assert_equals(ctm, "0.5 0 0 0.5 0 0", ""); |
+}, "g child of nested svg"); |
+ |
+</script> |