mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Upgrade to libvips v8.12.0-rc1
This commit is contained in:
BIN
test/fixtures/expected/composite-cutout.png
vendored
BIN
test/fixtures/expected/composite-cutout.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 175 KiB After Width: | Height: | Size: 180 KiB |
BIN
test/fixtures/expected/median_1.jpg
vendored
BIN
test/fixtures/expected/median_1.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
BIN
test/fixtures/expected/median_3.jpg
vendored
BIN
test/fixtures/expected/median_3.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 833 B |
BIN
test/fixtures/expected/median_5.jpg
vendored
BIN
test/fixtures/expected/median_5.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 640 B |
BIN
test/fixtures/expected/median_color.jpg
vendored
BIN
test/fixtures/expected/median_color.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
@@ -247,7 +247,7 @@ describe('composite', () => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(300, 300)
|
||||
.composite([{
|
||||
input: Buffer.from('<svg><rect x="0" y="0" width="200" height="200" rx="50" ry="50"/></svg>'),
|
||||
input: Buffer.from('<svg width="200" height="200"><rect x="0" y="0" width="200" height="200" rx="50" ry="50"/></svg>'),
|
||||
density: 96,
|
||||
blend: 'dest-in',
|
||||
cutout: true
|
||||
|
||||
@@ -5,68 +5,46 @@ const assert = require('assert');
|
||||
const sharp = require('../../');
|
||||
const fixtures = require('../fixtures');
|
||||
|
||||
describe('Median filter', function () {
|
||||
it('1x1 window', function (done) {
|
||||
sharp(fixtures.inputJpgThRandom)
|
||||
describe('Median filter', () => {
|
||||
it('1x1 window', async () => {
|
||||
const [r, g, b] = await sharp(fixtures.inputSvgSmallViewBox)
|
||||
.median(1)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(200, info.width);
|
||||
assert.strictEqual(200, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('median_1.jpg'), data, done);
|
||||
});
|
||||
.raw()
|
||||
.toBuffer();
|
||||
|
||||
assert.deepStrictEqual({ r: 0, g: 0, b: 0 }, { r, g, b });
|
||||
});
|
||||
|
||||
it('3x3 window', function (done) {
|
||||
sharp(fixtures.inputJpgThRandom)
|
||||
it('3x3 window', async () => {
|
||||
const [r, g, b] = await sharp(fixtures.inputSvgSmallViewBox)
|
||||
.median(3)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(200, info.width);
|
||||
assert.strictEqual(200, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('median_3.jpg'), data, done);
|
||||
});
|
||||
});
|
||||
it('5x5 window', function (done) {
|
||||
sharp(fixtures.inputJpgThRandom)
|
||||
.median(5)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(200, info.width);
|
||||
assert.strictEqual(200, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('median_5.jpg'), data, done);
|
||||
});
|
||||
.raw()
|
||||
.toBuffer();
|
||||
|
||||
assert.deepStrictEqual({ r: 255, g: 0, b: 127 }, { r, g, b });
|
||||
});
|
||||
|
||||
it('color image', function (done) {
|
||||
sharp(fixtures.inputJpgRandom)
|
||||
.median(5)
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(200, info.width);
|
||||
assert.strictEqual(200, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('median_color.jpg'), data, done);
|
||||
});
|
||||
it('7x7 window', async () => {
|
||||
const [r, g, b] = await sharp(fixtures.inputSvgSmallViewBox)
|
||||
.median(7)
|
||||
.raw()
|
||||
.toBuffer();
|
||||
|
||||
assert.deepStrictEqual({ r: 255, g: 19, b: 146 }, { r, g, b });
|
||||
});
|
||||
|
||||
it('no windows size', function (done) {
|
||||
sharp(fixtures.inputJpgThRandom)
|
||||
.median()
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(200, info.width);
|
||||
assert.strictEqual(200, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('median_3.jpg'), data, done);
|
||||
});
|
||||
it('default window (3x3)', async () => {
|
||||
const [r, g, b] = await sharp(fixtures.inputSvgSmallViewBox)
|
||||
.median(3)
|
||||
.raw()
|
||||
.toBuffer();
|
||||
|
||||
assert.deepStrictEqual({ r: 255, g: 0, b: 127 }, { r, g, b });
|
||||
});
|
||||
it('invalid radius', function () {
|
||||
assert.throws(function () {
|
||||
sharp(fixtures.inputJpg).median(0.1);
|
||||
|
||||
it('invalid radius', () => {
|
||||
assert.throws(() => {
|
||||
sharp().median(0.1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user