Ensure op ordering is respected where possible #3319

Emit warnings when previous ops might be ignored
Flip and flop now occur before rotate, if any
This commit is contained in:
Lovell Fuller
2022-08-18 13:57:13 +01:00
parent e547eaa180
commit 212a6e7519
13 changed files with 168 additions and 50 deletions

View File

@@ -791,4 +791,14 @@ describe('Resize dimensions', function () {
sharp().resize(null, null, { position: 'unknown' });
});
});
it('Multiple resize emits warning', () => {
let warningMessage = '';
const s = sharp();
s.on('warning', function (msg) { warningMessage = msg; });
s.resize(1);
assert.strictEqual(warningMessage, '');
s.resize(2);
assert.strictEqual(warningMessage, 'ignoring previous resize options');
});
});