mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Update web-platform-tests to revision b7a8b84debb42268ea95a45bdad8f727d1facdf7
This commit is contained in:
parent
ba929208e4
commit
953dbda9a6
215 changed files with 6409 additions and 1644 deletions
|
@ -48,7 +48,7 @@ async function waitForAnimationFrameWithCondition(condition) {
|
|||
do {
|
||||
await new Promise(window.requestAnimationFrame);
|
||||
} while (!condition())
|
||||
};
|
||||
}
|
||||
|
||||
async function waitForDocumentTimelineAdvance() {
|
||||
const timeAtStart = document.timeline.currentTime;
|
||||
|
@ -56,3 +56,10 @@ async function waitForDocumentTimelineAdvance() {
|
|||
await new Promise(window.requestAnimationFrame);
|
||||
} while (timeAtStart === document.timeline.currentTime)
|
||||
}
|
||||
|
||||
// Wait until animation's effect has a non-null localTime.
|
||||
async function waitForNotNullLocalTime(animation) {
|
||||
await waitForAnimationFrameWithCondition(_ => {
|
||||
return animation.effect.getComputedTiming().localTime !== null;
|
||||
});
|
||||
}
|
|
@ -50,110 +50,98 @@ function setupAndRegisterTests() {
|
|||
}
|
||||
|
||||
async function effect_with_fill_mode_forwards(t) {
|
||||
const effect_with_fill_forwards = new KeyframeEffect(
|
||||
target,
|
||||
{ opacity: [0.5, 0] },
|
||||
{ duration: 1000, fill: 'forwards' });
|
||||
const animation = new WorkletAnimation(
|
||||
'constant_time',
|
||||
effect_with_fill_forwards);
|
||||
animation.play();
|
||||
const effect_with_fill_forwards = new KeyframeEffect(
|
||||
target,
|
||||
{ opacity: [0.5, 0] },
|
||||
{ duration: 1000, fill: 'forwards' });
|
||||
const animation = new WorkletAnimation(
|
||||
'constant_time',
|
||||
effect_with_fill_forwards);
|
||||
animation.play();
|
||||
await waitForNotNullLocalTime(animation);
|
||||
|
||||
await waitForAsyncAnimationFrames(1);
|
||||
await waitForNextFrame();
|
||||
assert_equals(getComputedStyle(target).opacity, '0');
|
||||
|
||||
assert_equals(getComputedStyle(target).opacity, '0');
|
||||
|
||||
animation.cancel();
|
||||
animation.cancel();
|
||||
}
|
||||
|
||||
async function effect_without_fill_mode_forwards(t) {
|
||||
const effect_without_fill_forwards = new KeyframeEffect(
|
||||
target,
|
||||
{ opacity: [0.5, 0] },
|
||||
{ duration: 1000 });
|
||||
const animation = new WorkletAnimation(
|
||||
'constant_time',
|
||||
effect_without_fill_forwards);
|
||||
animation.play();
|
||||
const effect_without_fill_forwards = new KeyframeEffect(
|
||||
target,
|
||||
{ opacity: [0.5, 0] },
|
||||
{ duration: 1000 });
|
||||
const animation = new WorkletAnimation(
|
||||
'constant_time',
|
||||
effect_without_fill_forwards);
|
||||
animation.play();
|
||||
await waitForNotNullLocalTime(animation);
|
||||
|
||||
await waitForAsyncAnimationFrames(1);
|
||||
await waitForNextFrame();
|
||||
assert_equals(getComputedStyle(target).opacity, '1');
|
||||
|
||||
assert_equals(getComputedStyle(target).opacity, '1');
|
||||
|
||||
animation.cancel();
|
||||
animation.cancel();
|
||||
}
|
||||
|
||||
async function effect_without_fill_forwards_at_end(t) {
|
||||
const effect_without_fill_forwards_at_end = new KeyframeEffect(
|
||||
target,
|
||||
{ opacity: [0.5, 0] },
|
||||
{ duration: 2000 });
|
||||
const animation = new WorkletAnimation(
|
||||
'constant_time',
|
||||
effect_without_fill_forwards_at_end);
|
||||
animation.play();
|
||||
const effect_without_fill_forwards_at_end = new KeyframeEffect(
|
||||
target,
|
||||
{ opacity: [0.5, 0] },
|
||||
{ duration: 2000 });
|
||||
const animation = new WorkletAnimation(
|
||||
'constant_time',
|
||||
effect_without_fill_forwards_at_end);
|
||||
animation.play();
|
||||
await waitForNotNullLocalTime(animation);
|
||||
|
||||
await waitForAsyncAnimationFrames(1);
|
||||
await waitForNextFrame();
|
||||
assert_equals(getComputedStyle(target).opacity, '1');
|
||||
|
||||
assert_equals(getComputedStyle(target).opacity, '1');
|
||||
|
||||
animation.cancel();
|
||||
animation.cancel();
|
||||
}
|
||||
|
||||
async function effect_with_fill_backwards(t) {
|
||||
const effect_with_fill_backwards = new KeyframeEffect(
|
||||
target,
|
||||
{ opacity: [0.5, 0] },
|
||||
{ duration: 1000, delay: 2001, fill: 'backwards' });
|
||||
const animation = new WorkletAnimation(
|
||||
'constant_time',
|
||||
effect_with_fill_backwards);
|
||||
animation.play();
|
||||
const effect_with_fill_backwards = new KeyframeEffect(
|
||||
target,
|
||||
{ opacity: [0.5, 0] },
|
||||
{ duration: 1000, delay: 2001, fill: 'backwards' });
|
||||
const animation = new WorkletAnimation(
|
||||
'constant_time',
|
||||
effect_with_fill_backwards);
|
||||
animation.play();
|
||||
await waitForNotNullLocalTime(animation);
|
||||
|
||||
await waitForAsyncAnimationFrames(1);
|
||||
await waitForNextFrame();
|
||||
assert_equals(getComputedStyle(target).opacity, '0.5');
|
||||
|
||||
assert_equals(getComputedStyle(target).opacity, '0.5');
|
||||
|
||||
animation.cancel();
|
||||
animation.cancel();
|
||||
}
|
||||
|
||||
async function effect_without_fill_backwards(t) {
|
||||
const effect_without_fill_backwards = new KeyframeEffect(
|
||||
target,
|
||||
{ opacity: [0.5, 0] },
|
||||
{ duration: 1000, delay: 2001 });
|
||||
const animation = new WorkletAnimation(
|
||||
'constant_time',
|
||||
effect_without_fill_backwards);
|
||||
animation.play();
|
||||
const effect_without_fill_backwards = new KeyframeEffect(
|
||||
target,
|
||||
{ opacity: [0.5, 0] },
|
||||
{ duration: 1000, delay: 2001 });
|
||||
const animation = new WorkletAnimation(
|
||||
'constant_time',
|
||||
effect_without_fill_backwards);
|
||||
animation.play();
|
||||
waitForNotNullLocalTime(animation);
|
||||
|
||||
await waitForAsyncAnimationFrames(1);
|
||||
await waitForNextFrame();
|
||||
assert_equals(getComputedStyle(target).opacity, '1');
|
||||
|
||||
assert_equals(getComputedStyle(target).opacity, '1');
|
||||
|
||||
animation.cancel();
|
||||
animation.cancel();
|
||||
}
|
||||
|
||||
async function effect_without_fill_backwards_at_start(t) {
|
||||
const effect_without_fill_backwards_at_start = new KeyframeEffect(
|
||||
target,
|
||||
{ opacity: [0.5, 0] },
|
||||
{ duration: 1000, delay: 2000 });
|
||||
const animation = new WorkletAnimation(
|
||||
'constant_time',
|
||||
effect_without_fill_backwards_at_start);
|
||||
animation.play();
|
||||
const effect_without_fill_backwards_at_start = new KeyframeEffect(
|
||||
target,
|
||||
{ opacity: [0.5, 0] },
|
||||
{ duration: 1000, delay: 2000 });
|
||||
const animation = new WorkletAnimation(
|
||||
'constant_time',
|
||||
effect_without_fill_backwards_at_start);
|
||||
animation.play();
|
||||
await waitForNotNullLocalTime(animation);
|
||||
|
||||
await waitForAsyncAnimationFrames(1);
|
||||
await waitForNextFrame();
|
||||
assert_equals(getComputedStyle(target).opacity, '0.5');
|
||||
|
||||
assert_equals(getComputedStyle(target).opacity, '0.5');
|
||||
|
||||
animation.cancel();
|
||||
animation.cancel();
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue