OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <title>getScreenCTM tests</title> |
| 3 <script src=../../resources/testharness.js></script> |
| 4 <script src=../../resources/testharnessreport.js></script> |
| 5 <div id="testcontainer"> |
| 6 <style> |
| 7 svg { |
| 8 visibility: hidden; |
| 9 position: absolute; |
| 10 top:0; |
| 11 left:0; |
| 12 } |
| 13 #a, #c, #d, #e { width: 50px; height: 100px } |
| 14 </style> |
| 15 <svg id="a" width="100" height="200"/> |
| 16 <svg id="b" width="100" height="200"/> |
| 17 <svg id="c" width="100" height="200" viewBox="0 0 100 200"/> |
| 18 <svg id="d" viewBox="0 0 100 200"/> |
| 19 <svg id="e" viewBox="0 0 200 400"> |
| 20 <svg id="f" viewBox="0 0 100 200"> |
| 21 <g id="g"/> |
| 22 </svg> |
| 23 </svg> |
| 24 </div> |
| 25 <div id=log></div> |
| 26 <script> |
| 27 function ctmToString(ctm) { |
| 28 return [ ctm.a, ctm.b, ctm.c, ctm.d, ctm.e, ctm.f ].join(' '); |
| 29 } |
| 30 |
| 31 test(function() { |
| 32 var ctm = ctmToString(document.getElementById("a").getScreenCTM()); |
| 33 assert_equals(ctm, "1 0 0 1 0 0", ""); |
| 34 }, "css defined viewport"); |
| 35 |
| 36 test(function() { |
| 37 var ctm = ctmToString(document.getElementById("b").getScreenCTM()); |
| 38 assert_equals(ctm, "1 0 0 1 0 0", ""); |
| 39 }, "svg defined viewport"); |
| 40 |
| 41 test(function() { |
| 42 var ctm = ctmToString(document.getElementById("c").getScreenCTM()); |
| 43 assert_equals(ctm, "0.5 0 0 0.5 0 0", ""); |
| 44 }, "css defined viewport + svg has w, h, viewBox"); |
| 45 |
| 46 test(function() { |
| 47 var ctm = ctmToString(document.getElementById("d").getScreenCTM()); |
| 48 assert_equals(ctm, "0.5 0 0 0.5 0 0", ""); |
| 49 }, "css defined viewport + svg has viewBox"); |
| 50 |
| 51 test(function() { |
| 52 var ctm = ctmToString(document.getElementById("f").getScreenCTM()); |
| 53 assert_equals(ctm, "0.5 0 0 0.5 0 0", ""); |
| 54 }, "nested svg"); |
| 55 |
| 56 test(function() { |
| 57 var ctm = ctmToString(document.getElementById("g").getScreenCTM()); |
| 58 assert_equals(ctm, "0.5 0 0 0.5 0 0", ""); |
| 59 }, "g child of nested svg"); |
| 60 |
| 61 </script> |
OLD | NEW |