summaryrefslogtreecommitdiffstats
path: root/layout/reftests/svg/smil/restart
diff options
context:
space:
mode:
Diffstat (limited to 'layout/reftests/svg/smil/restart')
-rw-r--r--layout/reftests/svg/smil/restart/green-box-ref.svg3
-rw-r--r--layout/reftests/svg/smil/restart/reftest.list8
-rw-r--r--layout/reftests/svg/smil/restart/reset-1-ref.svg6
-rw-r--r--layout/reftests/svg/smil/restart/reset-1.svg84
-rw-r--r--layout/reftests/svg/smil/restart/reset-2.svg33
-rw-r--r--layout/reftests/svg/smil/restart/reset-3.svg39
-rw-r--r--layout/reftests/svg/smil/restart/reset-4.svg27
-rw-r--r--layout/reftests/svg/smil/restart/reset-6.svg58
-rw-r--r--layout/reftests/svg/smil/restart/reset-7.svg25
9 files changed, 283 insertions, 0 deletions
diff --git a/layout/reftests/svg/smil/restart/green-box-ref.svg b/layout/reftests/svg/smil/restart/green-box-ref.svg
new file mode 100644
index 0000000000..120941444a
--- /dev/null
+++ b/layout/reftests/svg/smil/restart/green-box-ref.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+ <rect width="100" height="100" fill="green"/>
+</svg>
diff --git a/layout/reftests/svg/smil/restart/reftest.list b/layout/reftests/svg/smil/restart/reftest.list
new file mode 100644
index 0000000000..98ed6d4b13
--- /dev/null
+++ b/layout/reftests/svg/smil/restart/reftest.list
@@ -0,0 +1,8 @@
+# Tests for restart behaviour
+== reset-1.svg reset-1-ref.svg
+== reset-2.svg green-box-ref.svg
+== reset-3.svg green-box-ref.svg
+== reset-4.svg green-box-ref.svg
+# reset-5.svg is no longer valid and has been removed
+== reset-6.svg green-box-ref.svg
+== reset-7.svg green-box-ref.svg
diff --git a/layout/reftests/svg/smil/restart/reset-1-ref.svg b/layout/reftests/svg/smil/restart/reset-1-ref.svg
new file mode 100644
index 0000000000..2e85bda91d
--- /dev/null
+++ b/layout/reftests/svg/smil/restart/reset-1-ref.svg
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+ <circle cx="150" cy="50" r="30" fill="blue"/>
+ <circle cx="150" cy="120" r="30" fill="blue"/>
+ <circle cx="150" cy="190" r="30" fill="blue"/>
+ <circle cx="50" cy="260" r="30" fill="blue"/>
+</svg>
diff --git a/layout/reftests/svg/smil/restart/reset-1.svg b/layout/reftests/svg/smil/restart/reset-1.svg
new file mode 100644
index 0000000000..d33c3b38a1
--- /dev/null
+++ b/layout/reftests/svg/smil/restart/reset-1.svg
@@ -0,0 +1,84 @@
+<!--
+ This tests reset behaviour (SMILANIM 3.3.7).
+
+ Reset behaviour is invoked when an element restarts. Some instance times
+ (DOM calls, event-based instance times etc.) should be cleared on a reset.
+ Other instance times should not. This test build up the following timegraph:
+
+ |...| |...| |...| |...|
+ ^ ^ ^ ^
+ A B C D
+
+ Instance times A and C are created by the begin spec and are offset time
+ values which should NOT be cleared on a reset, e.g. begin="1s; 3s"
+
+ Instance times B and D are created by DOM calls and SHOULD be cleared on
+ a reset.
+
+ A reset will occur when the interval beginning with begin instance time
+ B begins. At this time a reset is performed and only instance time D should
+ be cleared. That is, the animation should play THREE (3) times, not four.
+
+ We would like to inspect the result at each of the intervals. To do this
+ using a reftest we duplicate the animate four-times and adjust the timing so
+ that at the animation sample time we are mid-way through each of the four
+ intervals.
+
+ -->
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ class="reftest-wait"
+ onload="addInstanceTimes()">
+ <script type="text/ecmascript"><![CDATA[
+ function addInstanceTimes() {
+ document.documentElement.setCurrentTime(0);
+ var animate1 = document.getElementById('animate1');
+ animate1.beginElementAt(10);
+ animate1.beginElementAt(4);
+ var animate2 = document.getElementById('animate2');
+ animate2.beginElementAt(1.8);
+ animate2.beginElementAt(3.8);
+ var animate3 = document.getElementById('animate3');
+ animate3.beginElementAt(1.2);
+ animate3.beginElementAt(2.4);
+ var animate4 = document.getElementById('animate4');
+ animate4.beginElementAt(0.6);
+ animate4.beginElementAt(1.8);
+ setTimeAndSnapshot(2, true);
+ }
+ ]]></script>
+ <script xlink:href="../smil-util.js" type="text/javascript"/>
+ <!--
+ Animation #1: Should be mid-way through first interval at t=2
+ Set up intervals: 1-3 4-6 7-9 10-12
+ -->
+ <circle cx="50" cy="50" r="30" fill="blue">
+ <animate attributeName="cx" attributeType="XML"
+ to="250" begin="1s; 7s" dur="2s" fill="remove" id="animate1"/>
+ </circle>
+ <!--
+ Animation #2: Should be mid-way through second interval at t=2
+ Set up intervals: 0.8-1.2 1.8-2.2 2.8-3.2 3.8-4.2
+ -->
+ <circle cx="50" cy="120" r="30" fill="blue">
+ <animate attributeName="cx" attributeType="XML"
+ to="250" begin="0.8; 2.8" dur="0.4s" fill="remove" id="animate2"/>
+ </circle>
+ <!--
+ Animation #3: Should be mid-way through third interval at t=2
+ Set up intervals: 0.6-1.0 1.2-1.6 1.8-2.2 2.4-2.8
+ -->
+ <circle cx="50" cy="190" r="30" fill="blue">
+ <animate attributeName="cx" attributeType="XML"
+ to="250" begin="0.6; 1.8" dur="0.4s" fill="remove" id="animate3"/>
+ </circle>
+ <!--
+ Animation #4: Would be mid-way through fourth interval at t=2 if the
+ instance time wasn't cleared
+ Set up intervals: 0.1-0.5 0.6-1.0 1.2-1.6 1.8-2.2
+ -->
+ <circle cx="50" cy="260" r="30" fill="blue">
+ <animate attributeName="cx" attributeType="XML"
+ to="250" begin="0.1; 1.2" dur="0.4s" fill="remove" id="animate4"/>
+ </circle>
+</svg>
diff --git a/layout/reftests/svg/smil/restart/reset-2.svg b/layout/reftests/svg/smil/restart/reset-2.svg
new file mode 100644
index 0000000000..04b4b1bfff
--- /dev/null
+++ b/layout/reftests/svg/smil/restart/reset-2.svg
@@ -0,0 +1,33 @@
+<!--
+ We want to test that reset behaviour is actually applied when an animation
+ restarts and not before.
+
+ Therefore we build up the following graph:
+
+ |..| |..|
+ 1 2 3 4
+
+ But at t=2.5s we add a begin instance at t=3.9s. This should be cleared when
+ we restart at t=3s and hence the animation should no longer be playing at
+ t=4s.
+ -->
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ class="reftest-wait"
+ onload="addInstanceTimes()">
+ <script type="text/ecmascript"><![CDATA[
+ function addInstanceTimes() {
+ var svg = document.documentElement;
+ svg.pauseAnimations();
+ svg.setCurrentTime(2.5);
+ var anim = document.getElementById('anim');
+ anim.beginElementAt(1.4);
+ setTimeAndSnapshot(4.0, true);
+ }
+ ]]></script>
+ <script xlink:href="../smil-util.js" type="text/javascript"/>
+ <rect width="100" height="100" fill="green">
+ <set attributeName="fill" attributeType="CSS"
+ to="red" begin="1s; 3s" dur="1s" fill="remove" id="anim"/>
+ </rect>
+</svg>
diff --git a/layout/reftests/svg/smil/restart/reset-3.svg b/layout/reftests/svg/smil/restart/reset-3.svg
new file mode 100644
index 0000000000..e4f44b29c0
--- /dev/null
+++ b/layout/reftests/svg/smil/restart/reset-3.svg
@@ -0,0 +1,39 @@
+<!--
+ A variation on reset-2.svg.
+
+ Perhaps surprisingly, restart behaviour only applies for the second interval
+ onwards. This is inconsistent but it's the spec
+ (see http://lists.w3.org/Archives/Public/www-smil/2009OctDec/0004.html)
+
+ In this test we ensure that times are NOT cleared upon starting the first
+ interval.
+
+ Therefore we build up the following graph:
+
+ |..|
+ 1 2
+
+ But at t=0.5s we add a begin instance at t=1.5s. This should NOT be cleared
+ when we start at t=1s and hence the animation should STILL be playing
+ at t=2.0s.
+ -->
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ class="reftest-wait"
+ onload="addInstanceTimes()">
+ <script type="text/ecmascript"><![CDATA[
+ function addInstanceTimes() {
+ var svg = document.documentElement;
+ svg.pauseAnimations();
+ svg.setCurrentTime(0.5);
+ var anim = document.getElementById('anim');
+ anim.beginElementAt(1);
+ setTimeAndSnapshot(2.0, true);
+ }
+ ]]></script>
+ <script xlink:href="../smil-util.js" type="text/javascript"/>
+ <rect width="100" height="100" fill="red">
+ <set attributeName="fill" attributeType="CSS"
+ to="green" begin="1s" dur="1s" fill="remove" id="anim"/>
+ </rect>
+</svg>
diff --git a/layout/reftests/svg/smil/restart/reset-4.svg b/layout/reftests/svg/smil/restart/reset-4.svg
new file mode 100644
index 0000000000..320a8245a4
--- /dev/null
+++ b/layout/reftests/svg/smil/restart/reset-4.svg
@@ -0,0 +1,27 @@
+<!--
+ According to the SMIL pseudocode if no end attribute is specified the end of
+ an interval is just the active end. This, however, effectively makes
+ endElement useless on animations which have no end attribute specified. This
+ seems counter-intuitive, so this test checks that endElement still takes
+ effect on animation without an end attribute.
+ -->
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ class="reftest-wait"
+ onload="addInstanceTimes()">
+ <script type="text/ecmascript"><![CDATA[
+ function addInstanceTimes() {
+ var svg = document.documentElement;
+ svg.pauseAnimations();
+ svg.setCurrentTime(1.0);
+ var anim = document.getElementById('anim');
+ anim.endElementAt(0.5);
+ setTimeAndSnapshot(1.5, true);
+ }
+ ]]></script>
+ <script xlink:href="../smil-util.js" type="text/javascript"/>
+ <rect width="100" height="100" fill="green">
+ <set attributeName="fill" attributeType="CSS"
+ to="red" begin="1s" dur="1s" fill="remove" id="anim"/>
+ </rect>
+</svg>
diff --git a/layout/reftests/svg/smil/restart/reset-6.svg b/layout/reftests/svg/smil/restart/reset-6.svg
new file mode 100644
index 0000000000..a0fe33ae2d
--- /dev/null
+++ b/layout/reftests/svg/smil/restart/reset-6.svg
@@ -0,0 +1,58 @@
+<!--
+ SMIL3 5.4.3, "Resetting element state" has:
+
+ Any instance times associated with past Event-values, Repeat-values,
+ Accesskey-values or added via DOM method calls are removed from the
+ dependent begin and end instance times lists. In effect, all events and DOM
+ methods calls in the past are cleared. This does not apply to an instance
+ time that defines the begin of the current interval.
+
+ In this test we have the following scenario:
+
+ <set begin="1s" end="2s" dur="1s" ... />
+
+ giving us:
+
+ |...|
+ 1 2
+
+ Then at t=1.5s we have the following DOM calls
+
+ anim.beginElementAt(1.5);
+ anim.endElementAt(2);
+
+ potentially giving us:
+
+ |...| | |
+ ^
+ 1 2 3 3.5
+
+ At t=2s we'll go to look for the next interval and construct one from 3s-3.5s.
+ We should apply restart behaviour at t=3s meaning we'll reset instance times
+ generated by DOM calls in the past however we'll keep the begin instance time
+ at 3s since it defines the beginning of the (now) current interval. Sticking
+ to the letter of the spec quoted above however, we'll end up clearing the end
+ instance at 3.5s. Yet in this case we should use the active end (t=4s) since
+ there's no end attribute specified.
+ -->
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ class="reftest-wait"
+ onload="addInstanceTimes()">
+ <script type="text/ecmascript"><![CDATA[
+ function addInstanceTimes() {
+ var svg = document.documentElement;
+ svg.pauseAnimations();
+ svg.setCurrentTime(1.5);
+ var anim = document.getElementById('anim');
+ anim.beginElementAt(1.5);
+ anim.endElementAt(2);
+ setTimeAndSnapshot(3.7, true);
+ }
+ ]]></script>
+ <script xlink:href="../smil-util.js" type="text/javascript"/>
+ <rect width="100" height="100" fill="red">
+ <set attributeName="fill" attributeType="CSS"
+ to="green" begin="1s" dur="1s" fill="remove" id="anim"/>
+ </rect>
+</svg>
diff --git a/layout/reftests/svg/smil/restart/reset-7.svg b/layout/reftests/svg/smil/restart/reset-7.svg
new file mode 100644
index 0000000000..4614b81198
--- /dev/null
+++ b/layout/reftests/svg/smil/restart/reset-7.svg
@@ -0,0 +1,25 @@
+<!--
+ A variation on reset-6.svg but this time since the animation has an end
+ specification the second interval SHOULD be deleted.
+ -->
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ class="reftest-wait"
+ onload="addInstanceTimes()">
+ <script type="text/ecmascript"><![CDATA[
+ function addInstanceTimes() {
+ var svg = document.documentElement;
+ svg.pauseAnimations();
+ svg.setCurrentTime(1.5);
+ var anim = document.getElementById('anim');
+ anim.beginElementAt(1.5);
+ anim.endElementAt(2.5);
+ setTimeAndSnapshot(3.2, true);
+ }
+ ]]></script>
+ <script xlink:href="../smil-util.js" type="text/javascript"/>
+ <rect width="100" height="100" fill="green">
+ <set attributeName="fill" attributeType="CSS"
+ to="red" begin="1s" end="2s" dur="1s" fill="remove" id="anim"/>
+ </rect>
+</svg>