1 <html xmlns=
"http://www.w3.org/1999/xhtml">
3 https://bugzilla.mozilla.org/show_bug.cgi?id=508496
6 <title>Test for object identity of SVG animated lengths
</title>
7 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
8 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
11 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=506856">Mozilla Bug
508496</a>
13 <div id=
"content" style=
"display: none">
14 <svg id=
"svg" xmlns=
"http://www.w3.org/2000/svg" width=
"120px" height=
"120px"
15 onload=
"this.pauseAnimations()">
16 <circle cx=
"-100" cy=
"-100" r=
"15" fill=
"blue" id=
"circle">
17 <animate attributeName=
"cx" from=
"0" to=
"100" dur=
"4s" begin=
"1s; 10s"
18 fill=
"freeze" id=
"animate"/>
23 <script class=
"testbody" type=
"text/javascript">
25 /** Test object identity of animated lengths **/
27 /* Global Variables */
28 const svgns =
"http://www.w3.org/2000/svg";
29 var svg = document.getElementById(
"svg");
30 var circle = document.getElementById(
"circle");
32 SimpleTest.waitForExplicitFinish();
35 ok(svg.animationsPaused(),
"should be paused by <svg> load handler");
36 is(svg.getCurrentTime(),
0,
"should be paused at 0 in <svg> load handler");
38 var animLength = circle.cx;
39 ok(animLength === circle.cx,
40 "Got different SVGAnimatedLength objects at startup");
42 var baseVal = circle.cx.baseVal;
43 ok(baseVal === circle.cx.baseVal,
44 "Got different baseVal SVGLength objects at startup");
46 var animVal = circle.cx.animVal;
47 ok(animVal === circle.cx.animVal,
48 "Got different animVal SVGLength objects at startup");
50 var animate = document.getElementById(
"animate");
51 if (animate && animate.targetElement) {
52 // Sample mid-way through the animation
53 svg.setCurrentTime(
5);
55 ok(animLength === circle.cx,
56 "Got different SVGAnimatedLength objects during animation");
57 ok(baseVal === circle.cx.baseVal,
58 "Got different baseVal SVGLength objects during animation");
59 ok(animVal === circle.cx.animVal,
60 "Got different animVal SVGLength objects during animation");
63 // Drop all references to the tear off objects
64 var oldValue = circle.cx.animVal.value; // Just a float, not an object ref
70 // The tearoff objects should no longer exist and we should create new ones.
71 // If somehow, the tearoff objects have died and yet not been removed from the
72 // hashmap we'll end up in all sorts of trouble when we try to access them.
73 // So in the following, we're not really interested in the value, just that we
75 is(circle.cx.animVal.value, oldValue,
76 "Unexpected result accessing new(?) length object.");
81 window.addEventListener(
"load", main);