Bug 1873144 - Disabled test_conformance__textures__misc__texture-npot-video.html...
[gecko.git] / dom / svg / test / test_fragments.html
blobb12833e899f613c0a505d1b40fb17e8e2e1329cf
1 <!DOCTYPE html>
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=759124
5 -->
6 <head>
7 <title>Test for Bug 759124</title>
8 <script 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=759124">Mozilla Bug 759124</a>
13 <p id="display"></p>
14 <div id="content" style="display: none"></div>
16 <iframe id="svg"></iframe>
18 <pre id="test">
19 <script class="testbody" type="application/javascript">
20 var svg = $("svg");
22 SimpleTest.waitForExplicitFinish();
24 function Test(svgFragmentIdentifier, viewBoxString,
25 preserveAspectRatioString, zoomAndPanString) {
26 this.svgFragmentIdentifier = svgFragmentIdentifier;
29 function runTests() {
30 var doc = svg.contentWindow.document;
31 var rootElement = doc.documentElement;
33 var tests = [
34 new Test("svgView(viewBox(0,0,200,200))"),
35 new Test("svgView(preserveAspectRatio(xMaxYMin slice))"),
36 new Test("svgView(viewBox(1,2,3,4);preserveAspectRatio(xMinYMax))"),
37 new Test("svgView(viewBox(none))"),
38 new Test("svgView(zoomAndPan(disable))"),
39 new Test("svgView(transform(translate(-10,-20) scale(2) rotate(45) translate(5,10)))"),
42 var src = svg.getAttribute("src");
44 is(false, rootElement.hasAttribute("viewBox"),
45 "expecting to start without a viewBox set");
46 is(false, rootElement.hasAttribute("preserveAspectRatio"),
47 "expecting to start without preserveAspectRatio set");
48 is(false, rootElement.hasAttribute("zoomAndPan"),
49 "expecting to start without zoomAndPan set");
51 for (var j = 0; j < 2; j++) {
52 var initialViewBox = rootElement.getAttribute("viewBox");
53 var initialPreserveAspectRatio =
54 rootElement.getAttribute("preserveAspectRatio");
55 var initialZoomAndPan = rootElement.getAttribute("zoomAndPan");
56 var initialTransform = rootElement.getAttribute("transform");
58 for (var i = 0; i < tests.length; i++) {
59 var test = tests[i];
60 svg.setAttribute("src", src + "#" + test.svgFragmentIdentifier);
62 // check that assigning a viewSpec does not modify the underlying
63 // attribute values.
64 is(rootElement.getAttribute("viewBox"),
65 initialViewBox, "unexpected viewBox");
67 is(rootElement.getAttribute("preserveAspectRatio"),
68 initialPreserveAspectRatio, "unexpected preserveAspectRatio");
70 is(rootElement.getAttribute("zoomAndPan"),
71 initialZoomAndPan, "unexpected zoomAndPan");
73 is(rootElement.getAttribute("transform"),
74 initialTransform, "unexpected transform");
77 // repeat tests with underlying attributes set to values
78 rootElement.setAttribute("viewBox", "0 0 100 100");
79 rootElement.setAttribute("preserveAspectRatio", "none");
80 rootElement.setAttribute("zoomAndPan", "disable");
81 rootElement.setAttribute("transform", "translate(10,10)");
84 SimpleTest.finish();
87 svg.addEventListener("load", runTests);
88 svg.setAttribute("src", "fragments-helper.svg");
89 </script>
90 </pre>
91 </body>
92 </html>