Spaces:
Sleeping
Sleeping
File size: 1,032 Bytes
3530df7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import { expect, test, describe } from "vitest";
import "@jimp/test-utils/image-snapshot";
import { createJimp } from "@jimp/core";
import png from "./index.js";
const jimp = createJimp({ formats: [png] });
describe("PNG", () => {
test("should use png options", async () => {
const testImage = jimp.fromBitmap({
width: 20,
height: 20,
data: [
0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff,
0xff00ffff, 0x8000ffff, 0x0000ffff, 0xff0000ff, 0xff0080ff, 0xff00ffff,
0xff0080ff, 0xff00ffff, 0x8000ffff, 0xff00ffff, 0x8000ffff, 0x0000ffff,
0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff,
0xff00ffff, 0x8000ffff, 0x0000ffff, 0xff0000ff, 0xff0080ff, 0xff00ffff,
0xff0080ff, 0xff00ffff, 0x8000ffff, 0xff00ffff, 0x8000ffff, 0x0000ffff,
],
});
const image = await testImage.getBuffer("image/png", {
deflateStrategy: 0,
colorType: 0,
});
expect(image).toMatchImageSnapshot();
});
});
|