fix: NativeImage.getScaleFactors returns correct scales (#25832)
* fix: NativeImage.getScaleFactors returns correct scales * fix tests
This commit is contained in:
parent
9cd882f1fa
commit
cbe751d349
3 changed files with 25 additions and 12 deletions
|
@ -539,23 +539,32 @@ describe('nativeImage module', () => {
|
|||
buffer: nativeImage.createFromPath(imageDataOne.path).toPNG()
|
||||
});
|
||||
|
||||
expect(image.getScaleFactors()).to.deep.equal([1]);
|
||||
|
||||
const imageDataTwo = getImage({ width: 2, height: 2 });
|
||||
image.addRepresentation({
|
||||
scaleFactor: 2.0,
|
||||
buffer: nativeImage.createFromPath(imageDataTwo.path).toPNG()
|
||||
});
|
||||
|
||||
expect(image.getScaleFactors()).to.deep.equal([1, 2]);
|
||||
|
||||
const imageDataThree = getImage({ width: 3, height: 3 });
|
||||
image.addRepresentation({
|
||||
scaleFactor: 3.0,
|
||||
buffer: nativeImage.createFromPath(imageDataThree.path).toPNG()
|
||||
});
|
||||
|
||||
expect(image.getScaleFactors()).to.deep.equal([1, 2, 3]);
|
||||
|
||||
image.addRepresentation({
|
||||
scaleFactor: 4.0,
|
||||
buffer: 'invalid'
|
||||
});
|
||||
|
||||
// this one failed, so it shouldn't show up in the scale factors
|
||||
expect(image.getScaleFactors()).to.deep.equal([1, 2, 3]);
|
||||
|
||||
expect(image.isEmpty()).to.be.false();
|
||||
expect(image.getSize()).to.deep.equal({ width: 1, height: 1 });
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue