This repository has been archived on 2022-03-12. You can view files and clone it, but cannot push or open issues or pull requests.
2021-04-02 02:24:13 +03:00

32 lines
828 B
JavaScript

import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils';
import configure from '@jimp/custom';
import resize from '@jimp/plugin-resize';
import blur from '@jimp/plugin-blur';
import shadow from '../src';
const jimp = configure({ plugins: [shadow, resize, blur] }, Jimp);
describe('Shadow', () => {
it('creates a shadow', async () => {
const expectedImg = await jimp.read(
getTestDir(__dirname) + '/images/shadow.png'
);
const testImage = await jimp.read(
mkJGD(
' ',
' ◆◆ ',
' ◆▦▦◆ ',
' ◆▦▦▦▦◆ ',
' ◆▦▦◆ ',
' ◆◆ ',
' '
)
);
testImage
.shadow({ x: -1, y: 1, blur: 1 })
.bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
});
});