From cdc2ff489ed9fa58c9aac1e7a0e3d1a705366810 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Fri, 30 Oct 2026 09:56:40 -0700 Subject: [PATCH] animations: allow WebKit's microsecond duration rounding in the confetti timing test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/vs/base/test/browser/ui/animations/animations.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/base/test/browser/ui/animations/animations.test.ts b/src/vs/base/test/browser/ui/animations/animations.test.ts index c5d0606e6124eb..2c899a173fb6aa 100644 --- a/src/vs/base/test/browser/ui/animations/animations.test.ts +++ b/src/vs/base/test/browser/ui/animations/animations.test.ts @@ -49,13 +49,15 @@ suite('Animations', () => { const effect = particle.getAnimations()[0]?.effect as KeyframeEffect | undefined; const duration = effect?.getTiming().duration; const keyframes = effect?.getKeyframes(); + // WebKit reports the duration rounded to whole microseconds, while the offsets were computed from the + // unrounded duration, so a 40ms step can read as up to 0.001ms longer. return typeof duration === 'number' && duration >= 1150 && duration < 1510 && keyframes !== undefined && keyframes.length >= 30 && keyframes.every((keyframe, index) => - keyframe.easing === 'steps(1)' && (index === 0 || (keyframe.computedOffset - keyframes[index - 1].computedOffset) * duration <= 40 + 1e-10)); + keyframe.easing === 'steps(1)' && (index === 0 || (keyframe.computedOffset - keyframes[index - 1].computedOffset) * duration <= 40 + 1e-3)); }), allParticlesHaveShortFalls: particles.every(particle => { const keyframes = (particle.getAnimations()[0]?.effect as KeyframeEffect | undefined)?.getKeyframes() ?? [];