mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
Update web-platform-tests to revision e03a9b1341ae9bdb1e4fa03765257b84d26fe2f1
This commit is contained in:
parent
7d05c76d18
commit
20a833eb75
5167 changed files with 4696 additions and 297370 deletions
|
@ -80,6 +80,13 @@ var gEasingTests = [
|
|||
}
|
||||
];
|
||||
|
||||
const gEasingParsingTests = [
|
||||
['linear', 'linear'],
|
||||
['ease-in-out', 'ease-in-out'],
|
||||
['Ease\\2d in-out', 'ease-in-out'],
|
||||
['ease /**/', 'ease'],
|
||||
];
|
||||
|
||||
const gInvalidEasings = [
|
||||
'',
|
||||
'7',
|
||||
|
@ -87,6 +94,9 @@ const gInvalidEasings = [
|
|||
'initial',
|
||||
'inherit',
|
||||
'unset',
|
||||
'unrecognized',
|
||||
'var(--x)',
|
||||
'ease-in-out, ease-out',
|
||||
'cubic-bezier(1.1, 0, 1, 1)',
|
||||
'cubic-bezier(0, 0, 1.1, 1)',
|
||||
'cubic-bezier(-0.1, 0, 1, 1)',
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
// Common utility methods for testing animation effects
|
||||
|
||||
// Tests the |property| member of |animation's| target effect's computed timing
|
||||
// at the various points indicated by |values|.
|
||||
//
|
||||
// |values| has the format:
|
||||
//
|
||||
// {
|
||||
// before, // value to test during before phase
|
||||
// activeBoundary, // value to test at the very beginning of the active
|
||||
// // phase when playing forwards, or the very end of
|
||||
// // the active phase when playing backwards.
|
||||
// // This should be undefined if the active duration of
|
||||
// // the effect is zero.
|
||||
// after, // value to test during the after phase or undefined if the
|
||||
// // active duration is infinite
|
||||
// }
|
||||
//
|
||||
function assert_computed_timing_for_each_phase(animation, property, values) {
|
||||
const effect = animation.effect;
|
||||
const timing = effect.getComputedTiming();
|
||||
|
||||
// The following calculations are based on the definitions here:
|
||||
// https://w3c.github.io/web-animations/#animation-effect-phases-and-states
|
||||
const beforeActive = Math.max(Math.min(timing.delay, timing.endTime), 0);
|
||||
const activeAfter =
|
||||
Math.max(Math.min(timing.delay + timing.activeDuration, timing.endTime), 0);
|
||||
const direction = animation.playbackRate < 0 ? 'backwards' : 'forwards';
|
||||
|
||||
// Before phase
|
||||
if (direction === 'forwards') {
|
||||
animation.currentTime = beforeActive - 1;
|
||||
} else {
|
||||
animation.currentTime = beforeActive;
|
||||
}
|
||||
assert_equals(effect.getComputedTiming()[property], values.before,
|
||||
`Value of ${property} in the before phase`);
|
||||
|
||||
// Active phase
|
||||
if (effect.getComputedTiming().activeDuration > 0) {
|
||||
if (direction === 'forwards') {
|
||||
animation.currentTime = beforeActive;
|
||||
} else {
|
||||
animation.currentTime = activeAfter;
|
||||
}
|
||||
assert_equals(effect.getComputedTiming()[property], values.activeBoundary,
|
||||
`Value of ${property} at the boundary of the active phase`);
|
||||
} else {
|
||||
assert_equals(values.activeBoundary, undefined,
|
||||
'Test specifies a value to check during the active phase but'
|
||||
+ ' the animation has a zero duration');
|
||||
}
|
||||
|
||||
// After phase
|
||||
if (effect.getComputedTiming().activeDuration !== Infinity) {
|
||||
if (direction === 'forwards') {
|
||||
animation.currentTime = activeAfter;
|
||||
} else {
|
||||
animation.currentTime = activeAfter + 1;
|
||||
}
|
||||
assert_equals(effect.getComputedTiming()[property], values.after,
|
||||
`Value of ${property} in the after phase`);
|
||||
} else {
|
||||
assert_equals(values.after, undefined,
|
||||
'Test specifies a value to check during the after phase but'
|
||||
+ ' the animation has an infinite duration');
|
||||
}
|
||||
}
|
|
@ -28,33 +28,6 @@ function assert_frames_equal(a, b, name) {
|
|||
}
|
||||
}
|
||||
|
||||
// ------------------------------
|
||||
// Easing values
|
||||
// ------------------------------
|
||||
|
||||
// [specified easing value, expected easing value]
|
||||
var gEasingValueTests = [
|
||||
["linear", "linear"],
|
||||
["ease-in-out", "ease-in-out"],
|
||||
["Ease\\2d in-out", "ease-in-out"],
|
||||
["ease /**/", "ease"],
|
||||
];
|
||||
|
||||
var gInvalidEasingInKeyframeSequenceTests = [
|
||||
{ desc: "a blank easing",
|
||||
input: [{ easing: "" }] },
|
||||
{ desc: "an unrecognized easing",
|
||||
input: [{ easing: "unrecognized" }] },
|
||||
{ desc: "an 'initial' easing",
|
||||
input: [{ easing: "initial" }] },
|
||||
{ desc: "an 'inherit' easing",
|
||||
input: [{ easing: "inherit" }] },
|
||||
{ desc: "a variable easing",
|
||||
input: [{ easing: "var(--x)" }] },
|
||||
{ desc: "a multi-value easing",
|
||||
input: [{ easing: "ease-in-out, ease-out" }] }
|
||||
];
|
||||
|
||||
// ------------------------------
|
||||
// Composite values
|
||||
// ------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue