D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
etb1lp46s9ed
/
washeet.softurecs.com
/
node_modules
/
@jimp
/
plugin-circle
/
src
/
Filename :
index.test.ts
back
Copy
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("Circle", () => { test("makes a circle based on image height and width", () => { const imgSrc = Jimp.fromBitmap( makeTestImage( "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", ), ); expect(imgSrc.circle()).toMatchSnapshot(); }); test("makes a circle using provided radius", () => { const imgSrc = Jimp.fromBitmap( makeTestImage( "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", ), ); expect(imgSrc.circle({ radius: 3 })).toMatchSnapshot(); }); test("should ", () => { const imgSrc = Jimp.fromBitmap( makeTestImage( "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", ), ); expect(imgSrc.circle({ radius: 5, x: 5, y: 5 })).toMatchSnapshot(); }); });