Add private maxColourDistance for functional tests

Switch MSE-based tests to use it

Remove experimental MSE-based compare API
This commit is contained in:
Lovell Fuller
2015-05-19 17:57:03 +01:00
parent ef8db1eebf
commit 8832ae0bf9
16 changed files with 172 additions and 446 deletions

26
test/unit/fixtures.js Normal file
View File

@@ -0,0 +1,26 @@
'use strict';
var assert = require('assert');
var fixtures = require('../fixtures');
describe('Test fixtures', function() {
describe('assertMaxColourDistance', function() {
it('should throw an Error when images have a different number of channels', function() {
assert.throws(function() {
fixtures.assertMaxColourDistance(fixtures.inputPngOverlayLayer1, fixtures.inputJpg);
});
});
it('should throw an Error when images have different dimensions', function() {
assert.throws(function() {
fixtures.assertMaxColourDistance(fixtures.inputJpg, fixtures.inputJpgWithExif);
});
});
it('should accept a zero threshold when comparing an image to itself', function() {
var image = fixtures.inputPngOverlayLayer0;
fixtures.assertMaxColourDistance(image, image, 0);
});
it('should accept a numeric threshold for two different images', function() {
fixtures.assertMaxColourDistance(fixtures.inputPngOverlayLayer0, fixtures.inputPngOverlayLayer1, 100);
});
});
});