Browse Source

Add tests for ignore: 'antialiasing' [#137]

pull/154/head
Kamil Bielawski 6 years ago
parent
commit
3500491577
  1. BIN
      nodejs-tests/assets/isAntialiased/diffOff.png
  2. BIN
      nodejs-tests/assets/isAntialiased/diffOn.png
  3. BIN
      nodejs-tests/assets/text.png
  4. BIN
      nodejs-tests/assets/textAa.png
  5. 50
      nodejs-tests/ignore.test.js

BIN
nodejs-tests/assets/isAntialiased/diffOff.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
nodejs-tests/assets/isAntialiased/diffOn.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
nodejs-tests/assets/text.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
nodejs-tests/assets/textAa.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

50
nodejs-tests/ignore.test.js

@ -0,0 +1,50 @@
/* eslint-env jest*/
const resemble = require('../resemble');
const fs = require('fs');
describe('ignore', () => {
test('ignore antialiasing on', async () => {
const text = fs.readFileSync('./nodejs-tests/assets/text.png');
const textAa = fs.readFileSync('./nodejs-tests/assets/textAa.png');
return new Promise(resolve => {
const opts = { ignore: 'antialiasing' };
resemble.compare(text, textAa, opts, (_x, data) => {
expect(data.misMatchPercentage).toBe('0.00');
const buffer = data.getBuffer();
expect(buffer).toBeInstanceOf(Buffer);
const comparison = fs.readFileSync(
'./nodejs-tests/assets/isAntialiased/diffOn.png'
);
expect(buffer.equals(comparison)).toBe(true);
resolve();
});
});
});
test('ignore antialiasing off', async () => {
const text = fs.readFileSync('./nodejs-tests/assets/text.png');
const textAa = fs.readFileSync('./nodejs-tests/assets/textAa.png');
return new Promise(resolve => {
resemble.compare(text, textAa, {}, (_x, data) => {
expect(data.misMatchPercentage).toBe('5.19');
const buffer = data.getBuffer();
expect(buffer).toBeInstanceOf(Buffer);
const comparison = fs.readFileSync(
'./nodejs-tests/assets/isAntialiased/diffOff.png'
);
expect(buffer.equals(comparison)).toBe(true);
resolve();
});
});
});
});
Loading…
Cancel
Save