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.
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
// Copyright 2013 Lovell Fuller and others.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
const sharp = require('../../');
|
|
const fixtures = require('../fixtures');
|
|
|
|
describe('Unflatten', function () {
|
|
it('unflatten white background', function (done) {
|
|
sharp(fixtures.inputPng).unflatten()
|
|
.toBuffer(function (err, data) {
|
|
if (err) throw err;
|
|
fixtures.assertSimilar(fixtures.expected('unflatten-white-transparent.png'), data, { threshold: 0 }, done);
|
|
});
|
|
});
|
|
it('unflatten transparent image', function (done) {
|
|
sharp(fixtures.inputPngTrimSpecificColourIncludeAlpha).unflatten()
|
|
.toBuffer(function (err, data) {
|
|
if (err) throw err;
|
|
fixtures.assertSimilar(fixtures.expected('unflatten-flag-white-transparent.png'), data, { threshold: 0 }, done);
|
|
});
|
|
});
|
|
it('unflatten using threshold', function (done) {
|
|
sharp(fixtures.inputPngPalette).unflatten().threshold(128, { grayscale: false })
|
|
.toBuffer(function (err, data) {
|
|
if (err) throw err;
|
|
fixtures.assertSimilar(fixtures.expected('unflatten-swiss.png'), data, { threshold: 1 }, done);
|
|
});
|
|
});
|
|
});
|