Spaces:
Sleeping
Sleeping
File size: 1,101 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | import { expect, test, describe } from "vitest";
import { makeTestImage } from "@jimp/test-utils";
import { createJimp } from "@jimp/core";
import { methods } from "./index.js";
const Jimp = createJimp({ plugins: [methods] });
describe("Fisheye", () => {
test("should create fisheye lens to image", () => {
const img = Jimp.fromBitmap(
makeTestImage(
"0000000000",
"0001221000",
"0022222200",
"0122112210",
"0221001220",
"0221001220",
"0122112210",
"0022222200",
"0001221000",
"0000000000",
),
);
expect(img.fisheye()).toMatchSnapshot();
});
test("should create fisheye lens to image with radius", async () => {
const imgNormal = Jimp.fromBitmap(
makeTestImage(
"0000000000",
"0000000000",
"0000000000",
"0000000000",
"0001111000",
"0001111000",
"0000000000",
"0000000000",
"0000000000",
"0000000000",
),
);
expect(imgNormal.fisheye({ radius: 1.8 })).toMatchSnapshot();
});
});
|