fix: nativeImage.crop().toBitmap() returning garbage (#25757)

This commit is contained in:
Jeremy Rose 2020-10-04 18:15:16 -07:00 committed by GitHub
parent a189dc779e
commit 485adae94c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 7 deletions

View file

@ -468,6 +468,12 @@ describe('nativeImage module', () => {
expect(cropB.getSize()).to.deep.equal({ width: 25, height: 64 });
expect(cropA.toPNG().equals(cropB.toPNG())).to.be.false();
});
it('toBitmap() returns a buffer of the right size', () => {
const image = nativeImage.createFromPath(path.join(__dirname, 'fixtures', 'assets', 'logo.png'));
const crop = image.crop({ width: 25, height: 64, x: 0, y: 0 });
expect(crop.toBitmap().length).to.equal(25 * 64 * 4);
});
});
describe('getAspectRatio()', () => {