mirror of
https://github.com/servo/servo.git
synced 2025-08-13 01:15:34 +01:00
Update web-platform-tests to revision 697b971060b2d475a73c1c3755232a4674d61cf5
This commit is contained in:
parent
f60598909a
commit
b97474fbba
236 changed files with 4817 additions and 893 deletions
|
@ -55,5 +55,19 @@ gTestArguments.forEach(function(args) {
|
|||
}, "Animation can be constructed " + args.description);
|
||||
});
|
||||
|
||||
test(function(t) {
|
||||
var effect = new KeyframeEffectReadOnly(null,
|
||||
{ left: ["10px", "20px"] },
|
||||
{ duration: 10000,
|
||||
fill: "forwards" });
|
||||
var anim = new Animation(effect, document.timeline);
|
||||
anim.pause();
|
||||
assert_equals(effect.getComputedTiming().progress, 0.0);
|
||||
anim.currentTime += 5000;
|
||||
assert_equals(effect.getComputedTiming().progress, 0.5);
|
||||
anim.finish();
|
||||
assert_equals(effect.getComputedTiming().progress, 1.0);
|
||||
}, "Animation constructed by an effect with null target runs normally");
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -96,11 +96,10 @@ promise_test(function(t) {
|
|||
assert_equals(animation.playState, 'finished',
|
||||
'The play state of a paused animation should become ' +
|
||||
'"finished" after finish() is called');
|
||||
assert_approx_equals(animation.startTime,
|
||||
animation.timeline.currentTime - 100 * MS_PER_SEC,
|
||||
0.0001,
|
||||
'The start time of a paused animation should be set ' +
|
||||
'after calling finish()');
|
||||
assert_times_equal(animation.startTime,
|
||||
animation.timeline.currentTime - 100 * MS_PER_SEC,
|
||||
'The start time of a paused animation should be set ' +
|
||||
'after calling finish()');
|
||||
});
|
||||
}, 'Test finish() while paused');
|
||||
|
||||
|
@ -117,11 +116,10 @@ test(function(t) {
|
|||
assert_equals(animation.playState, 'finished',
|
||||
'The play state of a pause-pending animation should become ' +
|
||||
'"finished" after finish() is called');
|
||||
assert_approx_equals(animation.startTime,
|
||||
animation.timeline.currentTime - 100 * MS_PER_SEC / 2,
|
||||
0.0001,
|
||||
'The start time of a pause-pending animation should ' +
|
||||
'be set after calling finish()');
|
||||
assert_times_equal(animation.startTime,
|
||||
animation.timeline.currentTime - 100 * MS_PER_SEC / 2,
|
||||
'The start time of a pause-pending animation should ' +
|
||||
'be set after calling finish()');
|
||||
}, 'Test finish() while pause-pending with positive playbackRate');
|
||||
|
||||
test(function(t) {
|
||||
|
@ -148,11 +146,10 @@ test(function(t) {
|
|||
assert_equals(animation.playState, 'finished',
|
||||
'The play state of a play-pending animation should become ' +
|
||||
'"finished" after finish() is called');
|
||||
assert_approx_equals(animation.startTime,
|
||||
animation.timeline.currentTime - 100 * MS_PER_SEC / 0.5,
|
||||
0.0001,
|
||||
'The start time of a play-pending animation should ' +
|
||||
'be set after calling finish()');
|
||||
assert_times_equal(animation.startTime,
|
||||
animation.timeline.currentTime - 100 * MS_PER_SEC / 0.5,
|
||||
'The start time of a play-pending animation should ' +
|
||||
'be set after calling finish()');
|
||||
}, 'Test finish() while play-pending');
|
||||
|
||||
// FIXME: Add a test for when we are play-pending without an active timeline.
|
||||
|
@ -206,5 +203,45 @@ promise_test(function(t) {
|
|||
'Animation.finish()');
|
||||
});
|
||||
}, 'Test finish() resolves finished promise synchronously');
|
||||
|
||||
promise_test(function(t) {
|
||||
var effect = new KeyframeEffectReadOnly(null, gKeyFrames, 100 * MS_PER_SEC);
|
||||
var animation = new Animation(effect, document.timeline);
|
||||
var resolvedFinished = false;
|
||||
animation.finished.then(function() {
|
||||
resolvedFinished = true;
|
||||
});
|
||||
|
||||
return animation.ready.then(function() {
|
||||
animation.finish();
|
||||
}).then(function() {
|
||||
assert_true(resolvedFinished,
|
||||
'Animation.finished should be resolved soon after ' +
|
||||
'Animation.finish()');
|
||||
});
|
||||
}, 'Test finish() resolves finished promise synchronously with an animation ' +
|
||||
'without a target');
|
||||
|
||||
promise_test(function(t) {
|
||||
var effect = new KeyframeEffectReadOnly(null, gKeyFrames, 100 * MS_PER_SEC);
|
||||
var animation = new Animation(effect, document.timeline);
|
||||
animation.play();
|
||||
|
||||
var resolvedFinished = false;
|
||||
animation.finished.then(function() {
|
||||
resolvedFinished = true;
|
||||
});
|
||||
|
||||
return animation.ready.then(function() {
|
||||
animation.currentTime = animation.effect.getComputedTiming().endTime - 1;
|
||||
return waitForAnimationFrames(2);
|
||||
}).then(function() {
|
||||
assert_true(resolvedFinished,
|
||||
'Animation.finished should be resolved soon after ' +
|
||||
'Animation finishes normally');
|
||||
});
|
||||
}, 'Test normally finished animation resolves finished promise synchronously ' +
|
||||
'with an animation without a target');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Animation.startTime tests</title>
|
||||
<link rel="help"
|
||||
href="https://w3c.github.io/web-animations/#dom-animation-starttime">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../testcommon.js"></script>
|
||||
<link rel="stylesheet" href="/resources/testharness.css">
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
test(function(t) {
|
||||
var animation = new Animation(new KeyframeEffect(createDiv(t), null),
|
||||
document.timeline);
|
||||
assert_equals(animation.startTime, null, 'startTime is unresolved');
|
||||
}, 'startTime of a newly created (idle) animation is unresolved');
|
||||
|
||||
test(function(t) {
|
||||
var animation = new Animation(new KeyframeEffect(createDiv(t), null),
|
||||
document.timeline);
|
||||
animation.play();
|
||||
assert_equals(animation.startTime, null, 'startTime is unresolved');
|
||||
}, 'startTime of a play-pending animation is unresolved');
|
||||
|
||||
test(function(t) {
|
||||
var animation = new Animation(new KeyframeEffect(createDiv(t), null),
|
||||
document.timeline);
|
||||
animation.pause();
|
||||
assert_equals(animation.startTime, null, 'startTime is unresolved');
|
||||
}, 'startTime of a pause-pending animation is unresolved');
|
||||
|
||||
test(function(t) {
|
||||
var animation = createDiv(t).animate(null);
|
||||
assert_equals(animation.startTime, null, 'startTime is unresolved');
|
||||
}, 'startTime of a play-pending animation created using Element.animate'
|
||||
+ ' shortcut is unresolved');
|
||||
|
||||
promise_test(function(t) {
|
||||
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
|
||||
return animation.ready.then(function() {
|
||||
assert_greater_than(animation.startTime, 0, 'startTime when running');
|
||||
});
|
||||
}, 'startTime is resolved when running');
|
||||
|
||||
</script>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue