Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: LayoutTests/web-animations-api/w3c/ignored-keyframes.html

Issue 253963002: Web Animations API: Add layout tests for element.animate() keyframes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added comment Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/web-animations-api/w3c/ignored-keyframes.html
diff --git a/LayoutTests/web-animations-api/w3c/ignored-keyframes.html b/LayoutTests/web-animations-api/w3c/ignored-keyframes.html
new file mode 100644
index 0000000000000000000000000000000000000000..fbc92bcac4350c3c1615701af0747514496de493
--- /dev/null
+++ b/LayoutTests/web-animations-api/w3c/ignored-keyframes.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="resources/keyframes-test.js"></script>
+<script>
+var keyframeA = {opacity: '0', left: '0px'};
+var keyframeB = {opacity: '0.5', left: '50px'};
+
+function createBadOffsetKeyframe(offset) {
+ return {opacity: '1', left: '100px', offset: offset};
+}
+
+// The interpolation expectations will always be the same because we always
+// put keyframeA before keyframeB and bad offset keyframes will be ignored.
+var expectations = {
+ 0: {opacity: '0', left: '0px'},
+ 0.25: {opacity: '0.125', left: '12.5px'},
+ 0.5: {opacity: '0.25', left: '25px'},
+ 0.75: {opacity: '0.375', left: '37.5px'},
+ 1: {opacity: '0.5', left: '50px'},
+};
+
+function testBadOffsetvalues(badOffsets) {
+ badOffsets.forEach(function (badOffset) {
+ var badOffsetKeyframe = createBadOffsetKeyframe(badOffset);
+ var keyframeCases = {
+ 'case A': [
+ badOffsetKeyframe,
+ keyframeA,
+ keyframeB,
+ ],
+ 'case B': [
+ keyframeA,
+ badOffsetKeyframe,
+ keyframeB,
+ ],
+ 'case C': [
+ keyframeA,
+ keyframeB,
+ badOffsetKeyframe,
+ ],
+ 'case D': [
+ badOffsetKeyframe,
+ keyframeA,
+ badOffsetKeyframe,
+ keyframeB,
+ badOffsetKeyframe,
+ ],
+ };
+ for (var caseLabel in keyframeCases) {
+ assertAnimationStyles(keyframeCases[caseLabel], expectations, caseLabel);
+ }
+ });
+}
+
+test(function() {
+ testBadOffsetvalues(['garbage', NaN, undefined, {non: 'number'}]);
+},
+'element.animate() with keyframes that have non-numeric offset values',
+{
+ help: 'http://dev.w3.org/fxtf/web-animations/#the-keyframe-dictionary',
+ assert: [
+ 'element.animate() should start an animation when keyframes have non-numeric offset values.',
+ 'Keyframes with non-numeric offsets should be ignored as input.',
+ ],
+ author: 'Alan Cutter',
+});
+
+test(function() {
+ testBadOffsetvalues([-0.1, -Math.PI, -1, Math.PI, 400, 2200]);
+},
+'element.animate() with keyframes that have offset values beyond the range [0, 1]',
+{
+ help: 'http://dev.w3.org/fxtf/web-animations/#the-keyframe-dictionary',
+ assert: [
+ 'element.animate() should start an animation when keyframes have offset values beyond the range [0, 1].',
+ 'Keyframes with offsets beyond the range [0, 1] should be ignored as input.',
+ ],
+ author: 'Alan Cutter',
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698