1 import { expect } from 'chai';
2 import { nativeImage } from 'electron/common';
3 import { ifdescribe, ifit } from './lib/spec-helpers';
4 import * as path from 'node:path';
6 describe('nativeImage module', () => {
7 const fixturesPath = path.join(__dirname, 'fixtures');
10 path: path.join(fixturesPath, 'assets', 'logo.png'),
15 dataUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYlWNgAAIAAAUAAdafFs0AAAAASUVORK5CYII=',
16 path: path.join(fixturesPath, 'assets', '1x1.png'),
21 dataUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAAFklEQVQYlWP8//8/AwMDEwMDAwMDAwAkBgMBBMzldwAAAABJRU5ErkJggg==',
22 path: path.join(fixturesPath, 'assets', '2x2.jpg'),
27 dataUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAYAAABWKLW/AAAADElEQVQYlWNgIAoAAAAnAAGZWEMnAAAAAElFTkSuQmCC',
28 path: path.join(fixturesPath, 'assets', '3x3.png'),
33 const dataUrlImages = [
39 ifdescribe(process.platform === 'darwin')('isMacTemplateImage state', () => {
40 describe('with properties', () => {
41 it('correctly recognizes a template image', () => {
42 const image = nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'logo.png'));
43 expect(image.isMacTemplateImage).to.be.false();
45 const templateImage = nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'logo_Template.png'));
46 expect(templateImage.isMacTemplateImage).to.be.true();
49 it('sets a template image', function () {
50 const image = nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'logo.png'));
51 expect(image.isMacTemplateImage).to.be.false();
53 image.isMacTemplateImage = true;
54 expect(image.isMacTemplateImage).to.be.true();
58 describe('with functions', () => {
59 it('correctly recognizes a template image', () => {
60 const image = nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'logo.png'));
61 expect(image.isTemplateImage()).to.be.false();
63 const templateImage = nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'logo_Template.png'));
64 expect(templateImage.isTemplateImage()).to.be.true();
67 it('sets a template image', function () {
68 const image = nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'logo.png'));
69 expect(image.isTemplateImage()).to.be.false();
71 image.setTemplateImage(true);
72 expect(image.isTemplateImage()).to.be.true();
77 describe('createEmpty()', () => {
78 it('returns an empty image', () => {
79 const empty = nativeImage.createEmpty();
80 expect(empty.isEmpty()).to.be.true();
81 expect(empty.getAspectRatio()).to.equal(1);
82 expect(empty.toDataURL()).to.equal('data:image/png;base64,');
83 expect(empty.toDataURL({ scaleFactor: 2.0 })).to.equal('data:image/png;base64,');
84 expect(empty.getSize()).to.deep.equal({ width: 0, height: 0 });
85 expect(empty.getBitmap()).to.be.empty();
86 expect(empty.getBitmap({ scaleFactor: 2.0 })).to.be.empty();
87 expect(empty.toBitmap()).to.be.empty();
88 expect(empty.toBitmap({ scaleFactor: 2.0 })).to.be.empty();
89 expect(empty.toJPEG(100)).to.be.empty();
90 expect(empty.toPNG()).to.be.empty();
91 expect(empty.toPNG({ scaleFactor: 2.0 })).to.be.empty();
93 if (process.platform === 'darwin') {
94 expect(empty.getNativeHandle()).to.be.empty();
99 describe('createFromBitmap(buffer, options)', () => {
100 it('returns an empty image when the buffer is empty', () => {
101 expect(nativeImage.createFromBitmap(Buffer.from([]), { width: 0, height: 0 }).isEmpty()).to.be.true();
104 it('returns an image created from the given buffer', () => {
105 const imageA = nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'logo.png'));
107 const imageB = nativeImage.createFromBitmap(imageA.toBitmap(), imageA.getSize());
108 expect(imageB.getSize()).to.deep.equal({ width: 538, height: 190 });
110 const imageC = nativeImage.createFromBuffer(imageA.toBitmap(), { ...imageA.getSize(), scaleFactor: 2.0 });
111 expect(imageC.getSize()).to.deep.equal({ width: 269, height: 95 });
114 it('throws on invalid arguments', () => {
115 expect(() => nativeImage.createFromBitmap(null as any, {} as any)).to.throw('buffer must be a node Buffer');
116 expect(() => nativeImage.createFromBitmap([12, 14, 124, 12] as any, {} as any)).to.throw('buffer must be a node Buffer');
117 expect(() => nativeImage.createFromBitmap(Buffer.from([]), {} as any)).to.throw('width is required');
118 expect(() => nativeImage.createFromBitmap(Buffer.from([]), { width: 1 } as any)).to.throw('height is required');
119 expect(() => nativeImage.createFromBitmap(Buffer.from([]), { width: 1, height: 1 })).to.throw('invalid buffer size');
123 describe('createFromBuffer(buffer, options)', () => {
124 it('returns an empty image when the buffer is empty', () => {
125 expect(nativeImage.createFromBuffer(Buffer.from([])).isEmpty()).to.be.true();
128 it('returns an empty image when the buffer is too small', () => {
129 const image = nativeImage.createFromBuffer(Buffer.from([1, 2, 3, 4]), { width: 100, height: 100 });
130 expect(image.isEmpty()).to.be.true();
133 it('returns an image created from the given buffer', () => {
134 const imageA = nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'logo.png'));
136 const imageB = nativeImage.createFromBuffer(imageA.toPNG());
137 expect(imageB.getSize()).to.deep.equal({ width: 538, height: 190 });
138 expect(imageA.toBitmap().equals(imageB.toBitmap())).to.be.true();
140 const imageC = nativeImage.createFromBuffer(imageA.toJPEG(100));
141 expect(imageC.getSize()).to.deep.equal({ width: 538, height: 190 });
143 const imageD = nativeImage.createFromBuffer(imageA.toBitmap(),
144 { width: 538, height: 190 });
145 expect(imageD.getSize()).to.deep.equal({ width: 538, height: 190 });
147 const imageE = nativeImage.createFromBuffer(imageA.toBitmap(),
148 { width: 100, height: 200 });
149 expect(imageE.getSize()).to.deep.equal({ width: 100, height: 200 });
151 const imageF = nativeImage.createFromBuffer(imageA.toBitmap());
152 expect(imageF.isEmpty()).to.be.true();
154 const imageG = nativeImage.createFromBuffer(imageA.toPNG(),
155 { width: 100, height: 200 });
156 expect(imageG.getSize()).to.deep.equal({ width: 538, height: 190 });
158 const imageH = nativeImage.createFromBuffer(imageA.toJPEG(100),
159 { width: 100, height: 200 });
160 expect(imageH.getSize()).to.deep.equal({ width: 538, height: 190 });
162 const imageI = nativeImage.createFromBuffer(imageA.toBitmap(),
163 { width: 538, height: 190, scaleFactor: 2.0 });
164 expect(imageI.getSize()).to.deep.equal({ width: 269, height: 95 });
167 it('throws on invalid arguments', () => {
168 expect(() => nativeImage.createFromBuffer(null as any)).to.throw('buffer must be a node Buffer');
169 expect(() => nativeImage.createFromBuffer([12, 14, 124, 12] as any)).to.throw('buffer must be a node Buffer');
173 describe('createFromDataURL(dataURL)', () => {
174 it('returns an empty image from the empty string', () => {
175 expect(nativeImage.createFromDataURL('').isEmpty()).to.be.true();
178 it('returns an image created from the given string', () => {
179 for (const imageData of dataUrlImages) {
180 const imageFromPath = nativeImage.createFromPath(imageData.path);
181 const imageFromDataUrl = nativeImage.createFromDataURL(imageData.dataUrl!);
183 expect(imageFromDataUrl.isEmpty()).to.be.false();
184 expect(imageFromDataUrl.getSize()).to.deep.equal(imageFromPath.getSize());
185 expect(imageFromDataUrl.toBitmap()).to.satisfy(
186 (bitmap: any) => imageFromPath.toBitmap().equals(bitmap));
187 expect(imageFromDataUrl.toDataURL()).to.equal(imageFromPath.toDataURL());
192 describe('toDataURL()', () => {
193 it('returns a PNG data URL', () => {
194 for (const imageData of dataUrlImages) {
195 const imageFromPath = nativeImage.createFromPath(imageData.path!);
197 const scaleFactors = [1.0, 2.0];
198 for (const scaleFactor of scaleFactors) {
199 expect(imageFromPath.toDataURL({ scaleFactor })).to.equal(imageData.dataUrl);
204 it('returns a data URL at 1x scale factor by default', () => {
205 const imageData = imageLogo;
206 const image = nativeImage.createFromPath(imageData.path);
208 const imageOne = nativeImage.createFromBuffer(image.toPNG(), {
209 width: image.getSize().width,
210 height: image.getSize().height,
213 expect(imageOne.getSize()).to.deep.equal(
214 { width: imageData.width / 2, height: imageData.height / 2 });
216 const imageTwo = nativeImage.createFromDataURL(imageOne.toDataURL());
217 expect(imageTwo.getSize()).to.deep.equal(
218 { width: imageData.width, height: imageData.height });
220 expect(imageOne.toBitmap().equals(imageTwo.toBitmap())).to.be.true();
223 it('supports a scale factor', () => {
224 const imageData = imageLogo;
225 const image = nativeImage.createFromPath(imageData.path);
226 const expectedSize = { width: imageData.width, height: imageData.height };
228 const imageFromDataUrlOne = nativeImage.createFromDataURL(
229 image.toDataURL({ scaleFactor: 1.0 }));
230 expect(imageFromDataUrlOne.getSize()).to.deep.equal(expectedSize);
232 const imageFromDataUrlTwo = nativeImage.createFromDataURL(
233 image.toDataURL({ scaleFactor: 2.0 }));
234 expect(imageFromDataUrlTwo.getSize()).to.deep.equal(expectedSize);
238 describe('toPNG()', () => {
239 it('returns a buffer at 1x scale factor by default', () => {
240 const imageData = imageLogo;
241 const imageA = nativeImage.createFromPath(imageData.path);
243 const imageB = nativeImage.createFromBuffer(imageA.toPNG(), {
244 width: imageA.getSize().width,
245 height: imageA.getSize().height,
248 expect(imageB.getSize()).to.deep.equal(
249 { width: imageData.width / 2, height: imageData.height / 2 });
251 const imageC = nativeImage.createFromBuffer(imageB.toPNG());
252 expect(imageC.getSize()).to.deep.equal(
253 { width: imageData.width, height: imageData.height });
255 expect(imageB.toBitmap().equals(imageC.toBitmap())).to.be.true();
258 it('supports a scale factor', () => {
259 const imageData = imageLogo;
260 const image = nativeImage.createFromPath(imageData.path);
262 const imageFromBufferOne = nativeImage.createFromBuffer(
263 image.toPNG({ scaleFactor: 1.0 }));
264 expect(imageFromBufferOne.getSize()).to.deep.equal(
265 { width: imageData.width, height: imageData.height });
267 const imageFromBufferTwo = nativeImage.createFromBuffer(
268 image.toPNG({ scaleFactor: 2.0 }), { scaleFactor: 2.0 });
269 expect(imageFromBufferTwo.getSize()).to.deep.equal(
270 { width: imageData.width / 2, height: imageData.height / 2 });
274 describe('createFromPath(path)', () => {
275 it('returns an empty image for invalid paths', () => {
276 expect(nativeImage.createFromPath('').isEmpty()).to.be.true();
277 expect(nativeImage.createFromPath('does-not-exist.png').isEmpty()).to.be.true();
278 expect(nativeImage.createFromPath('does-not-exist.ico').isEmpty()).to.be.true();
279 expect(nativeImage.createFromPath(__dirname).isEmpty()).to.be.true();
280 expect(nativeImage.createFromPath(__filename).isEmpty()).to.be.true();
283 it('loads images from paths relative to the current working directory', () => {
284 const imagePath = path.relative('.', path.join(fixturesPath, 'assets', 'logo.png'));
285 const image = nativeImage.createFromPath(imagePath);
286 expect(image.isEmpty()).to.be.false();
287 expect(image.getSize()).to.deep.equal({ width: 538, height: 190 });
290 it('loads images from paths with `.` segments', () => {
291 const imagePath = `${path.join(fixturesPath)}${path.sep}.${path.sep}${path.join('assets', 'logo.png')}`;
292 const image = nativeImage.createFromPath(imagePath);
293 expect(image.isEmpty()).to.be.false();
294 expect(image.getSize()).to.deep.equal({ width: 538, height: 190 });
297 it('loads images from paths with `..` segments', () => {
298 const imagePath = `${path.join(fixturesPath, 'api')}${path.sep}..${path.sep}${path.join('assets', 'logo.png')}`;
299 const image = nativeImage.createFromPath(imagePath);
300 expect(image.isEmpty()).to.be.false();
301 expect(image.getSize()).to.deep.equal({ width: 538, height: 190 });
304 ifit(process.platform === 'darwin')('Gets an NSImage pointer on macOS', function () {
305 const imagePath = `${path.join(fixturesPath, 'api')}${path.sep}..${path.sep}${path.join('assets', 'logo.png')}`;
306 const image = nativeImage.createFromPath(imagePath);
307 const nsimage = image.getNativeHandle();
309 expect(nsimage).to.have.lengthOf(8);
311 // If all bytes are null, that's Bad
312 const allBytesAreNotNull = nsimage.reduce((acc, x) => acc || (x !== 0), false);
313 expect(allBytesAreNotNull);
316 ifit(process.platform === 'win32')('loads images from .ico files on Windows', function () {
317 const imagePath = path.join(fixturesPath, 'assets', 'icon.ico');
318 const image = nativeImage.createFromPath(imagePath);
319 expect(image.isEmpty()).to.be.false();
320 expect(image.getSize()).to.deep.equal({ width: 256, height: 256 });
324 describe('createFromNamedImage(name)', () => {
325 it('returns empty for invalid options', () => {
326 const image = nativeImage.createFromNamedImage('totally_not_real');
327 expect(image.isEmpty()).to.be.true();
330 ifit(process.platform !== 'darwin')('returns empty on non-darwin platforms', function () {
331 const image = nativeImage.createFromNamedImage('NSActionTemplate');
332 expect(image.isEmpty()).to.be.true();
335 ifit(process.platform === 'darwin')('returns a valid image on darwin', function () {
336 const image = nativeImage.createFromNamedImage('NSActionTemplate');
337 expect(image.isEmpty()).to.be.false();
340 ifit(process.platform === 'darwin')('returns allows an HSL shift for a valid image on darwin', function () {
341 const image = nativeImage.createFromNamedImage('NSActionTemplate', [0.5, 0.2, 0.8]);
342 expect(image.isEmpty()).to.be.false();
346 describe('resize(options)', () => {
347 it('returns a resized image', () => {
348 const image = nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'logo.png'));
349 for (const [resizeTo, expectedSize] of new Map([
350 [{}, { width: 538, height: 190 }],
351 [{ width: 269 }, { width: 269, height: 95 }],
352 [{ width: 600 }, { width: 600, height: 212 }],
353 [{ height: 95 }, { width: 269, height: 95 }],
354 [{ height: 200 }, { width: 566, height: 200 }],
355 [{ width: 80, height: 65 }, { width: 80, height: 65 }],
356 [{ width: 600, height: 200 }, { width: 600, height: 200 }],
357 [{ width: 0, height: 0 }, { width: 0, height: 0 }],
358 [{ width: -1, height: -1 }, { width: 0, height: 0 }]
360 const actualSize = image.resize(resizeTo).getSize();
361 expect(actualSize).to.deep.equal(expectedSize);
365 it('returns an empty image when called on an empty image', () => {
366 expect(nativeImage.createEmpty().resize({ width: 1, height: 1 }).isEmpty()).to.be.true();
367 expect(nativeImage.createEmpty().resize({ width: 0, height: 0 }).isEmpty()).to.be.true();
370 it('supports a quality option', () => {
371 const image = nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'logo.png'));
372 const good = image.resize({ width: 100, height: 100, quality: 'good' });
373 const better = image.resize({ width: 100, height: 100, quality: 'better' });
374 const best = image.resize({ width: 100, height: 100, quality: 'best' });
376 expect(good.toPNG()).to.have.lengthOf.at.most(better.toPNG().length);
377 expect(better.toPNG()).to.have.lengthOf.below(best.toPNG().length);
381 describe('crop(bounds)', () => {
382 it('returns an empty image when called on an empty image', () => {
383 expect(nativeImage.createEmpty().crop({ width: 1, height: 2, x: 0, y: 0 }).isEmpty()).to.be.true();
384 expect(nativeImage.createEmpty().crop({ width: 0, height: 0, x: 0, y: 0 }).isEmpty()).to.be.true();
387 it('returns an empty image when the bounds are invalid', () => {
388 const image = nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'logo.png'));
389 expect(image.crop({ width: 0, height: 0, x: 0, y: 0 }).isEmpty()).to.be.true();
390 expect(image.crop({ width: -1, height: 10, x: 0, y: 0 }).isEmpty()).to.be.true();
391 expect(image.crop({ width: 10, height: -35, x: 0, y: 0 }).isEmpty()).to.be.true();
392 expect(image.crop({ width: 100, height: 100, x: 1000, y: 1000 }).isEmpty()).to.be.true();
395 it('returns a cropped image', () => {
396 const image = nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'logo.png'));
397 const cropA = image.crop({ width: 25, height: 64, x: 0, y: 0 });
398 const cropB = image.crop({ width: 25, height: 64, x: 30, y: 40 });
399 expect(cropA.getSize()).to.deep.equal({ width: 25, height: 64 });
400 expect(cropB.getSize()).to.deep.equal({ width: 25, height: 64 });
401 expect(cropA.toPNG().equals(cropB.toPNG())).to.be.false();
404 it('toBitmap() returns a buffer of the right size', () => {
405 const image = nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'logo.png'));
406 const crop = image.crop({ width: 25, height: 64, x: 0, y: 0 });
407 expect(crop.toBitmap().length).to.equal(25 * 64 * 4);
411 describe('getAspectRatio()', () => {
412 it('returns an aspect ratio of an empty image', () => {
413 expect(nativeImage.createEmpty().getAspectRatio()).to.equal(1.0);
416 it('returns an aspect ratio of an image', () => {
417 const imageData = imageLogo;
418 // imageData.width / imageData.height = 2.831578947368421
419 const expectedAspectRatio = 2.8315789699554443;
421 const image = nativeImage.createFromPath(imageData.path);
422 expect(image.getAspectRatio()).to.equal(expectedAspectRatio);
426 ifdescribe(process.platform !== 'linux')('createThumbnailFromPath(path, size)', () => {
427 it('throws when invalid size is passed', async () => {
428 const badSize = { width: -1, height: -1 };
431 nativeImage.createThumbnailFromPath('path', badSize)
432 ).to.eventually.be.rejectedWith('size must not be empty');
435 it('throws when a bad path is passed', async () => {
436 const badPath = process.platform === 'win32' ? '\\hey\\hi\\hello' : '/hey/hi/hello';
437 const goodSize = { width: 100, height: 100 };
440 nativeImage.createThumbnailFromPath(badPath, goodSize)
441 ).to.eventually.be.rejected();
444 it('returns native image given valid params', async () => {
445 const goodPath = path.join(fixturesPath, 'assets', 'logo.png');
446 const goodSize = { width: 100, height: 100 };
447 const result = await nativeImage.createThumbnailFromPath(goodPath, goodSize);
448 expect(result.isEmpty()).to.equal(false);
451 it('returns the correct size if larger than the initial image', async () => {
452 // capybara.png is a 128x128 image.
453 const imgPath = path.join(fixturesPath, 'assets', 'capybara.png');
454 const size = { width: 256, height: 256 };
455 const result = await nativeImage.createThumbnailFromPath(imgPath, size);
456 expect(result.getSize()).to.deep.equal(size);
459 it('returns the correct size if is the same as the initial image', async () => {
460 // capybara.png is a 128x128 image.
461 const imgPath = path.join(fixturesPath, 'assets', 'capybara.png');
462 const size = { width: 128, height: 128 };
463 const result = await nativeImage.createThumbnailFromPath(imgPath, size);
464 expect(result.getSize()).to.deep.equal(size);
467 it('returns the correct size if smaller than the initial image', async () => {
468 // capybara.png is a 128x128 image.
469 const imgPath = path.join(fixturesPath, 'assets', 'capybara.png');
470 const maxSize = { width: 64, height: 64 };
471 const result = await nativeImage.createThumbnailFromPath(imgPath, maxSize);
472 expect(result.getSize()).to.deep.equal(maxSize);
476 describe('addRepresentation()', () => {
477 it('does not add representation when the buffer is too small', () => {
478 const image = nativeImage.createEmpty();
480 image.addRepresentation({
481 buffer: Buffer.from([1, 2, 3, 4]),
486 expect(image.isEmpty()).to.be.true();
489 it('supports adding a buffer representation for a scale factor', () => {
490 const image = nativeImage.createEmpty();
492 const imageDataOne = image1x1;
493 image.addRepresentation({
495 buffer: nativeImage.createFromPath(imageDataOne.path).toPNG()
498 expect(image.getScaleFactors()).to.deep.equal([1]);
500 const imageDataTwo = image2x2;
501 image.addRepresentation({
503 buffer: nativeImage.createFromPath(imageDataTwo.path).toPNG()
506 expect(image.getScaleFactors()).to.deep.equal([1, 2]);
508 const imageDataThree = image3x3;
509 image.addRepresentation({
511 buffer: nativeImage.createFromPath(imageDataThree.path).toPNG()
514 expect(image.getScaleFactors()).to.deep.equal([1, 2, 3]);
516 image.addRepresentation({
518 buffer: 'invalid' as any
521 // this one failed, so it shouldn't show up in the scale factors
522 expect(image.getScaleFactors()).to.deep.equal([1, 2, 3]);
524 expect(image.isEmpty()).to.be.false();
525 expect(image.getSize()).to.deep.equal({ width: 1, height: 1 });
527 expect(image.toDataURL({ scaleFactor: 1.0 })).to.equal(imageDataOne.dataUrl);
528 expect(image.toDataURL({ scaleFactor: 2.0 })).to.equal(imageDataTwo.dataUrl);
529 expect(image.toDataURL({ scaleFactor: 3.0 })).to.equal(imageDataThree.dataUrl);
530 expect(image.toDataURL({ scaleFactor: 4.0 })).to.equal(imageDataThree.dataUrl);
533 it('supports adding a data URL representation for a scale factor', () => {
534 const image = nativeImage.createEmpty();
536 const imageDataOne = image1x1;
537 image.addRepresentation({
539 dataURL: imageDataOne.dataUrl
542 const imageDataTwo = image2x2;
543 image.addRepresentation({
545 dataURL: imageDataTwo.dataUrl
548 const imageDataThree = image3x3;
549 image.addRepresentation({
551 dataURL: imageDataThree.dataUrl
554 image.addRepresentation({
559 expect(image.isEmpty()).to.be.false();
560 expect(image.getSize()).to.deep.equal({ width: 1, height: 1 });
562 expect(image.toDataURL({ scaleFactor: 1.0 })).to.equal(imageDataOne.dataUrl);
563 expect(image.toDataURL({ scaleFactor: 2.0 })).to.equal(imageDataTwo.dataUrl);
564 expect(image.toDataURL({ scaleFactor: 3.0 })).to.equal(imageDataThree.dataUrl);
565 expect(image.toDataURL({ scaleFactor: 4.0 })).to.equal(imageDataThree.dataUrl);
568 it('supports adding a representation to an existing image', () => {
569 const imageDataOne = image1x1;
570 const image = nativeImage.createFromPath(imageDataOne.path);
572 const imageDataTwo = image2x2;
573 image.addRepresentation({
575 dataURL: imageDataTwo.dataUrl
578 const imageDataThree = image3x3;
579 image.addRepresentation({
581 dataURL: imageDataThree.dataUrl
584 expect(image.toDataURL({ scaleFactor: 1.0 })).to.equal(imageDataOne.dataUrl);
585 expect(image.toDataURL({ scaleFactor: 2.0 })).to.equal(imageDataTwo.dataUrl);