Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444

This commit is contained in:
Josh Matthews 2017-04-17 12:06:02 +10:00 committed by Anthony Ramine
parent 25e8bf69e6
commit 665817d2a6
35333 changed files with 1818077 additions and 16036 deletions

View file

@ -72,6 +72,15 @@ test(function(t) {
+ ' whose AnimationEffectTiming object is created in the relevant realm'
+ ' of the target element');
gEmptyKeyframeListTests.forEach(function(subTest) {
test(function(t) {
var div = createDiv(t);
var anim = div.animate(subTest, 2000);
assert_not_equals(anim, null);
}, 'Element.animate() accepts empty keyframe lists ' +
`(input: ${JSON.stringify(subTest)})`);
});
gPropertyIndexedKeyframesTests.forEach(function(subtest) {
test(function(t) {
var div = createDiv(t);

View file

@ -19,5 +19,24 @@ test(function(t) {
assert_equals(anim.effect, newEffect, "new effect is set");
}, "effect is set correctly.");
test(function(t) {
var div = createDiv(t);
var animation = div.animate({ left: ['100px', '100px'] },
{ fill: 'forwards' });
var effect = animation.effect;
assert_equals(getComputedStyle(div).left, '100px',
'animation is initially having an effect');
animation.effect = null;
assert_equals(getComputedStyle(div).left, 'auto',
'animation no longer has an effect');
animation.effect = effect;
assert_equals(getComputedStyle(div).left, '100px',
'animation has an effect again');
}, 'Clearing and setting Animation.effect should update the computed style'
+ ' of the target element');
</script>
</body>

View file

@ -0,0 +1,51 @@
<!doctype html>
<meta charset=utf-8>
<title>Animation interface automated IDL tests</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
<script src="../../testcommon.js"></script>
<div id="log"></div>
<script type="text/plain" id="Animation-IDL">
enum AnimationPlayState { "idle", "pending", "running", "paused", "finished" };
[Constructor (optional AnimationEffectReadOnly? effect = null,
optional AnimationTimeline? timeline)]
interface Animation : EventTarget {
attribute DOMString id;
attribute AnimationEffectReadOnly? effect;
attribute AnimationTimeline? timeline;
attribute double? startTime;
attribute double? currentTime;
attribute double playbackRate;
readonly attribute AnimationPlayState playState;
readonly attribute Promise<Animation> ready;
readonly attribute Promise<Animation> finished;
attribute EventHandler onfinish;
attribute EventHandler oncancel;
void cancel ();
void finish ();
void play ();
void pause ();
void reverse ();
};
</script>
<script>
'use strict';
test(function(t) {
const idlArray = new IdlArray();
idlArray.add_untested_idls('interface AnimationTimeline {};');
idlArray.add_untested_idls('interface EventHandler {};');
idlArray.add_untested_idls('interface EventTarget {};');
idlArray.add_idls(
document.getElementById('Animation-IDL').textContent);
// const animation = createDiv(t).animate(null);
idlArray.add_objects( { Animation: ['new Animation()'] } );
idlArray.test();
});
</script>

View file

@ -12,7 +12,7 @@
promise_test(function(t) {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var animation = div.animate(null, 100 * MS_PER_SEC);
var originalReadyPromise = animation.ready;
var pauseReadyPromise;
@ -35,7 +35,7 @@ promise_test(function(t) {
promise_test(function(t) {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var animation = div.animate(null, 100 * MS_PER_SEC);
return animation.ready.then(function() {
var promiseBeforeCallingPlay = animation.ready;
@ -48,7 +48,7 @@ promise_test(function(t) {
promise_test(function(t) {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var animation = div.animate(null, 100 * MS_PER_SEC);
return animation.ready.then(function(resolvedAnimation) {
assert_equals(resolvedAnimation, animation,
@ -57,40 +57,5 @@ promise_test(function(t) {
});
}, 'The ready promise is fulfilled with its Animation');
promise_test(function(t) {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var retPromise = animation.ready.then(function() {
assert_unreached('ready promise was fulfilled');
}).catch(function(err) {
assert_equals(err.name, 'AbortError',
'ready promise is rejected with AbortError');
});
animation.cancel();
return retPromise;
}, 'ready promise is rejected when a play-pending animation is cancelled by'
+ ' calling cancel()');
promise_test(function(t) {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
return animation.ready.then(function() {
animation.pause();
// Set up listeners on pause-pending ready promise
var retPromise = animation.ready.then(function() {
assert_unreached('ready promise was fulfilled');
}).catch(function(err) {
assert_equals(err.name, 'AbortError',
'ready promise is rejected with AbortError');
});
animation.cancel();
return retPromise;
});
}, 'ready promise is rejected when a pause-pending animation is cancelled by'
+ ' calling cancel()');
</script>
</body>

View file

@ -148,6 +148,25 @@ test(function(t) {
});
}, 'set duration string 100');
promise_test(function(t) {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
return anim.ready.then(function() {
var originalStartTime = anim.startTime;
var originalCurrentTime = anim.currentTime;
assert_equals(anim.effect.getComputedTiming().duration, 100 * MS_PER_SEC,
'Initial duration should be as set on KeyframeEffect');
anim.effect.timing.duration = 200 * MS_PER_SEC;
assert_equals(anim.effect.getComputedTiming().duration, 200 * MS_PER_SEC,
'Effect duration should have been updated');
assert_times_equal(anim.startTime, originalStartTime,
'startTime should be unaffected by changing effect ' +
'duration');
assert_times_equal(anim.currentTime, originalCurrentTime,
'currentTime should be unaffected by changing effect ' +
'duration');
});
}, 'Extending an effect\'s duration does not change the start or current time');
</script>
</body>

View file

@ -56,6 +56,14 @@ gInvalidEasings.forEach(function(invalidEasing) {
}, 'Invalid effect easing value test: \'' + invalidEasing + '\'');
});
gRoundtripEasings.forEach(easing => {
test(function(t) {
const anim = createDiv(t).animate(null);
anim.effect.timing.easing = easing;
assert_equals(anim.effect.timing.easing, easing);
}, `Canonical easing '${easing}' is returned as set`);
});
test(function(t) {
var delay = 1000 * MS_PER_SEC;

View file

@ -56,4 +56,23 @@ promise_test(function(t) {
}));
}, 'document.timeline.currentTime liveness tests');
async_test(function(t) {
var startTime = document.timeline.currentTime;
var firstRafTime;
requestAnimationFrame(function() {
t.step(function() {
assert_greater_than_equal(document.timeline.currentTime, startTime, 'currentTime should have progressed');
firstRafTime = document.timeline.currentTime;
});
});
requestAnimationFrame(function() {
t.step(function() {
assert_equals(document.timeline.currentTime, firstRafTime, 'currentTime should be the same');
});
t.done();
});
}, 'document.timeline.currentTime time should be the same for all RAF callbacks in a frame');
</script>