mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Allow floating point density input (#1362)
Metadata output will still remain integer
This commit is contained in:
committed by
Lovell Fuller
parent
bf3254cb16
commit
7d48a5ccf4
BIN
test/fixtures/expected/svg14.4.png
vendored
Normal file
BIN
test/fixtures/expected/svg14.4.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 340 B |
@@ -939,6 +939,21 @@ describe('Input/output', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Convert SVG to PNG at 14.4DPI', function (done) {
|
||||
sharp(fixtures.inputSvg, { density: 14.4 })
|
||||
.toFormat('png')
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(20, info.width);
|
||||
assert.strictEqual(20, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('svg14.4.png'), data, function (err) {
|
||||
if (err) throw err;
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Convert SVG with embedded images to PNG, respecting dimensions, autoconvert to PNG', function (done) {
|
||||
sharp(fixtures.inputSvgWithEmbeddedImages)
|
||||
.toBuffer(function (err, data, info) {
|
||||
@@ -1506,11 +1521,6 @@ describe('Input/output', function () {
|
||||
sharp(null, { density: 'zoinks' });
|
||||
});
|
||||
});
|
||||
it('Invalid density: float', function () {
|
||||
assert.throws(function () {
|
||||
sharp(null, { density: 0.5 });
|
||||
});
|
||||
});
|
||||
it('Ignore unknown attribute', function () {
|
||||
sharp(null, { unknown: true });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user