summaryrefslogtreecommitdiffstats
path: root/dom/svg/test/test_nonAnimStrings.xhtml
blob: b74231837661c69b7bd6a3def488c39b3e9e9caa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=589436
-->
<head>
  <title>Test for non-animated strings</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=589436">Mozilla Bug 589436</a>
<p id="display"></p>
<div id="content" style="display: none">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="120px" height="120px"
     onload="this.pauseAnimations()">
  <defs>
    <path id="moveFarAway"      d="M300,300 h0"/>
    <path id="moveToUpperLeft"  d="M100,100 h0"/>
  </defs>
  <script id="script">
    <animate attributeName="xlink:href" from="" to="animated" dur="0.5s" begin="1s"
      fill="freeze" id="animate"/>
  </script>
  <rect class="test" x="0" y="0" width="50" height="50">
    <animateMotion begin="1" dur="1" fill="freeze">
      <mpath id="mpath" xlink:href="#moveFarAway">
        <animate attributeName="xlink:href" from="#moveFarAway" to="#moveToUpperLeft" dur="0.5s" begin="1s"
          fill="freeze"/>
      </mpath>
    </animateMotion>
  </rect>
</svg>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
<![CDATA[
/** Test some strings are not animatable **/

/* Global Variables */
var svg = document.getElementById("svg");
var script = document.getElementById('script');
var mpath = document.getElementById('mpath');
var animate = document.getElementById('animate');

SimpleTest.waitForExplicitFinish();

function main() {
  ok(svg.animationsPaused(), "should be paused by <svg> load handler");
  is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");

  // Sanity check: check initial values
  is(script.href.baseVal, "", "Unexpected initial script baseVal");
  is(script.href.animVal, "", "Unexpected initial script animVal");
  is(mpath.href.baseVal, "#moveFarAway", "Unexpected initial mpath baseVal");
  is(mpath.href.animVal, "#moveFarAway", "Unexpected initial mpath animVal");

  // Move to the end of the animation - should make no difference
  svg.setCurrentTime(2);

  is(script.href.baseVal, "", "Unexpected value for script baseVal after animation");
  is(script.href.animVal, "", "Unexpected value for script animVal after animation");
  is(mpath.href.baseVal, "#moveFarAway", "Unexpected value for mpath baseVal after animation");
  is(mpath.href.animVal, "#moveFarAway", "Unexpected value for mpath animVal after animation");

  SimpleTest.finish();
}

if (animate && animate.targetElement) {
  window.addEventListener("load", main, false);
} else {
  ok(true); // Skip tests but don't report 'todo' either
  SimpleTest.finish();
}
]]>
</script>
</pre>
</body>
</html>