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

Side by Side Diff: LayoutTests/web-animations-api/element-animate-list-of-keyframes.html

Issue 251463003: Web Animations API: Sort keyframes by offset (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: move Keyframe::compareOffsets out of KeyframeEffectModel.cpp Created 6 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 4
5 <style> 5 <style>
6 .anim { 6 .anim {
7 position: absolute; 7 position: absolute;
8 left: 10px; 8 left: 10px;
9 height: 90px; 9 height: 90px;
10 width: 100px; 10 width: 100px;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 test(function() { 43 test(function() {
44 var player = e2.animate([ 44 var player = e2.animate([
45 {backgroundColor: 'green', offset: 0}, 45 {backgroundColor: 'green', offset: 0},
46 {backgroundColor: 'purple', offset: 1} 46 {backgroundColor: 'purple', offset: 1}
47 ], durationValue); 47 ], durationValue);
48 player.pause(); 48 player.pause();
49 player.currentTime = durationValue / 2; 49 player.currentTime = durationValue / 2;
50 assert_equals(e2Style.backgroundColor, 'rgb(64, 64, 64)'); 50 assert_equals(e2Style.backgroundColor, 'rgb(64, 64, 64)');
51 }, 'Calling animate() should start an animation. CamelCase property names should be parsed.'); 51 }, 'Calling animate() should start an animation. CamelCase property names should be parsed.');
52 52
53 test(function() {
54 var player = e1.animate([
55 {opacity: '0.75', offset: 0.5},
56 {opacity: '0.9', offset: 1},
57 {opacity: '1', offset: 0}
58 ], durationValue);
59 player.pause();
60 player.currentTime = durationValue / 4;
61 assert_equals(e1Style.opacity, '0.875');
alancutter (OOO until 2018) 2014/04/28 10:53:46 It's not very easy to tell that this is the correc
Eric Willigers 2014/04/29 00:14:49 Done.
62 }, 'Keyframes with offsets should become sorted by offset.');
63
64 test(function() {
65 var keyframes = [
66 {opacity: '0.75'},
67 {opacity: '0.9', offset: 1},
68 {opacity: '1', offset: 0}
69 ];
70 assert_throws('InvalidModificationError', function() { e1.animate(keyframes, durationValue); });
71 }, 'Should throw when keyframes are not loosely sorted and any have no offset.') ;
72
53 var keyframesWithInvalid = [ 73 var keyframesWithInvalid = [
54 {width: '0px', backgroundColor: 'octarine', offset: 0}, 74 {width: '0px', backgroundColor: 'octarine', offset: 0},
55 {width: '1000px', foo: 'bar', offset: 1}]; 75 {width: '1000px', foo: 'bar', offset: 1}];
56 76
57 test(function() { 77 test(function() {
58 var player = e3.animate(keyframesWithInvalid, {duration: durationValue, fill : 'forwards'}); 78 var player = e3.animate(keyframesWithInvalid, {duration: durationValue, fill : 'forwards'});
59 player.pause(); 79 player.pause();
60 player.currentTime = durationValue; 80 player.currentTime = durationValue;
61 assert_equals(e3Style.width, '1000px'); 81 assert_equals(e3Style.width, '1000px');
62 assert_equals(e3Style.backgroundColor, 'rgb(0, 0, 0)'); 82 assert_equals(e3Style.backgroundColor, 'rgb(0, 0, 0)');
63 assert_equals(e3Style.foo, undefined); 83 assert_equals(e3Style.foo, undefined);
64 }, 'Calling animate() with a pre-constructed keyframes list should start an anim ation. Invalid style declarations should be ignored.'); 84 }, 'Calling animate() with a pre-constructed keyframes list should start an anim ation. Invalid style declarations should be ignored.');
65 </script> 85 </script>
OLDNEW
« no previous file with comments | « no previous file | Source/core/animation/EffectInput.cpp » ('j') | Source/core/animation/ElementAnimation.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698