Allow rotate before pre-resize extraction #145

This commit is contained in:
Lovell Fuller
2015-01-04 19:29:37 +00:00
parent a190ae6b08
commit 5dab3c8482
5 changed files with 57 additions and 14 deletions

View File

@@ -92,4 +92,28 @@ describe('Partial image extraction', function() {
});
});
it('Extract then rotate', function(done) {
sharp(fixtures.inputJpg)
.extract(10, 10, 100, 100)
.rotate(90)
.toFile(fixtures.path('output.extract.extract-then-rotate.jpg'), function(err, info) {
if (err) throw err;
assert.strictEqual(100, info.width);
assert.strictEqual(100, info.height);
done();
});
});
it('Rotate then extract', function(done) {
sharp(fixtures.inputJpg)
.rotate(90)
.extract(10, 10, 100, 100)
.toFile(fixtures.path('output.extract.rotate-then-extract.jpg'), function(err, info) {
if (err) throw err;
assert.strictEqual(100, info.width);
assert.strictEqual(100, info.height);
done();
});
});
});