Changelog/doc/test updates for various new operations

Dependency version bumps
This commit is contained in:
Lovell Fuller
2016-07-11 15:52:30 +01:00
parent e10aeb29eb
commit ff8c42e894
5 changed files with 117 additions and 148 deletions

View File

@@ -6,46 +6,34 @@ var sharp = require('../../index');
describe('Bandbool per-channel boolean operations', function() {
it('\'and\' Operation', function(done) {
sharp(fixtures.inputPngBooleanNoAlpha)
.bandbool('and')
.toBuffer(function(err, data, info) {
if (err) throw err;
assert.strictEqual(200, info.width);
assert.strictEqual(200, info.height);
assert.strictEqual(1, info.channels);
fixtures.assertSimilar(fixtures.expected('bandbool_and_result.png'), data, done);
});
});
it('\'or\' Operation', function(done) {
sharp(fixtures.inputPngBooleanNoAlpha)
.bandbool(sharp.bool.or)
.toBuffer(function(err, data, info) {
if (err) throw err;
assert.strictEqual(200, info.width);
assert.strictEqual(200, info.height);
assert.strictEqual(1, info.channels);
fixtures.assertSimilar(fixtures.expected('bandbool_or_result.png'), data, done);
});
});
it('\'eor\' Operation', function(done) {
sharp(fixtures.inputPngBooleanNoAlpha)
.bandbool('eor')
.toBuffer(function(err, data, info) {
if (err) throw err;
assert.strictEqual(200, info.width);
assert.strictEqual(200, info.height);
assert.strictEqual(1, info.channels);
fixtures.assertSimilar(fixtures.expected('bandbool_eor_result.png'), data, done);
});
[
sharp.bool.and,
sharp.bool.or,
sharp.bool.eor
]
.forEach(function(op) {
it(op + ' operation', function(done) {
sharp(fixtures.inputPngBooleanNoAlpha)
.bandbool(op)
.toBuffer(function(err, data, info) {
if (err) throw err;
assert.strictEqual(200, info.width);
assert.strictEqual(200, info.height);
assert.strictEqual(1, info.channels);
fixtures.assertSimilar(fixtures.expected('bandbool_' + op + '_result.png'), data, done);
});
});
});
it('Invalid operation', function() {
assert.throws(function() {
sharp(fixtures.inputPngBooleanNoAlpha)
.bandbool('fail');
sharp().bandbool('fail');
});
});
it('Missing operation', function() {
assert.throws(function() {
sharp().bandbool();
});
});
});