@quake2ts/test-utils 0.0.853 → 0.0.854

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4599,6 +4599,22 @@ async function expectAnimationSnapshot(renderAndCaptureFrame, options) {
4599
4599
  shouldUpdateBaseline = true;
4600
4600
  }
4601
4601
  }
4602
+ if (actualFrames.length > 1) {
4603
+ const firstFrame = actualFrames[0];
4604
+ const lastFrame = actualFrames[actualFrames.length - 1];
4605
+ let differentPixels = 0;
4606
+ for (let i = 0; i < firstFrame.length; i += 4) {
4607
+ if (firstFrame[i] !== lastFrame[i] || firstFrame[i + 1] !== lastFrame[i + 1] || firstFrame[i + 2] !== lastFrame[i + 2]) {
4608
+ differentPixels++;
4609
+ }
4610
+ }
4611
+ const percentDiff = differentPixels / (width * height) * 100;
4612
+ if (percentDiff < 0.1) {
4613
+ console.warn(`WARNING: Animation '${name}' has minimal changes (${percentDiff.toFixed(2)}% pixels different). First and last frames are nearly identical - animation may not be working!`);
4614
+ } else {
4615
+ console.log(`Animation '${name}': ${percentDiff.toFixed(2)}% of pixels changed from first to last frame`);
4616
+ }
4617
+ }
4602
4618
  if (shouldUpdateBaseline) {
4603
4619
  console.log(`Creating/Updating baseline for ${name} at ${baselinePath}`);
4604
4620
  await saveAPNG(baselinePath, actualFrames, width, height, delayMs);