Bug 1278485 - Part 3: Add test cases to check x value of cubic-bezier is in [0, 1] and step numbers of steps function. r=birtles
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Tue, 12 Jul 2016 16:37:28 +0900
changeset 329724 4f7bcfbda34b2c5f4b042abc296a132dc3f53903
parent 329723 21146d7fda467c02ed413cc3b13ce7906e5b94b7
child 329725 23da74f8393fc329339e400c242e7309c81cbeb2
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1278485
milestone50.0a1
Bug 1278485 - Part 3: Add test cases to check x value of cubic-bezier is in [0, 1] and step numbers of steps function. r=birtles MozReview-Commit-ID: DVQF44NMMfp
testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/easing.html
testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/effect-easing.html
testing/web-platform/tests/web-animations/resources/effect-easing-tests.js
--- a/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/easing.html
+++ b/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/easing.html
@@ -34,28 +34,26 @@ gEffectEasingTests.forEach(function(opti
     assert_progress(anim, 0, easing);
     assert_progress(anim, 250 * MS_PER_SEC, easing);
     assert_progress(anim, 500 * MS_PER_SEC, easing);
     assert_progress(anim, 750 * MS_PER_SEC, easing);
     assert_progress(anim, 1000 * MS_PER_SEC, easing);
   }, options.desc);
 });
 
-test(function(t) {
-  var div = createDiv(t);
-  var anim = div.animate({ opacity: [ 0, 1 ] }, 100 * MS_PER_SEC);
-  assert_throws({ name: 'TypeError' },
-                function() {
-                  anim.effect.timing.easing = '';
-                });
-  assert_throws({ name: 'TypeError' },
-                function() {
-                  anim.effect.timing.easing = 'test';
-                });
-}, 'Test invalid easing value');
+gInvalidEasingTests.forEach(function(options) {
+  test(function(t) {
+    var div = createDiv(t);
+    var anim = div.animate({ opacity: [ 0, 1 ] }, 100 * MS_PER_SEC);
+    assert_throws({ name: 'TypeError' },
+                  function() {
+                    anim.effect.timing.easing = options.easing;
+                  });
+  }, 'Invalid effect easing value test: \'' + options.easing + '\'');
+});
 
 test(function(t) {
   var delay = 1000 * MS_PER_SEC;
 
   var target = createDiv(t);
   var anim = target.animate([ { opacity: 0 }, { opacity: 1 } ],
                             { duration: 1000 * MS_PER_SEC,
                               fill: 'both',
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/effect-easing.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/effect-easing.html
@@ -664,10 +664,20 @@ gStepTimingFunctionTests.forEach(functio
         assert_equals(getComputedStyle(target).width,
                       condition.width,
                       'Progress at ' + animation.currentTime + 'ms');
       }
     });
   }, options.description);
 });
 
+gInvalidEasingTests.forEach(function(options) {
+  test(function(t) {
+    var div = createDiv(t);
+    assert_throws({ name: 'TypeError' },
+                  function() {
+                    div.animate({ easing: options.easing }, 100 * MS_PER_SEC);
+                  });
+  }, 'Invalid keyframe easing value: \'' + options.easing + '\'');
+});
+
 </script>
 </body>
--- a/testing/web-platform/tests/web-animations/resources/effect-easing-tests.js
+++ b/testing/web-platform/tests/web-animations/resources/effect-easing-tests.js
@@ -35,8 +35,35 @@ var gEffectEasingTests = [
     easingFunction: cubicBezier(0, 0, 0.58, 1.0)
   },
   {
     desc: 'easing function which produces values greater than 1',
     easing: 'cubic-bezier(0, 1.5, 1, 1.5)',
     easingFunction: cubicBezier(0, 1.5, 1, 1.5)
   }
 ];
+
+var gInvalidEasingTests = [
+  {
+    easing: ''
+  },
+  {
+    easing: 'test'
+  },
+  {
+    easing: 'cubic-bezier(1.1, 0, 1, 1)'
+  },
+  {
+    easing: 'cubic-bezier(0, 0, 1.1, 1)'
+  },
+  {
+    easing: 'cubic-bezier(-0.1, 0, 1, 1)'
+  },
+  {
+    easing: 'cubic-bezier(0, 0, -0.1, 1)'
+  },
+  {
+    easing: 'steps(-1, start)'
+  },
+  {
+    easing: 'steps(0.1, start)'
+  },
+];