Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@jimp/plugin-shadow/test/shadow.test.js
1126 views
1
import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils';
2
import configure from '@jimp/custom';
3
import resize from '@jimp/plugin-resize';
4
import blur from '@jimp/plugin-blur';
5
6
import shadow from '../src';
7
8
const jimp = configure({ plugins: [shadow, resize, blur] }, Jimp);
9
10
describe('Shadow', () => {
11
it('creates a shadow', async () => {
12
const expectedImg = await jimp.read(
13
getTestDir(__dirname) + '/images/shadow.png'
14
);
15
const testImage = await jimp.read(
16
mkJGD(
17
' ',
18
' ◆◆ ',
19
' ◆▦▦◆ ',
20
' ◆▦▦▦▦◆ ',
21
' ◆▦▦◆ ',
22
' ◆◆ ',
23
' '
24
)
25
);
26
27
testImage
28
.shadow({ x: -1, y: 1, blur: 1 })
29
.bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
30
});
31
});
32
33