@wdio/image-comparison-core 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -3
- package/dist/helpers/options.d.ts +1 -4
- package/dist/helpers/options.d.ts.map +1 -1
- package/dist/helpers/options.js +2 -11
- package/dist/methods/compareReport.interfaces.d.ts +1 -1
- package/dist/methods/compareReport.interfaces.d.ts.map +1 -1
- package/dist/methods/createCompareReport.test.js +4 -2
- package/dist/methods/images.d.ts +2 -1
- package/dist/methods/images.d.ts.map +1 -1
- package/dist/methods/images.executeImageCompare.test.js +39 -44
- package/dist/methods/images.js +31 -31
- package/dist/methods/images.test.js +80 -220
- package/dist/methods/processDiffPixels.d.ts +1 -1
- package/dist/methods/processDiffPixels.d.ts.map +1 -1
- package/dist/methods/processDiffPixels.js +11 -2
- package/dist/methods/rectangles.d.ts.map +1 -1
- package/dist/methods/rectangles.interfaces.d.ts +1 -1
- package/dist/methods/rectangles.interfaces.d.ts.map +1 -1
- package/dist/methods/rectangles.js +12 -9
- package/dist/pixelmatch/compare.interfaces.d.ts +43 -0
- package/dist/pixelmatch/compare.interfaces.d.ts.map +1 -0
- package/dist/pixelmatch/compareImages.d.ts.map +1 -0
- package/dist/pixelmatch/compareImages.js +173 -0
- package/dist/pixelmatch/compareImages.test.d.ts +2 -0
- package/dist/pixelmatch/compareImages.test.d.ts.map +1 -0
- package/dist/pixelmatch/compareImages.test.js +262 -0
- package/dist/utils/imageUtils.d.ts +17 -0
- package/dist/utils/imageUtils.d.ts.map +1 -0
- package/dist/utils/imageUtils.js +189 -0
- package/dist/utils/imageUtils.test.d.ts +2 -0
- package/dist/utils/imageUtils.test.d.ts.map +1 -0
- package/dist/utils/imageUtils.test.js +277 -0
- package/package.json +3 -2
- package/dist/resemble/compare.interfaces.d.ts +0 -136
- package/dist/resemble/compare.interfaces.d.ts.map +0 -1
- package/dist/resemble/compareImages.d.ts.map +0 -1
- package/dist/resemble/compareImages.js +0 -21
- package/dist/resemble/resemble.jimp.cjs +0 -981
- package/dist/resemble/resemble.jimp.d.cts +0 -46
- package/dist/resemble/resemble.jimp.d.cts.map +0 -1
- /package/dist/{resemble → pixelmatch}/compare.interfaces.js +0 -0
- /package/dist/{resemble → pixelmatch}/compareImages.d.ts +0 -0
|
@@ -3,22 +3,25 @@ import { join } from 'node:path';
|
|
|
3
3
|
import { promises as fsPromises, readFileSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import logger from '@wdio/logger';
|
|
5
5
|
import { DEFAULT_RESIZE_DIMENSIONS } from '../helpers/constants.js';
|
|
6
|
-
import { checkIfImageExists, removeDiffImageIfExists, checkBaselineImageExists, getRotatedImageIfNeeded, logDimensionWarning, getAdjustedAxis, handleIOSBezelCorners, cropAndConvertToDataURL, makeCroppedBase64Image, makeFullPageBase64Image, rotateBase64Image, takeResizedBase64Screenshot, } from './images.js';
|
|
6
|
+
import { checkIfImageExists, removeDiffImageIfExists, checkBaselineImageExists, getRotatedImageIfNeeded, logDimensionWarning, getAdjustedAxis, handleIOSBezelCorners, cropAndConvertToDataURL, makeCroppedBase64Image, makeFullPageBase64Image, addBlockOuts, rotateBase64Image, takeResizedBase64Screenshot, } from './images.js';
|
|
7
|
+
import * as imageUtils from '../utils/imageUtils.js';
|
|
7
8
|
const log = logger('test');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
const makeRawImage = (width = 1000, height = 800) => ({
|
|
10
|
+
data: new Uint8Array(width * height * 4),
|
|
11
|
+
width,
|
|
12
|
+
height,
|
|
13
|
+
});
|
|
14
|
+
vi.mock('../utils/imageUtils.js', () => ({
|
|
15
|
+
decodeImage: vi.fn().mockImplementation(() => makeRawImage()),
|
|
16
|
+
cropImage: vi.fn().mockImplementation(() => makeRawImage(200, 100)),
|
|
17
|
+
compositeImage: vi.fn(),
|
|
18
|
+
createCanvas: vi.fn().mockImplementation((w, h) => makeRawImage(w, h)),
|
|
19
|
+
setOpacity: vi.fn(),
|
|
20
|
+
toBase64Png: vi.fn().mockReturnValue('croppedImageData'),
|
|
21
|
+
rotate90CW: vi.fn().mockImplementation(() => makeRawImage(800, 1000)),
|
|
22
|
+
rotate90CCW: vi.fn().mockImplementation(() => makeRawImage(800, 1000)),
|
|
23
|
+
rotate180: vi.fn().mockImplementation(() => makeRawImage()),
|
|
24
|
+
encodeImage: vi.fn().mockReturnValue(Buffer.from('encoded')),
|
|
22
25
|
}));
|
|
23
26
|
vi.mock('@wdio/logger', () => import(join(process.cwd(), '__mocks__', '@wdio/logger')));
|
|
24
27
|
vi.mock('node:fs', async () => {
|
|
@@ -222,55 +225,50 @@ describe('checkBaselineImageExists', () => {
|
|
|
222
225
|
});
|
|
223
226
|
});
|
|
224
227
|
describe('rotateBase64Image', () => {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
expect(
|
|
245
|
-
expect(mockImage.rotate.mock.calls).toMatchSnapshot();
|
|
246
|
-
expect(mockImage.getBase64.mock.calls).toMatchSnapshot();
|
|
247
|
-
});
|
|
248
|
-
it('should rotate image by 180 degrees', async () => {
|
|
249
|
-
const mockImage = {
|
|
250
|
-
rotate: vi.fn().mockReturnThis(),
|
|
251
|
-
getBase64: vi.fn().mockResolvedValue('data:image/png;base64,rotatedImageData')
|
|
252
|
-
};
|
|
253
|
-
jimpReadMock.mockResolvedValue(mockImage);
|
|
254
|
-
const result = await rotateBase64Image({
|
|
255
|
-
base64Image: 'originalImageData',
|
|
256
|
-
degrees: 180
|
|
257
|
-
});
|
|
258
|
-
expect(result).toMatchSnapshot();
|
|
259
|
-
expect(mockImage.rotate.mock.calls).toMatchSnapshot();
|
|
228
|
+
afterEach(() => { vi.clearAllMocks(); });
|
|
229
|
+
it('calls rotate90CW for 90 degrees and returns toBase64Png result', () => {
|
|
230
|
+
const result = rotateBase64Image({ base64Image: 'originalImageData', degrees: 90 });
|
|
231
|
+
expect(vi.mocked(imageUtils.rotate90CW)).toHaveBeenCalledTimes(1);
|
|
232
|
+
expect(vi.mocked(imageUtils.rotate180)).not.toHaveBeenCalled();
|
|
233
|
+
expect(result).toBe('croppedImageData');
|
|
234
|
+
});
|
|
235
|
+
it('calls rotate180 for 180 degrees', () => {
|
|
236
|
+
rotateBase64Image({ base64Image: 'originalImageData', degrees: 180 });
|
|
237
|
+
expect(vi.mocked(imageUtils.rotate180)).toHaveBeenCalledTimes(1);
|
|
238
|
+
expect(vi.mocked(imageUtils.rotate90CW)).not.toHaveBeenCalled();
|
|
239
|
+
});
|
|
240
|
+
it('calls rotate90CCW for 270 degrees', () => {
|
|
241
|
+
rotateBase64Image({ base64Image: 'differentImageData', degrees: 270 });
|
|
242
|
+
expect(vi.mocked(imageUtils.rotate90CCW)).toHaveBeenCalledTimes(1);
|
|
243
|
+
expect(vi.mocked(imageUtils.rotate90CW)).not.toHaveBeenCalled();
|
|
244
|
+
});
|
|
245
|
+
it('calls rotate90CW for any other degree value', () => {
|
|
246
|
+
rotateBase64Image({ base64Image: 'differentImageData', degrees: 45 });
|
|
247
|
+
expect(vi.mocked(imageUtils.rotate90CW)).toHaveBeenCalledTimes(1);
|
|
260
248
|
});
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
249
|
+
});
|
|
250
|
+
describe('addBlockOuts', () => {
|
|
251
|
+
afterEach(() => { vi.clearAllMocks(); });
|
|
252
|
+
it('returns the image unchanged when there are no ignored boxes', async () => {
|
|
253
|
+
const result = await addBlockOuts('someBase64', []);
|
|
254
|
+
expect(vi.mocked(imageUtils.decodeImage)).toHaveBeenCalledTimes(1);
|
|
255
|
+
expect(vi.mocked(imageUtils.compositeImage)).not.toHaveBeenCalled();
|
|
256
|
+
expect(vi.mocked(imageUtils.toBase64Png)).toHaveBeenCalledTimes(1);
|
|
257
|
+
expect(result).toBe('croppedImageData');
|
|
258
|
+
});
|
|
259
|
+
it('creates a semi-transparent green overlay for each ignored box', async () => {
|
|
260
|
+
const boxes = [
|
|
261
|
+
{ left: 10, top: 20, right: 110, bottom: 120 },
|
|
262
|
+
{ left: 200, top: 50, right: 300, bottom: 150 },
|
|
263
|
+
];
|
|
264
|
+
await addBlockOuts('someBase64', boxes);
|
|
265
|
+
expect(vi.mocked(imageUtils.createCanvas)).toHaveBeenCalledTimes(2);
|
|
266
|
+
// First box: width=100, height=100, green (#39aa56 = 57,170,86,255)
|
|
267
|
+
expect(vi.mocked(imageUtils.createCanvas)).toHaveBeenCalledWith(100, 100, 57, 170, 86, 255);
|
|
268
|
+
expect(vi.mocked(imageUtils.setOpacity)).toHaveBeenCalledTimes(2);
|
|
269
|
+
expect(vi.mocked(imageUtils.setOpacity)).toHaveBeenCalledWith(expect.any(Object), 0.5);
|
|
270
|
+
expect(vi.mocked(imageUtils.compositeImage)).toHaveBeenCalledTimes(2);
|
|
271
|
+
expect(vi.mocked(imageUtils.compositeImage)).toHaveBeenCalledWith(expect.any(Object), expect.any(Object), 10, 20);
|
|
274
272
|
});
|
|
275
273
|
});
|
|
276
274
|
describe('getRotatedImageIfNeeded', () => {
|
|
@@ -511,6 +509,7 @@ describe('handleIOSBezelCorners', () => {
|
|
|
511
509
|
let readFileSyncMock;
|
|
512
510
|
let getBase64ScreenshotSizeMock;
|
|
513
511
|
let mockImage;
|
|
512
|
+
let compositeImageFn;
|
|
514
513
|
beforeEach(async () => {
|
|
515
514
|
logWarnSpy = vi.spyOn(log, 'warn').mockImplementation(() => { });
|
|
516
515
|
const utilsModule = vi.mocked(await import('../helpers/utils.js'));
|
|
@@ -518,12 +517,8 @@ describe('handleIOSBezelCorners', () => {
|
|
|
518
517
|
getBase64ScreenshotSizeMock = vi.spyOn(utilsModule, 'getBase64ScreenshotSize');
|
|
519
518
|
const fsModule = vi.mocked(await import('node:fs'));
|
|
520
519
|
readFileSyncMock = vi.spyOn(fsModule, 'readFileSync');
|
|
521
|
-
mockImage = {
|
|
522
|
-
|
|
523
|
-
getBase64: vi.fn().mockResolvedValue('data:image/png;base64,mockImageData'),
|
|
524
|
-
opacity: vi.fn().mockReturnThis(),
|
|
525
|
-
rotate: vi.fn().mockReturnThis(),
|
|
526
|
-
};
|
|
520
|
+
mockImage = { data: new Uint8Array(4), width: 100, height: 100 };
|
|
521
|
+
compositeImageFn = vi.mocked(imageUtils.compositeImage);
|
|
527
522
|
});
|
|
528
523
|
afterEach(() => {
|
|
529
524
|
vi.clearAllMocks();
|
|
@@ -561,7 +556,7 @@ describe('handleIOSBezelCorners', () => {
|
|
|
561
556
|
});
|
|
562
557
|
expect(getIosBezelImageNamesMock.mock.calls).toMatchSnapshot();
|
|
563
558
|
expect(readFileSyncMock).toHaveBeenCalledTimes(2);
|
|
564
|
-
expect(
|
|
559
|
+
expect(compositeImageFn).toHaveBeenCalledTimes(2);
|
|
565
560
|
expect(logWarnSpy).not.toHaveBeenCalled();
|
|
566
561
|
});
|
|
567
562
|
it('should handle supported iPhone device in landscape mode', async () => {
|
|
@@ -582,7 +577,7 @@ describe('handleIOSBezelCorners', () => {
|
|
|
582
577
|
});
|
|
583
578
|
expect(getIosBezelImageNamesMock.mock.calls).toMatchSnapshot();
|
|
584
579
|
expect(readFileSyncMock).toHaveBeenCalledTimes(2);
|
|
585
|
-
expect(
|
|
580
|
+
expect(compositeImageFn).toHaveBeenCalledTimes(2);
|
|
586
581
|
expect(logWarnSpy).not.toHaveBeenCalled();
|
|
587
582
|
});
|
|
588
583
|
it('should handle supported iPad device with sufficient dimensions', async () => {
|
|
@@ -603,7 +598,7 @@ describe('handleIOSBezelCorners', () => {
|
|
|
603
598
|
});
|
|
604
599
|
expect(getIosBezelImageNamesMock.mock.calls).toMatchSnapshot();
|
|
605
600
|
expect(readFileSyncMock).toHaveBeenCalledTimes(2);
|
|
606
|
-
expect(
|
|
601
|
+
expect(compositeImageFn).toHaveBeenCalledTimes(2);
|
|
607
602
|
expect(logWarnSpy).not.toHaveBeenCalled();
|
|
608
603
|
});
|
|
609
604
|
it('should not handle iPad device with insufficient dimensions', async () => {
|
|
@@ -638,7 +633,7 @@ describe('handleIOSBezelCorners', () => {
|
|
|
638
633
|
});
|
|
639
634
|
expect(getIosBezelImageNamesMock.mock.calls).toMatchSnapshot();
|
|
640
635
|
expect(readFileSyncMock).toHaveBeenCalledTimes(2);
|
|
641
|
-
expect(
|
|
636
|
+
expect(compositeImageFn).toHaveBeenCalledTimes(2);
|
|
642
637
|
expect(logWarnSpy).not.toHaveBeenCalled();
|
|
643
638
|
});
|
|
644
639
|
it('should handle unsupported device', async () => {
|
|
@@ -671,7 +666,7 @@ describe('handleIOSBezelCorners', () => {
|
|
|
671
666
|
});
|
|
672
667
|
expect(getIosBezelImageNamesMock.mock.calls).toMatchSnapshot();
|
|
673
668
|
expect(readFileSyncMock).not.toHaveBeenCalled();
|
|
674
|
-
expect(
|
|
669
|
+
expect(compositeImageFn).not.toHaveBeenCalled();
|
|
675
670
|
expect(logWarnSpy.mock.calls).toMatchSnapshot();
|
|
676
671
|
});
|
|
677
672
|
it('should handle partial bezel image names', async () => {
|
|
@@ -690,7 +685,7 @@ describe('handleIOSBezelCorners', () => {
|
|
|
690
685
|
});
|
|
691
686
|
expect(getIosBezelImageNamesMock.mock.calls).toMatchSnapshot();
|
|
692
687
|
expect(readFileSyncMock).not.toHaveBeenCalled();
|
|
693
|
-
expect(
|
|
688
|
+
expect(compositeImageFn).not.toHaveBeenCalled();
|
|
694
689
|
expect(logWarnSpy.mock.calls).toMatchSnapshot();
|
|
695
690
|
});
|
|
696
691
|
it('should handle Android device (not iOS)', async () => {
|
|
@@ -709,8 +704,6 @@ describe('handleIOSBezelCorners', () => {
|
|
|
709
704
|
});
|
|
710
705
|
});
|
|
711
706
|
describe('cropAndConvertToDataURL', () => {
|
|
712
|
-
let mockImage;
|
|
713
|
-
let mockCroppedImage;
|
|
714
707
|
const defaultCropOptions = {
|
|
715
708
|
addIOSBezelCorners: false,
|
|
716
709
|
base64Image: 'originalImageData',
|
|
@@ -723,106 +716,43 @@ describe('cropAndConvertToDataURL', () => {
|
|
|
723
716
|
sourceY: 25,
|
|
724
717
|
width: 200,
|
|
725
718
|
};
|
|
726
|
-
|
|
727
|
-
mockCroppedImage = {
|
|
728
|
-
getBase64: vi.fn().mockResolvedValue('data:image/png;base64,croppedImageData'),
|
|
729
|
-
};
|
|
730
|
-
mockImage = {
|
|
731
|
-
crop: vi.fn().mockReturnValue(mockCroppedImage),
|
|
732
|
-
};
|
|
733
|
-
const jimpModule = vi.mocked(await import('jimp'));
|
|
734
|
-
vi.spyOn(jimpModule.Jimp, 'read').mockResolvedValue(mockImage);
|
|
735
|
-
});
|
|
736
|
-
afterEach(() => {
|
|
737
|
-
vi.clearAllMocks();
|
|
738
|
-
});
|
|
719
|
+
afterEach(() => { vi.clearAllMocks(); });
|
|
739
720
|
it('should crop image and return base64 data without iOS bezel corners', async () => {
|
|
740
721
|
const result = await cropAndConvertToDataURL(defaultCropOptions);
|
|
741
|
-
expect(
|
|
742
|
-
expect(mockCroppedImage.getBase64.mock.calls).toMatchSnapshot();
|
|
722
|
+
expect(vi.mocked(imageUtils.cropImage)).toHaveBeenCalledWith(expect.any(Object), 50, 25, 200, 100);
|
|
743
723
|
expect(result).toMatchSnapshot();
|
|
744
724
|
});
|
|
745
725
|
it('should crop image and add iOS bezel corners when isIOS is true', async () => {
|
|
746
|
-
const result = await cropAndConvertToDataURL({
|
|
747
|
-
...defaultCropOptions,
|
|
748
|
-
addIOSBezelCorners: true,
|
|
749
|
-
isIOS: true,
|
|
750
|
-
});
|
|
751
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
752
|
-
expect(mockCroppedImage.getBase64.mock.calls).toMatchSnapshot();
|
|
726
|
+
const result = await cropAndConvertToDataURL({ ...defaultCropOptions, addIOSBezelCorners: true, isIOS: true });
|
|
753
727
|
expect(result).toMatchSnapshot();
|
|
754
728
|
});
|
|
755
729
|
it('should handle landscape orientation with iOS bezel corners', async () => {
|
|
756
|
-
const result = await cropAndConvertToDataURL({
|
|
757
|
-
...defaultCropOptions,
|
|
758
|
-
addIOSBezelCorners: true,
|
|
759
|
-
isIOS: true,
|
|
760
|
-
isLandscape: true,
|
|
761
|
-
});
|
|
762
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
763
|
-
expect(mockCroppedImage.getBase64.mock.calls).toMatchSnapshot();
|
|
730
|
+
const result = await cropAndConvertToDataURL({ ...defaultCropOptions, addIOSBezelCorners: true, isIOS: true, isLandscape: true });
|
|
764
731
|
expect(result).toMatchSnapshot();
|
|
765
732
|
});
|
|
766
733
|
it('should handle Android device (isIOS false) without bezel corners', async () => {
|
|
767
|
-
const result = await cropAndConvertToDataURL({
|
|
768
|
-
...defaultCropOptions,
|
|
769
|
-
addIOSBezelCorners: true,
|
|
770
|
-
deviceName: 'Samsung Galaxy S21',
|
|
771
|
-
isIOS: false,
|
|
772
|
-
});
|
|
773
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
774
|
-
expect(mockCroppedImage.getBase64.mock.calls).toMatchSnapshot();
|
|
734
|
+
const result = await cropAndConvertToDataURL({ ...defaultCropOptions, addIOSBezelCorners: true, deviceName: 'Samsung Galaxy S21', isIOS: false });
|
|
775
735
|
expect(result).toMatchSnapshot();
|
|
776
736
|
});
|
|
777
737
|
it('should handle zero dimensions', async () => {
|
|
778
|
-
const result = await cropAndConvertToDataURL({
|
|
779
|
-
...defaultCropOptions,
|
|
780
|
-
height: 0,
|
|
781
|
-
sourceX: 0,
|
|
782
|
-
sourceY: 0,
|
|
783
|
-
width: 0,
|
|
784
|
-
});
|
|
785
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
786
|
-
expect(mockCroppedImage.getBase64.mock.calls).toMatchSnapshot();
|
|
738
|
+
const result = await cropAndConvertToDataURL({ ...defaultCropOptions, height: 0, sourceX: 0, sourceY: 0, width: 0 });
|
|
787
739
|
expect(result).toMatchSnapshot();
|
|
788
740
|
});
|
|
789
741
|
it('should handle large crop dimensions', async () => {
|
|
790
|
-
const result = await cropAndConvertToDataURL({
|
|
791
|
-
...defaultCropOptions,
|
|
792
|
-
height: 2000,
|
|
793
|
-
sourceX: 1000,
|
|
794
|
-
sourceY: 500,
|
|
795
|
-
width: 3000,
|
|
796
|
-
});
|
|
797
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
798
|
-
expect(mockCroppedImage.getBase64.mock.calls).toMatchSnapshot();
|
|
742
|
+
const result = await cropAndConvertToDataURL({ ...defaultCropOptions, height: 2000, sourceX: 1000, sourceY: 500, width: 3000 });
|
|
799
743
|
expect(result).toMatchSnapshot();
|
|
800
744
|
});
|
|
801
745
|
it('should handle different base64 input data', async () => {
|
|
802
|
-
const result = await cropAndConvertToDataURL({
|
|
803
|
-
...defaultCropOptions,
|
|
804
|
-
base64Image: 'differentImageData123',
|
|
805
|
-
});
|
|
806
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
807
|
-
expect(mockCroppedImage.getBase64.mock.calls).toMatchSnapshot();
|
|
746
|
+
const result = await cropAndConvertToDataURL({ ...defaultCropOptions, base64Image: 'differentImageData123' });
|
|
808
747
|
expect(result).toMatchSnapshot();
|
|
809
748
|
});
|
|
810
749
|
it('should handle different device pixel ratios', async () => {
|
|
811
|
-
const result = await cropAndConvertToDataURL({
|
|
812
|
-
...defaultCropOptions,
|
|
813
|
-
addIOSBezelCorners: true,
|
|
814
|
-
devicePixelRatio: 2,
|
|
815
|
-
isIOS: true,
|
|
816
|
-
});
|
|
817
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
818
|
-
expect(mockCroppedImage.getBase64.mock.calls).toMatchSnapshot();
|
|
750
|
+
const result = await cropAndConvertToDataURL({ ...defaultCropOptions, addIOSBezelCorners: true, devicePixelRatio: 2, isIOS: true });
|
|
819
751
|
expect(result).toMatchSnapshot();
|
|
820
752
|
});
|
|
821
753
|
});
|
|
822
754
|
describe('makeCroppedBase64Image', () => {
|
|
823
755
|
let getBase64ScreenshotSizeMock;
|
|
824
|
-
let mockImage;
|
|
825
|
-
let mockCroppedImage;
|
|
826
756
|
const defaultCropOptions = {
|
|
827
757
|
addIOSBezelCorners: false,
|
|
828
758
|
base64Image: 'originalImageData',
|
|
@@ -842,20 +772,6 @@ describe('makeCroppedBase64Image', () => {
|
|
|
842
772
|
beforeEach(async () => {
|
|
843
773
|
const utilsModule = vi.mocked(await import('../helpers/utils.js'));
|
|
844
774
|
getBase64ScreenshotSizeMock = vi.spyOn(utilsModule, 'getBase64ScreenshotSize');
|
|
845
|
-
mockCroppedImage = {
|
|
846
|
-
getBase64: vi.fn().mockResolvedValue('data:image/png;base64,finalCroppedImageData'),
|
|
847
|
-
composite: vi.fn().mockReturnThis(),
|
|
848
|
-
opacity: vi.fn().mockReturnThis(),
|
|
849
|
-
};
|
|
850
|
-
mockImage = {
|
|
851
|
-
crop: vi.fn().mockReturnValue(mockCroppedImage),
|
|
852
|
-
composite: vi.fn().mockReturnThis(),
|
|
853
|
-
getBase64: vi.fn().mockResolvedValue('data:image/png;base64,mockImageData'),
|
|
854
|
-
opacity: vi.fn().mockReturnThis(),
|
|
855
|
-
rotate: vi.fn().mockReturnThis(),
|
|
856
|
-
};
|
|
857
|
-
const jimpModule = vi.mocked(await import('jimp'));
|
|
858
|
-
vi.spyOn(jimpModule.Jimp, 'read').mockResolvedValue(mockImage);
|
|
859
775
|
getBase64ScreenshotSizeMock.mockReturnValue({ width: 1000, height: 2000 });
|
|
860
776
|
});
|
|
861
777
|
afterEach(() => {
|
|
@@ -864,8 +780,6 @@ describe('makeCroppedBase64Image', () => {
|
|
|
864
780
|
it('should create cropped base64 image with default settings', async () => {
|
|
865
781
|
const result = await makeCroppedBase64Image(defaultCropOptions);
|
|
866
782
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
867
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
868
|
-
expect(mockCroppedImage.getBase64.mock.calls).toMatchSnapshot();
|
|
869
783
|
expect(result).toMatchSnapshot();
|
|
870
784
|
});
|
|
871
785
|
it('should handle landscape orientation with rotation', async () => {
|
|
@@ -874,7 +788,6 @@ describe('makeCroppedBase64Image', () => {
|
|
|
874
788
|
isLandscape: true,
|
|
875
789
|
});
|
|
876
790
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
877
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
878
791
|
expect(result).toMatchSnapshot();
|
|
879
792
|
});
|
|
880
793
|
it('should handle web driver element screenshots', async () => {
|
|
@@ -883,7 +796,6 @@ describe('makeCroppedBase64Image', () => {
|
|
|
883
796
|
isWebDriverElementScreenshot: true,
|
|
884
797
|
});
|
|
885
798
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
886
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
887
799
|
expect(result).toMatchSnapshot();
|
|
888
800
|
});
|
|
889
801
|
it('should handle iOS devices with bezel corners', async () => {
|
|
@@ -893,7 +805,6 @@ describe('makeCroppedBase64Image', () => {
|
|
|
893
805
|
isIOS: true,
|
|
894
806
|
});
|
|
895
807
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
896
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
897
808
|
expect(result).toMatchSnapshot();
|
|
898
809
|
});
|
|
899
810
|
it('should handle custom resize dimensions', async () => {
|
|
@@ -902,7 +813,6 @@ describe('makeCroppedBase64Image', () => {
|
|
|
902
813
|
resizeDimensions: { top: 10, right: 20, bottom: 15, left: 5 },
|
|
903
814
|
});
|
|
904
815
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
905
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
906
816
|
expect(result).toMatchSnapshot();
|
|
907
817
|
});
|
|
908
818
|
it('should handle different rectangle dimensions', async () => {
|
|
@@ -916,14 +826,12 @@ describe('makeCroppedBase64Image', () => {
|
|
|
916
826
|
},
|
|
917
827
|
});
|
|
918
828
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
919
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
920
829
|
expect(result).toMatchSnapshot();
|
|
921
830
|
});
|
|
922
831
|
it('should handle different screenshot sizes', async () => {
|
|
923
832
|
getBase64ScreenshotSizeMock.mockReturnValue({ width: 800, height: 600 });
|
|
924
833
|
const result = await makeCroppedBase64Image(defaultCropOptions);
|
|
925
834
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
926
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
927
835
|
expect(result).toMatchSnapshot();
|
|
928
836
|
});
|
|
929
837
|
it('should handle different device pixel ratios', async () => {
|
|
@@ -932,7 +840,6 @@ describe('makeCroppedBase64Image', () => {
|
|
|
932
840
|
devicePixelRatio: 2,
|
|
933
841
|
});
|
|
934
842
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
935
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
936
843
|
expect(result).toMatchSnapshot();
|
|
937
844
|
});
|
|
938
845
|
it('should handle zero rectangle dimensions', async () => {
|
|
@@ -946,7 +853,6 @@ describe('makeCroppedBase64Image', () => {
|
|
|
946
853
|
},
|
|
947
854
|
});
|
|
948
855
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
949
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
950
856
|
expect(result).toMatchSnapshot();
|
|
951
857
|
});
|
|
952
858
|
it('should handle edge case with padding that exceeds image bounds', async () => {
|
|
@@ -961,14 +867,11 @@ describe('makeCroppedBase64Image', () => {
|
|
|
961
867
|
resizeDimensions: { top: 50, right: 100, bottom: 50, left: 50 },
|
|
962
868
|
});
|
|
963
869
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
964
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
965
870
|
expect(result).toMatchSnapshot();
|
|
966
871
|
});
|
|
967
872
|
});
|
|
968
873
|
describe('makeFullPageBase64Image', () => {
|
|
969
874
|
let getBase64ScreenshotSizeMock;
|
|
970
|
-
let mockCanvas;
|
|
971
|
-
let mockImage;
|
|
972
875
|
const defaultScreenshotsData = {
|
|
973
876
|
fullPageHeight: 2000,
|
|
974
877
|
fullPageWidth: 1000,
|
|
@@ -1009,29 +912,6 @@ describe('makeFullPageBase64Image', () => {
|
|
|
1009
912
|
beforeEach(async () => {
|
|
1010
913
|
const utilsModule = vi.mocked(await import('../helpers/utils.js'));
|
|
1011
914
|
getBase64ScreenshotSizeMock = vi.spyOn(utilsModule, 'getBase64ScreenshotSize');
|
|
1012
|
-
mockCanvas = {
|
|
1013
|
-
composite: vi.fn().mockReturnThis(),
|
|
1014
|
-
getBase64: vi.fn().mockResolvedValue('data:image/png;base64,fullPageImageData'),
|
|
1015
|
-
};
|
|
1016
|
-
mockImage = {
|
|
1017
|
-
bitmap: {
|
|
1018
|
-
width: 1000,
|
|
1019
|
-
height: 800,
|
|
1020
|
-
},
|
|
1021
|
-
crop: vi.fn().mockReturnThis(),
|
|
1022
|
-
composite: vi.fn().mockReturnThis(),
|
|
1023
|
-
getBase64: vi.fn().mockResolvedValue('data:image/png;base64,mockImageData'),
|
|
1024
|
-
opacity: vi.fn().mockReturnThis(),
|
|
1025
|
-
rotate: vi.fn().mockReturnThis(),
|
|
1026
|
-
};
|
|
1027
|
-
const jimpModule = vi.mocked(await import('jimp'));
|
|
1028
|
-
vi.spyOn(jimpModule.Jimp, 'read').mockResolvedValue(mockImage);
|
|
1029
|
-
vi.mocked(jimpModule.Jimp).mockImplementation((options) => {
|
|
1030
|
-
if (options && (options.width || options.height)) {
|
|
1031
|
-
return mockCanvas;
|
|
1032
|
-
}
|
|
1033
|
-
return mockImage;
|
|
1034
|
-
});
|
|
1035
915
|
getBase64ScreenshotSizeMock.mockReturnValue({ width: 1000, height: 800 });
|
|
1036
916
|
});
|
|
1037
917
|
afterEach(() => {
|
|
@@ -1040,9 +920,6 @@ describe('makeFullPageBase64Image', () => {
|
|
|
1040
920
|
it('should create full page base64 image with multiple screenshots', async () => {
|
|
1041
921
|
const result = await makeFullPageBase64Image(defaultScreenshotsData, defaultOptions);
|
|
1042
922
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
1043
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
1044
|
-
expect(mockCanvas.composite.mock.calls).toMatchSnapshot();
|
|
1045
|
-
expect(mockCanvas.getBase64.mock.calls).toMatchSnapshot();
|
|
1046
923
|
expect(result).toMatchSnapshot();
|
|
1047
924
|
});
|
|
1048
925
|
it('should handle landscape mode with rotation', async () => {
|
|
@@ -1052,8 +929,6 @@ describe('makeFullPageBase64Image', () => {
|
|
|
1052
929
|
isLandscape: true
|
|
1053
930
|
});
|
|
1054
931
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
1055
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
1056
|
-
expect(mockCanvas.composite.mock.calls).toMatchSnapshot();
|
|
1057
932
|
expect(result).toMatchSnapshot();
|
|
1058
933
|
});
|
|
1059
934
|
it('should handle single screenshot', async () => {
|
|
@@ -1074,8 +949,6 @@ describe('makeFullPageBase64Image', () => {
|
|
|
1074
949
|
};
|
|
1075
950
|
const result = await makeFullPageBase64Image(singleScreenshotData, defaultOptions);
|
|
1076
951
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
1077
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
1078
|
-
expect(mockCanvas.composite.mock.calls).toMatchSnapshot();
|
|
1079
952
|
expect(result).toMatchSnapshot();
|
|
1080
953
|
});
|
|
1081
954
|
it('should handle different device pixel ratios', async () => {
|
|
@@ -1084,8 +957,6 @@ describe('makeFullPageBase64Image', () => {
|
|
|
1084
957
|
devicePixelRatio: 3
|
|
1085
958
|
});
|
|
1086
959
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
1087
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
1088
|
-
expect(mockCanvas.composite.mock.calls).toMatchSnapshot();
|
|
1089
960
|
expect(result).toMatchSnapshot();
|
|
1090
961
|
});
|
|
1091
962
|
it('should handle screenshots with different dimensions', async () => {
|
|
@@ -1118,8 +989,6 @@ describe('makeFullPageBase64Image', () => {
|
|
|
1118
989
|
.mockReturnValueOnce({ width: 1200, height: 900 });
|
|
1119
990
|
const result = await makeFullPageBase64Image(mixedScreenshotsData, defaultOptions);
|
|
1120
991
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
1121
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
1122
|
-
expect(mockCanvas.composite.mock.calls).toMatchSnapshot();
|
|
1123
992
|
expect(result).toMatchSnapshot();
|
|
1124
993
|
});
|
|
1125
994
|
it('should handle screenshots with cropping positions', async () => {
|
|
@@ -1140,8 +1009,6 @@ describe('makeFullPageBase64Image', () => {
|
|
|
1140
1009
|
};
|
|
1141
1010
|
const result = await makeFullPageBase64Image(croppedScreenshotsData, defaultOptions);
|
|
1142
1011
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
1143
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
1144
|
-
expect(mockCanvas.composite.mock.calls).toMatchSnapshot();
|
|
1145
1012
|
expect(result).toMatchSnapshot();
|
|
1146
1013
|
});
|
|
1147
1014
|
it('should handle landscape mode without rotation when width >= height', async () => {
|
|
@@ -1151,8 +1018,6 @@ describe('makeFullPageBase64Image', () => {
|
|
|
1151
1018
|
isLandscape: true
|
|
1152
1019
|
});
|
|
1153
1020
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
1154
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
1155
|
-
expect(mockCanvas.composite.mock.calls).toMatchSnapshot();
|
|
1156
1021
|
expect(result).toMatchSnapshot();
|
|
1157
1022
|
});
|
|
1158
1023
|
it('should handle empty screenshots array', async () => {
|
|
@@ -1163,9 +1028,6 @@ describe('makeFullPageBase64Image', () => {
|
|
|
1163
1028
|
};
|
|
1164
1029
|
const result = await makeFullPageBase64Image(emptyScreenshotsData, defaultOptions);
|
|
1165
1030
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
1166
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
1167
|
-
expect(mockCanvas.composite.mock.calls).toMatchSnapshot();
|
|
1168
|
-
expect(mockCanvas.getBase64.mock.calls).toMatchSnapshot();
|
|
1169
1031
|
expect(result).toMatchSnapshot();
|
|
1170
1032
|
});
|
|
1171
1033
|
it('should handle large canvas dimensions', async () => {
|
|
@@ -1187,8 +1049,6 @@ describe('makeFullPageBase64Image', () => {
|
|
|
1187
1049
|
getBase64ScreenshotSizeMock.mockReturnValue({ width: 3000, height: 2000 });
|
|
1188
1050
|
const result = await makeFullPageBase64Image(largeScreenshotsData, defaultOptions);
|
|
1189
1051
|
expect(getBase64ScreenshotSizeMock.mock.calls).toMatchSnapshot();
|
|
1190
|
-
expect(mockImage.crop.mock.calls).toMatchSnapshot();
|
|
1191
|
-
expect(mockCanvas.composite.mock.calls).toMatchSnapshot();
|
|
1192
1052
|
expect(result).toMatchSnapshot();
|
|
1193
1053
|
});
|
|
1194
1054
|
it('should handle different screenshot data for each iteration', async () => {
|
|
@@ -1198,7 +1058,7 @@ describe('makeFullPageBase64Image', () => {
|
|
|
1198
1058
|
});
|
|
1199
1059
|
it('should handle canvas Y positions correctly', async () => {
|
|
1200
1060
|
const result = await makeFullPageBase64Image(defaultScreenshotsData, defaultOptions);
|
|
1201
|
-
expect(
|
|
1061
|
+
expect(vi.mocked(imageUtils.compositeImage).mock.calls.length).toBeGreaterThan(0);
|
|
1202
1062
|
expect(result).toMatchSnapshot();
|
|
1203
1063
|
});
|
|
1204
1064
|
});
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
*/
|
|
46
46
|
import type { Pixel, WicImageCompareOptions } from 'src/methods/images.interfaces.js';
|
|
47
47
|
import type { BoundingBox, IgnoreBoxes } from './rectangles.interfaces.js';
|
|
48
|
-
import type { CompareData } from '../
|
|
48
|
+
import type { CompareData } from '../pixelmatch/compare.interfaces.js';
|
|
49
49
|
declare function processDiffPixels(diffPixels: Pixel[], proximity: number): BoundingBox[];
|
|
50
50
|
/**
|
|
51
51
|
* Generate and save diff image with bounding boxes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processDiffPixels.d.ts","sourceRoot":"","sources":["../../src/methods/processDiffPixels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"processDiffPixels.d.ts","sourceRoot":"","sources":["../../src/methods/processDiffPixels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAA;AAsFtE,iBAAS,iBAAiB,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,EAAE,CAkHhF;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACrC,IAAI,EAAE,WAAW,EACjB,mBAAmB,EAAE,sBAAsB,EAC3C,YAAY,EAAE,WAAW,EAAE,EAC3B,YAAY,EAAE,MAAM,EACpB,qBAAqB,EAAE,MAAM,GAC9B,OAAO,CAAC;IAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,CAqCpE;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
* [0-0] Number merged: 24
|
|
45
45
|
*/
|
|
46
46
|
import logger from '@wdio/logger';
|
|
47
|
-
import {
|
|
47
|
+
import { savePngBuffer } from './images.js';
|
|
48
|
+
import { compositeImage, createCanvas, encodeImage, setOpacity } from '../utils/imageUtils.js';
|
|
48
49
|
const log = logger('@wdio/visual-service:@wdio/image-comparison-core:pixelDiffProcessing');
|
|
49
50
|
class DisjointSet {
|
|
50
51
|
parent;
|
|
@@ -230,7 +231,15 @@ export async function generateAndSaveDiff(data, imageCompareOptions, ignoredBoxe
|
|
|
230
231
|
if (imageCompareOptions.createJsonReportFiles) {
|
|
231
232
|
diffBoundingBoxes.push(...processDiffPixels(data.diffPixels, imageCompareOptions.diffPixelBoundingBoxProximity));
|
|
232
233
|
}
|
|
233
|
-
|
|
234
|
+
const rawDiff = data.getRawPixels();
|
|
235
|
+
if (ignoredBoxes.length > 0) {
|
|
236
|
+
for (const box of ignoredBoxes) {
|
|
237
|
+
const overlay = createCanvas(box.right - box.left, box.bottom - box.top, 57, 170, 86, 255);
|
|
238
|
+
setOpacity(overlay, 0.5);
|
|
239
|
+
compositeImage(rawDiff, overlay, box.left, box.top);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
await savePngBuffer(encodeImage(rawDiff), diffFilePath);
|
|
234
243
|
log.warn('\x1b[33m%s\x1b[0m', `
|
|
235
244
|
#####################################################################################
|
|
236
245
|
${isDifference ? isDifferenceMessage : debugMessage}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rectangles.d.ts","sourceRoot":"","sources":["../../src/methods/rectangles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rectangles.d.ts","sourceRoot":"","sources":["../../src/methods/rectangles.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACR,+BAA+B,EAC/B,wCAAwC,EACxC,sCAAsC,EACtC,uCAAuC,EACvC,gBAAgB,EAChB,iBAAiB,EACjB,8BAA8B,EAC9B,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,YAAY,EACZ,8BAA8B,EAC9B,qCAAqC,EACxC,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAEvE;;GAEG;AACH,wBAAsB,0BAA0B,CAAC,EAC7C,eAAe,EACf,WAAW,EACX,OAAO,EACP,OAAO,GACV,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA4C/C;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,gBAAgB,CAoCjH;AAED;;GAEG;AACH,wBAAgB,uCAAuC,CAAC,EAAE,gBAAgB,EAAE,OAAO,EAAE,EAAC;IAClF,gBAAgB,EAAE,gBAAgB,C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ED;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,EAAE,SAAS,EAAE,oBAAoB,EAAE,YAAY,EAAE,EAAE,+BAA+B,+BAwBhI;AAuDD;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,8BAA8B,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAgIxH"}
|
|
@@ -125,7 +125,7 @@ export interface PrepareIgnoreRectanglesOptions {
|
|
|
125
125
|
actualFilePath?: string;
|
|
126
126
|
}
|
|
127
127
|
export interface PreparedIgnoreRectangles {
|
|
128
|
-
/** The final ignored boxes
|
|
128
|
+
/** The final ignored boxes for image comparison */
|
|
129
129
|
ignoredBoxes: any[];
|
|
130
130
|
/** Whether any ignore rectangles were found */
|
|
131
131
|
hasIgnoreRectangles: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rectangles.interfaces.d.ts","sourceRoot":"","sources":["../../src/methods/rectangles.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEhE,MAAM,WAAW,iBAAiB;IAC9B,oDAAoD;IACpD,gBAAgB,EAAE,MAAM,CAAC;IACzB,8CAA8C;IAC9C,4BAA4B,EAAE,OAAO,CAAC;IACtC,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,KAAK,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IAC/D,4BAA4B;IAC5B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,mCAAmC;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,gCAAgC;IAChC,UAAU,EAAE,OAAO,CAAC;IACpB,mDAAmD;IACnD,uBAAu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,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACrC,
|
|
1
|
+
{"version":3,"file":"rectangles.interfaces.d.ts","sourceRoot":"","sources":["../../src/methods/rectangles.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEhE,MAAM,WAAW,iBAAiB;IAC9B,oDAAoD;IACpD,gBAAgB,EAAE,MAAM,CAAC;IACzB,8CAA8C;IAC9C,4BAA4B,EAAE,OAAO,CAAC;IACtC,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,KAAK,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IAC/D,4BAA4B;IAC5B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,mCAAmC;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,gCAAgC;IAChC,UAAU,EAAE,OAAO,CAAC;IACpB,mDAAmD;IACnD,uBAAuB,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAC9D,iDAAiD;IACjD,4BAA4B,EAAE,OAAO,CAAC;IACtC,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,+BAA+B,EAAE,OAAO,CAAC;IACzC,mDAAmD;IACnD,uBAAuB,EAAE,MAAM,CAAC;IAChC,gCAAgC;IAChC,UAAU,EAAE,OAAO,CAAC;IACpB,yCAAyC;IACzC,WAAW,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,gBAAiB,SAAQ,aAAa;CAAG;AAE1D,MAAM,MA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