Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@jimp/plugin-normalize/test/normalize.test.js
1126 views
1
import { Jimp, mkJGD } from '@jimp/test-utils';
2
import configure from '@jimp/custom';
3
4
import normalize from '../src';
5
6
const jimp = configure({ plugins: [normalize] }, Jimp);
7
8
describe('Normalize', () => {
9
it('change grayscale image', async () => {
10
const image = await jimp.read(mkJGD('36▦', '6▦9', '▦9C'));
11
12
image
13
.normalize()
14
.getJGDSync()
15
.should.be.sameJGD(mkJGD('■5▦', '5▦A', '▦A□'));
16
});
17
18
it('change red/blue image', async () => {
19
const image = await jimp.read({
20
width: 3,
21
height: 2,
22
data: [
23
0x000000ff,
24
0x400022ff,
25
0x40002200,
26
0x400000ff,
27
0x000022ff,
28
0x800055ff
29
]
30
});
31
32
image
33
.normalize()
34
.getJGDSync()
35
.should.be.sameJGD({
36
width: 3,
37
height: 2,
38
data: [
39
0x000000ff,
40
0x7f0066ff,
41
0x7f006600,
42
0x7f0000ff,
43
0x000066ff,
44
0xff00ffff
45
]
46
});
47
});
48
});
49
50