refactor: createThumbnailFromPath
takes size
not maxSize
(#37362)
refactor: createThumbnailFromPath takes size not maxSize
This commit is contained in:
parent
f33bf2a271
commit
8ee58e18fd
5 changed files with 72 additions and 12 deletions
|
@ -447,6 +447,30 @@ describe('nativeImage module', () => {
|
|||
const result = await nativeImage.createThumbnailFromPath(goodPath, goodSize);
|
||||
expect(result.isEmpty()).to.equal(false);
|
||||
});
|
||||
|
||||
it('returns the correct size if larger than the initial image', async () => {
|
||||
// capybara.png is a 128x128 image.
|
||||
const imgPath = path.join(fixturesPath, 'assets', 'capybara.png');
|
||||
const size = { width: 256, height: 256 };
|
||||
const result = await nativeImage.createThumbnailFromPath(imgPath, size);
|
||||
expect(result.getSize()).to.deep.equal(size);
|
||||
});
|
||||
|
||||
it('returns the correct size if is the same as the initial image', async () => {
|
||||
// capybara.png is a 128x128 image.
|
||||
const imgPath = path.join(fixturesPath, 'assets', 'capybara.png');
|
||||
const size = { width: 128, height: 128 };
|
||||
const result = await nativeImage.createThumbnailFromPath(imgPath, size);
|
||||
expect(result.getSize()).to.deep.equal(size);
|
||||
});
|
||||
|
||||
it('returns the correct size if smaller than the initial image', async () => {
|
||||
// capybara.png is a 128x128 image.
|
||||
const imgPath = path.join(fixturesPath, 'assets', 'capybara.png');
|
||||
const maxSize = { width: 64, height: 64 };
|
||||
const result = await nativeImage.createThumbnailFromPath(imgPath, maxSize);
|
||||
expect(result.getSize()).to.deep.equal(maxSize);
|
||||
});
|
||||
});
|
||||
|
||||
describe('addRepresentation()', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue