Fix embedding onto transparent backgrounds #366

Fully automate embed tests to prevent regression
This commit is contained in:
Lovell Fuller
2016-02-25 18:35:56 +00:00
parent 62e04f7784
commit df33c3024a
7 changed files with 26 additions and 32 deletions

View File

@@ -60,14 +60,11 @@ describe('Alpha transparency', function() {
it('Do not flatten', function(done) {
sharp(fixtures.inputPngWithTransparency)
.flatten(false)
.toBuffer(function(err, data) {
.toBuffer(function(err, data, info) {
if (err) throw err;
sharp(data).metadata(function(err, metadata) {
if (err) throw err;
assert.strictEqual('png', metadata.format);
assert.strictEqual(4, metadata.channels);
done();
});
assert.strictEqual('png', info.format);
assert.strictEqual(4, info.channels);
done();
});
});
@@ -75,14 +72,11 @@ describe('Alpha transparency', function() {
sharp(fixtures.inputJpg)
.background('#ff0000')
.flatten()
.toBuffer(function(err, data) {
.toBuffer(function(err, data, info) {
if (err) throw err;
sharp(data).metadata(function(err, metadata) {
if (err) throw err;
assert.strictEqual('jpeg', metadata.format);
assert.strictEqual(3, metadata.channels);
done();
});
assert.strictEqual('jpeg', info.format);
assert.strictEqual(3, info.channels);
done();
});
});