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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/web-animations/keyframe-effect/keyframe-handling.html

Issue 1866333004: Import web-platform-tests@5a8700479d98852455bee6117558897867eb278a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wpt-sync
Patch Set: Add Failure option for two TestExpectations entries Created 4 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <title>Keyframe handling tests</title>
4 <link rel="help" href="https://w3c.github.io/web-animations/#the-effect-value-of -a-keyframe-animation-effect">
5 <link rel="author" title="Brian Birtles" href="mailto:bbirtles@mozilla.com">
6 <script src="../../../../resources/testharness.js"></script>
7 <script src="../../../../resources/testharnessreport.js"></script>
8 <script src="../testcommon.js"></script>
9 <body>
10 <div id="log"></div>
11 <div id="target"></div>
12 <script>
13 'use strict';
14
15 test(function(t) {
16 var div = createDiv(t);
17 var anim = div.animate([ { offset: 0, opacity: 0 },
18 { offset: 0, opacity: 0.1 },
19 { offset: 0, opacity: 0.2 },
20 { offset: 1, opacity: 0.8 },
21 { offset: 1, opacity: 0.9 },
22 { offset: 1, opacity: 1 } ],
23 { duration: 1000,
24 easing: 'cubic-bezier(0.5, -0.5, 0.5, 1.5)' });
25 assert_equals(getComputedStyle(div).opacity, '0.2',
26 'When progress is zero the last keyframe with offset 0 should'
27 + ' be used');
28 // http://cubic-bezier.com/#.5,-0.5,.5,1.5
29 // At t=0.15, the progress should be negative
30 anim.currentTime = 150;
31 assert_equals(getComputedStyle(div).opacity, '0',
32 'When progress is negative, the first keyframe with a 0 offset'
33 + ' should be used');
34 // At t=0.71, the progress should be just less than 1
35 anim.currentTime = 710;
36 assert_approx_equals(parseFloat(getComputedStyle(div).opacity), 0.8, 0.01,
37 'When progress is just less than 1, the first keyframe with an'
38 + ' offset of 1 should be used as the interval endpoint');
39 // At t=0.85, the progress should be > 1
40 anim.currentTime = 850;
41 assert_equals(getComputedStyle(div).opacity, '1',
42 'When progress is greater than 1.0, the last keyframe with a 1'
43 + ' offset should be used');
44 anim.finish();
45 assert_equals(getComputedStyle(div).opacity, '1',
46 'When progress is equal to 1.0, the last keyframe with a 1'
47 + ' offset should be used');
48 }, 'Overlapping keyframes at 0 and 1 use the appropriate value when the'
49 + ' progress is outside the range [0, 1]');
50
51 test(function(t) {
52 var div = createDiv(t);
53 var anim = div.animate([ { offset: 0, opacity: 0 },
54 { offset: 0.5, opacity: 0.3 },
55 { offset: 0.5, opacity: 0.5 },
56 { offset: 0.5, opacity: 0.7 },
57 { offset: 1, opacity: 1 } ], 1000);
58 anim.currentTime = 250;
59 assert_equals(getComputedStyle(div).opacity, '0.15',
60 'Before the overlap point, the first keyframe from the'
61 + ' overlap point should be used as interval endpoint');
62 anim.currentTime = 500;
63 assert_equals(getComputedStyle(div).opacity, '0.7',
64 'At the overlap point, the last keyframe from the'
65 + ' overlap point should be used as interval startpoint');
66 anim.currentTime = 750;
67 assert_equals(getComputedStyle(div).opacity, '0.85',
68 'After the overlap point, the last keyframe from the'
69 + ' overlap point should be used as interval startpoint');
70 }, 'Overlapping keyframes between 0 and 1 use the appropriate value on each'
71 + ' side of the overlap point');
72
73 done();
74 </script>
75 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698