Path: blob/master/node_modules/@jimp/plugin-normalize/test/normalize.test.js
1126 views
import { Jimp, mkJGD } from '@jimp/test-utils';1import configure from '@jimp/custom';23import normalize from '../src';45const jimp = configure({ plugins: [normalize] }, Jimp);67describe('Normalize', () => {8it('change grayscale image', async () => {9const image = await jimp.read(mkJGD('36▦', '6▦9', '▦9C'));1011image12.normalize()13.getJGDSync()14.should.be.sameJGD(mkJGD('■5▦', '5▦A', '▦A□'));15});1617it('change red/blue image', async () => {18const image = await jimp.read({19width: 3,20height: 2,21data: [220x000000ff,230x400022ff,240x40002200,250x400000ff,260x000022ff,270x800055ff28]29});3031image32.normalize()33.getJGDSync()34.should.be.sameJGD({35width: 3,36height: 2,37data: [380x000000ff,390x7f0066ff,400x7f006600,410x7f0000ff,420x000066ff,430xff00ffff44]45});46});47});484950