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
--- 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)'
+ },
+];