2 <html xmlns=
"http://www.w3.org/1999/xhtml">
4 https://bugzilla.mozilla.org/show_bug.cgi?id=759124
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" />
12 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=759124">Mozilla Bug
759124</a>
14 <div id=
"content" style=
"display: none"></div>
16 <iframe id=
"svg"></iframe>
19 <script class=
"testbody" type=
"application/javascript">
22 SimpleTest.waitForExplicitFinish();
24 function Test(svgFragmentIdentifier, viewBoxString,
25 preserveAspectRatioString, zoomAndPanString) {
26 this.svgFragmentIdentifier = svgFragmentIdentifier;
30 var doc = svg.contentWindow.document;
31 var rootElement = doc.documentElement;
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++) {
60 svg.setAttribute(
"src", src +
"#" + test.svgFragmentIdentifier);
62 // check that assigning a viewSpec does not modify the underlying
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)");
87 svg.addEventListener(
"load", runTests);
88 svg.setAttribute(
"src",
"fragments-helper.svg");