shadow.test.js 828 B

12345678910111213141516171819202122232425262728293031
  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. import shadow from '../src';
  6. const jimp = configure({ plugins: [shadow, resize, blur] }, Jimp);
  7. describe('Shadow', () => {
  8. it('creates a shadow', async () => {
  9. const expectedImg = await jimp.read(
  10. getTestDir(__dirname) + '/images/shadow.png'
  11. );
  12. const testImage = await jimp.read(
  13. mkJGD(
  14. ' ',
  15. ' ◆◆ ',
  16. ' ◆▦▦◆ ',
  17. ' ◆▦▦▦▦◆ ',
  18. ' ◆▦▦◆ ',
  19. ' ◆◆ ',
  20. ' '
  21. )
  22. );
  23. testImage
  24. .shadow({ x: -1, y: 1, blur: 1 })
  25. .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
  26. });
  27. });