mirror of
https://github.com/lovell/sharp.git
synced 2025-12-06 12:01:41 +01:00
Uses the recommended rules apart from complexity/useArrowFunction, which would affect about 1700 lines of code with little benefit right now. This is something that can be addressed over time.
28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
// Copyright 2013 Lovell Fuller and others.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
const assert = require('node:assert');
|
|
const 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 () {
|
|
const 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);
|
|
});
|
|
});
|
|
});
|