additional tests for createFromBuffer
This commit is contained in:
parent
a609e52a14
commit
7ceb8d1ab8
2 changed files with 14 additions and 1 deletions
|
@ -149,7 +149,8 @@ console.log(image)
|
|||
Returns `NativeImage`
|
||||
|
||||
Creates a new `NativeImage` instance from `buffer`. The default `scaleFactor` is
|
||||
1.0. The `width` and `height` options are **required** for bitmap buffers.
|
||||
1.0. The `width` and `height` options are **required** and only used for bitmap
|
||||
buffers.
|
||||
|
||||
### `nativeImage.createFromDataURL(dataURL)`
|
||||
|
||||
|
|
|
@ -29,6 +29,18 @@ describe('nativeImage module', () => {
|
|||
const imageD = nativeImage.createFromBuffer(imageA.toBitmap(),
|
||||
{width: 538, height: 190})
|
||||
assert.deepEqual(imageD.getSize(), {width: 538, height: 190})
|
||||
|
||||
const imageE = nativeImage.createFromBuffer(imageA.toBitmap(),
|
||||
{width: 100, height: 200})
|
||||
assert.deepEqual(imageE.getSize(), {width: 100, height: 200})
|
||||
|
||||
const imageF = nativeImage.createFromBuffer(imageA.toPNG(),
|
||||
{width: 100, height: 200})
|
||||
assert.deepEqual(imageF.getSize(), {width: 538, height: 190})
|
||||
|
||||
const imageG = nativeImage.createFromBuffer(imageA.toJPEG(100),
|
||||
{width: 100, height: 200})
|
||||
assert.deepEqual(imageG.getSize(), {width: 538, height: 190})
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue