WIP - add extractor, generate snippet_data

This commit is contained in:
Stefan Fejes
2019-08-20 15:52:05 +02:00
parent 88084d3d30
commit cc8f1d8a7a
37396 changed files with 4588842 additions and 133 deletions

BIN
node_modules/pixelmatch/test/fixtures/1a.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
node_modules/pixelmatch/test/fixtures/1b.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
node_modules/pixelmatch/test/fixtures/1diff.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
node_modules/pixelmatch/test/fixtures/2a.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
node_modules/pixelmatch/test/fixtures/2b.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
node_modules/pixelmatch/test/fixtures/2diff.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
node_modules/pixelmatch/test/fixtures/3a.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
node_modules/pixelmatch/test/fixtures/3b.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
node_modules/pixelmatch/test/fixtures/3diff.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
node_modules/pixelmatch/test/fixtures/4a.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

BIN
node_modules/pixelmatch/test/fixtures/4b.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

BIN
node_modules/pixelmatch/test/fixtures/4diff.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

47
node_modules/pixelmatch/test/test.js generated vendored Normal file
View File

@ -0,0 +1,47 @@
'use strict';
var PNG = require('pngjs').PNG,
fs = require('fs'),
test = require('tap').test,
path = require('path'),
match = require('../.');
diffTest('1a', '1b', '1diff', 0.05, false, 143);
diffTest('2a', '2b', '2diff', 0.05, false, 12439);
diffTest('3a', '3b', '3diff', 0.05, false, 212);
diffTest('4a', '4b', '4diff', 0.05, false, 36089);
function diffTest(imgPath1, imgPath2, diffPath, threshold, includeAA, expectedMismatch) {
var name = 'comparing ' + imgPath1 + ' to ' + imgPath2 +
', threshold: ' + threshold + ', includeAA: ' + includeAA;
test(name, function (t) {
var img1 = readImage(imgPath1, function () {
var img2 = readImage(imgPath2, function () {
var expectedDiff = readImage(diffPath, function () {
var diff = new PNG({width: img1.width, height: img1.height});
var mismatch = match(img1.data, img2.data, diff.data, diff.width, diff.height, {
threshold: threshold,
includeAA: includeAA
});
var mismatch2 = match(img1.data, img2.data, null, diff.width, diff.height, {
threshold: threshold,
includeAA: includeAA
});
t.same(diff.data, expectedDiff.data, 'diff image');
t.same(mismatch, expectedMismatch, 'number of mismatched pixels');
t.same(mismatch, mismatch2, 'number of mismatched pixels');
t.end();
});
});
});
});
}
function readImage(name, done) {
return fs.createReadStream(path.join(__dirname, '/fixtures/' + name + '.png')).pipe(new PNG()).on('parsed', done);
}