Bug 616542 - Shorten file path length of mochitest; r=ted
[gecko.git] / content / svg / content / test / test_getCTM.html
blobf9a5fc16cb2393f103344946bea3d3f10ee18e3f
1 <!DOCTYPE html>
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=366697
5 -->
6 <head>
7 <title>Test for Bug 366697</title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=366697">Mozilla Bug 366697</a>
13 <p id="display"></p>
14 <div id="content" style="display: none"></div>
16 <iframe id="svg" src="getCTM-helper.svg"></iframe>
18 <pre id="test">
19 <script class="testbody" type="application/javascript">
20 SimpleTest.waitForExplicitFinish();
22 function runTest()
24 var doc = $("svg").contentWindow.document;
26 /* Minimal */
27 var buggy = doc.getElementById("buggy");
28 is(buggy.getCTM().e, 30, "buggy.getCTM().e");
29 is(buggy.getCTM().f, 40, "buggy.getCTM().f");
31 var root = doc.documentElement;
32 var inner = doc.getElementById("inner");
33 var g1 = doc.getElementById("g1");
34 var outer = doc.getElementById("outer");
35 var g2 = doc.getElementById("g2");
36 var g3 = doc.getElementById("g3");
37 var sym = doc.getElementById("sym");
38 var symbolRect = doc.getElementById("symbolRect");
39 /* Tests the consistency with nearestViewportElement
40 (code is from test_viewport.html) */
41 // root.nearestViewportElement == null
42 is((function(){try{return root.getCTM()}catch(e){return e}})(), null, "root.getCTM()");
43 // inner.nearestViewportElement == root
44 is((function(){try{return inner.getCTM().e}catch(e){return e}})(), 31, "inner.getCTM().e");
45 is((function(){try{return inner.getCTM().f}catch(e){return e}})(), 42, "inner.getCTM().f");
46 // g1.nearestViewportElement == inner
47 is((function(){try{return g1.getCTM().e}catch(e){return e}})(), 30, "g1.getCTM().e");
48 is((function(){try{return g1.getCTM().f}catch(e){return e}})(), 40, "g1.getCTM().f");
49 // outer.nearestViewportElement == null
50 is((function(){try{return outer.getCTM()}catch(e){return e}})(), null, "outer.getCTM()");
51 // g2.nearestViewportElement == outer
52 is((function(){try{return g2.getCTM().e}catch(e){return e}})(), 600, "g2.getCTM().e");
53 is((function(){try{return g2.getCTM().f}catch(e){return e}})(), 700, "g2.getCTM().f");
54 // g3.nearestViewportElement == null
55 is((function(){try{return g3.getCTM()}catch(e){return e}})(), null, "g3.getCTM()");
56 // symbolRect.nearestViewportElement == sym
57 is((function(){try{return symbolRect.getCTM().e}catch(e){return e}})(), 70, "symbolRect.getCTM().e");
58 is((function(){try{return symbolRect.getCTM().f}catch(e){return e}})(), 80, "symbolRect.getCTM().f");
60 /* Tests the consistency with farthestViewportElement
61 (code is from test_viewport.html) */
62 // root.farthestViewportElement == null (but actually == root)
63 is((function(){try{return root.getScreenCTM().e}catch(e){return e}})(), 11, "root.getScreenCTM().e");
64 is((function(){try{return root.getScreenCTM().f}catch(e){return e}})(), 22, "root.getScreenCTM().f");
65 // inner.farthestViewportElement == root
66 is((function(){try{return inner.getScreenCTM().e}catch(e){return e}})(), 45, "inner.getScreenCTM().e");
67 is((function(){try{return inner.getScreenCTM().f}catch(e){return e}})(), 68, "inner.getScreenCTM().f");
68 // g1.farthestViewportElement == root
69 is((function(){try{return g1.getScreenCTM().e}catch(e){return e}})(), 45, "g1.getScreenCTM().e");
70 is((function(){try{return g1.getScreenCTM().f}catch(e){return e}})(), 68, "g1.getScreenCTM().f");
71 // outer.farthestViewportElement == null (but actually == root)
72 is((function(){try{return outer.getScreenCTM().e}catch(e){return e}})(), 46, "outer.getScreenCTM().e");
73 is((function(){try{return outer.getScreenCTM().f}catch(e){return e}})(), 69, "outer.getScreenCTM().f");
74 // g2.farthestViewportElement == outer (but actually == root)
75 is((function(){try{return g2.getScreenCTM().e}catch(e){return e}})(), 646, "g2.getScreenCTM().e");
76 is((function(){try{return g2.getScreenCTM().f}catch(e){return e}})(), 769, "g2.getScreenCTM().f");
77 // g3.farthestViewportElement == null (but actually == null)
78 is((function(){try{return g3.getScreenCTM()}catch(e){return e}})(), null, "g3.getScreenCTM()");
79 // symbolRect.farthestViewportElement == root
80 is((function(){try{return symbolRect.getScreenCTM().e}catch(e){return e}})(), 85, "symbolRect.getScreenCTM().e");
81 is((function(){try{return symbolRect.getScreenCTM().f}catch(e){return e}})(), 108, "symbolRect.getScreenCTM().f");
83 SimpleTest.finish();
86 window.addEventListener("load", runTest, false);
87 </script>
88 </pre>
89 </body>
90 </html>