Files
SnapOtter/tests/unit/api/apng.test.ts
T
SnapOtterandGitHub cb5db59f77 feat(tools): remove background from animated GIFs (WebP, APNG) (#502)
Adds a dedicated remove-gif-background AI tool: removes the background from an animated GIF, WebP, or APNG frame by frame and reassembles a transparent (or composited) animation in WebP, APNG, or GIF, with full per-frame effects. Reuses the background-removal bundle. Verified end-to-end with the real rembg model.

Closes #496.
2026-07-11 19:53:00 +08:00

18 lines
638 B
TypeScript

import { describe, expect, it } from "vitest";
import { apngFrameCount } from "../../../apps/api/src/lib/apng.js";
import { fixtures, readFixture } from "../../fixtures/index.js";
describe("apngFrameCount", () => {
it("returns null for a non-PNG buffer", () => {
expect(apngFrameCount(Buffer.from("GIF89a-not-a-png-file"))).toBeNull();
});
it("returns 1 for a still PNG (no acTL)", () => {
expect(apngFrameCount(readFixture(fixtures.image.base.png200))).toBe(1);
});
it("returns the frame count for a multi-frame APNG", () => {
expect(apngFrameCount(readFixture(fixtures.image.animated.apng))).toBe(4);
});
});