mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure auto-rotation works with shrink-on-load #3352
Fixes regression in 0.31.0
This commit is contained in:
@@ -300,7 +300,7 @@ describe('Partial image extraction', function () {
|
||||
const s = sharp();
|
||||
s.on('warning', function (msg) { warningMessage = msg; });
|
||||
const options = { top: 0, left: 0, width: 1, height: 1 };
|
||||
s.extract(options);
|
||||
s.extract(options).extract(options);
|
||||
assert.strictEqual(warningMessage, '');
|
||||
s.extract(options);
|
||||
assert.strictEqual(warningMessage, 'ignoring previous extract options');
|
||||
@@ -311,7 +311,7 @@ describe('Partial image extraction', function () {
|
||||
const s = sharp().rotate();
|
||||
s.on('warning', function (msg) { warningMessage = msg; });
|
||||
const options = { top: 0, left: 0, width: 1, height: 1 };
|
||||
s.extract(options);
|
||||
s.extract(options).extract(options);
|
||||
assert.strictEqual(warningMessage, '');
|
||||
s.extract(options);
|
||||
assert.strictEqual(warningMessage, 'ignoring previous extract options');
|
||||
|
||||
@@ -406,4 +406,16 @@ describe('Rotation', function () {
|
||||
fixtures.assertSimilar(fixtures.expected('rotate-and-flop.jpg'), data, done);
|
||||
});
|
||||
});
|
||||
|
||||
it('Auto-rotate and shrink-on-load', async () => {
|
||||
const [r, g, b] = await sharp(fixtures.inputJpgWithLandscapeExif3)
|
||||
.rotate()
|
||||
.resize(8)
|
||||
.raw()
|
||||
.toBuffer();
|
||||
|
||||
assert.strictEqual(r, 60);
|
||||
assert.strictEqual(g, 73);
|
||||
assert.strictEqual(b, 52);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user