Ensure ops without multi-page support reject (#3010)

This commit is contained in:
Lovell Fuller
2021-12-12 09:14:26 +00:00
committed by GitHub
parent 5bb6702717
commit 9755629cfd
5 changed files with 81 additions and 1 deletions

View File

@@ -347,6 +347,18 @@ describe('Resize fit=cover', function () {
fixtures.assertSimilar(fixtures.expected('crop-strategy.png'), data, done);
});
});
it('Animated image rejects', () =>
assert.rejects(() => sharp(fixtures.inputGifAnimated, { animated: true })
.resize({
width: 100,
height: 8,
position: sharp.strategy.entropy
})
.toBuffer(),
/Resize strategy is not supported for multi-page images/
)
);
});
describe('Attention strategy', function () {
@@ -403,5 +415,17 @@ describe('Resize fit=cover', function () {
fixtures.assertSimilar(fixtures.expected('crop-strategy.png'), data, done);
});
});
it('Animated image rejects', () =>
assert.rejects(() => sharp(fixtures.inputGifAnimated, { animated: true })
.resize({
width: 100,
height: 8,
position: sharp.strategy.attention
})
.toBuffer(),
/Resize strategy is not supported for multi-page images/
)
);
});
});