Bug 1244591 - Part 3: Add web-platform tests for KeyframeEffect.setFrames r=birtles
authorRyo Kato <ryo_kato@hashedhyphen.com>
Sat, 16 Apr 2016 23:39:51 +0900
changeset 332330 d2dc79c8d77cd1a0fe01ad01b07a0d026397a440
parent 332329 4f2cae28821142346e72b97f09aae288f75571c2
child 332331 3558dbf6f998834768f57c7c5c57a6472923a3a8
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1244591, 1216843, 1216844
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1244591 - Part 3: Add web-platform tests for KeyframeEffect.setFrames r=birtles Some tests are expected to fail until Bug 1216843 and 1216844 are resolved, so that we specify that on the meta file `setFrames.html.ini`. MozReview-Commit-ID: 6z2P1KkGJhb
testing/web-platform/meta/MANIFEST.json
testing/web-platform/meta/web-animations/keyframe-effect/setFrames.html.ini
testing/web-platform/tests/web-animations/keyframe-effect/setFrames.html
testing/web-platform/tests/web-animations/resources/keyframe-utils.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -28869,16 +28869,20 @@
         "path": "web-animations/keyframe-effect/getComputedTiming.html",
         "url": "/web-animations/keyframe-effect/getComputedTiming.html"
       },
       {
         "path": "web-animations/keyframe-effect/keyframe-handling.html",
         "url": "/web-animations/keyframe-effect/keyframe-handling.html"
       },
       {
+        "path": "web-animations/keyframe-effect/setFrames.html",
+        "url": "/web-animations/keyframe-effect/setFrames.html"
+      },
+      {
         "path": "webaudio/the-audio-api/the-audiobuffer-interface/idl-test.html",
         "url": "/webaudio/the-audio-api/the-audiobuffer-interface/idl-test.html"
       },
       {
         "path": "webaudio/the-audio-api/the-audiodestinationnode-interface/idl-test.html",
         "url": "/webaudio/the-audio-api/the-audiodestinationnode-interface/idl-test.html"
       },
       {
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/web-animations/keyframe-effect/setFrames.html.ini
@@ -0,0 +1,29 @@
+[setFrames.html]
+  type: testharness
+  [Keyframes can be replaced with a one property one value property-indexed keyframes specification]
+    expected: FAIL
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1216844
+
+  [Keyframes can be replaced with a one property one non-array value property-indexed keyframes specification]
+    expected: FAIL
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1216844
+
+  [Keyframes can be replaced with a one property two value property-indexed keyframes specification where the first value is invalid]
+    expected: FAIL
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1216844
+
+  [Keyframes can be replaced with a one property two value property-indexed keyframes specification where the second value is invalid]
+    expected: FAIL
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1216844
+
+  [Keyframes can be replaced with a two property property-indexed keyframes specification where one property is missing from the first keyframe]
+    expected: FAIL
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1216844
+
+  [Keyframes can be replaced with a two property property-indexed keyframes specification where one property is missing from the last keyframe]
+    expected: FAIL
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1216844
+
+  [Keyframes can be replaced with a keyframe sequence with different composite values, but the same composite value for a given offset]
+    expected: FAIL
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1216843
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/web-animations/keyframe-effect/setFrames.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>KeyframeEffect setFrames() tests</title>
+<link rel="help" href="https://w3c.github.io/web-animations/#dom-keyframeeffect-setframes">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+<script src="../resources/keyframe-utils.js"></script>
+<body>
+<div id="log"></div>
+<div id="target"></div>
+<script>
+'use strict';
+
+var target = document.getElementById('target');
+
+test(function(t) {
+  gEmptyKeyframeListTests.forEach(function(frame) {
+    var effect = new KeyframeEffect(target, {});
+    effect.setFrames(frame);
+    assert_frame_lists_equal(effect.getFrames(), []);
+  });
+}, 'Keyframes can be replaced with an empty keyframe');
+
+gPropertyIndexedKeyframesTests.forEach(function(subtest) {
+  test(function(t) {
+    var effect = new KeyframeEffect(target, {});
+    effect.setFrames(subtest.input);
+    assert_frame_lists_equal(effect.getFrames(), subtest.output);
+  }, 'Keyframes can be replaced with ' + subtest.desc);
+});
+
+gKeyframeSequenceTests.forEach(function(subtest) {
+  test(function(t) {
+    var effect = new KeyframeEffect(target, {});
+    effect.setFrames(subtest.input);
+    assert_frame_lists_equal(effect.getFrames(), subtest.output);
+  }, 'Keyframes can be replaced with ' + subtest.desc);
+});
+
+gInvalidKeyframesTests.forEach(function(subtest) {
+  test(function(t) {
+    var effect = new KeyframeEffect(target, {});
+    assert_throws(subtest.expected, function() {
+      effect.setFrames(subtest.input);
+    });
+  }, "Invalid KeyframeEffect option by " + subtest.desc);
+});
+</script>
+</body>
--- a/testing/web-platform/tests/web-animations/resources/keyframe-utils.js
+++ b/testing/web-platform/tests/web-animations/resources/keyframe-utils.js
@@ -394,16 +394,45 @@ var gKeyframeSequenceTests = [
              { offset: 1, border: "3px dashed rgb(7, 8, 9)" }],
     output: [{ offset: 0, computedOffset: 0, easing: "linear",
                border: "2px dotted rgb(4, 5, 6)",
                borderLeft: "1px solid rgb(1, 2, 3)" },
              { offset: 1, computedOffset: 1, easing: "linear",
                border: "3px dashed rgb(7, 8, 9)" }] },
 ];
 
+var gInvalidKeyframesTests = [
+  { desc:     "keyframes with an out-of-bounded positive offset",
+    input:    [ { opacity: 0 },
+                { opacity: 0.5, offset: 2 },
+                { opacity: 1 } ],
+    expected: { name: "TypeError" } },
+  { desc:     "keyframes with an out-of-bounded negative offset",
+    input:    [ { opacity: 0 },
+                { opacity: 0.5, offset: -1 },
+                { opacity: 1 } ],
+    expected: { name: "TypeError" } },
+  { desc:     "keyframes not loosely sorted by offset",
+    input:    [ { opacity: 0, offset: 1 },
+                { opacity: 1, offset: 0 } ],
+    expected: { name: "TypeError" } },
+  { desc:     "property-indexed keyframes with an invalid easing value",
+    input:    { opacity: [ 0, 0.5, 1 ],
+                easing: "inherit" },
+    expected: { name: "TypeError" } },
+  { desc:     "a keyframe sequence with an invalid easing value",
+    input:    [ { opacity: 0, easing: "jumpy" },
+                { opacity: 1 } ],
+    expected: { name: "TypeError" } },
+  { desc:     "keyframes with an invalid composite value",
+    input:    [ { opacity: 0, composite: "alternate" },
+                { opacity: 1 } ],
+    expected: { name: "TypeError" } }
+];
+
 // ------------------------------
 //  KeyframeEffectOptions
 // ------------------------------
 
 var gKeyframeEffectOptionTests = [
   { desc:     "an empty KeyframeEffectOptions object",
     input:    { },
     expected: { } },