Add spec for 1x1 PNG data URL

This commit is contained in:
Kevin Sawicki 2017-03-06 13:22:55 -08:00
parent b46e48cae1
commit 8eaf48e552
2 changed files with 5 additions and 0 deletions

View file

@ -80,6 +80,11 @@ describe('nativeImage module', () => {
}) })
describe('toDataURL()', () => { describe('toDataURL()', () => {
it('returns a PNG data URL', () => {
const imageA = nativeImage.createFromPath(path.join(__dirname, 'fixtures', 'assets', '1x1.png'))
assert.equal(imageA.toDataURL(), 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYlWNgAAIAAAUAAdafFs0AAAAASUVORK5CYII=')
})
it('returns a data URL at 1x scale factor', () => { it('returns a data URL at 1x scale factor', () => {
const imageA = nativeImage.createFromPath(path.join(__dirname, 'fixtures', 'assets', 'logo.png')) const imageA = nativeImage.createFromPath(path.join(__dirname, 'fixtures', 'assets', 'logo.png'))
const imageB = nativeImage.createFromBuffer(imageA.toPNG(), { const imageB = nativeImage.createFromBuffer(imageA.toPNG(), {

BIN
spec/fixtures/assets/1x1.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B