This commit is contained in:
Raul Ochoa 2016-02-22 16:41:55 +01:00
parent 495fdaf8ec
commit 2393a611a8

View File

@ -25,11 +25,9 @@ assert.imageBufferIsSimilarToFile = function(buffer, referenceImageRelativeFileP
callback = callback || function(err) { assert.ifError(err); }; callback = callback || function(err) { assert.ifError(err); };
var referenceImageFilePath = path.resolve(referenceImageRelativeFilePath); var referenceImageFilePath = path.resolve(referenceImageRelativeFilePath);
var referenceImageBuffer = fs.readFileSync(referenceImageFilePath, { encoding: null });
var testImage = mapnik.Image.fromBytes(Buffer.isBuffer(buffer) ? buffer : new Buffer(buffer, 'binary')); assert.imageBuffersAreSimilar(buffer, referenceImageBuffer, tolerance, callback);
var referenceImage = mapnik.Image.fromBytes(fs.readFileSync(referenceImageFilePath, { encoding: null }));
imagesAreSimilar(testImage, referenceImage, tolerance, callback);
}; };
assert.imageBuffersAreSimilar = function(bufferA, bufferB, tolerance, callback) { assert.imageBuffersAreSimilar = function(bufferA, bufferB, tolerance, callback) {