Skip to content

Commit 9e3e30c

Browse files
feat: block out image are not to compare (#61)
1 parent 8553607 commit 9e3e30c

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

lib/image-helper.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@ import { INsCapabilities } from "./ins-capabilities";
33
export declare class ImageHelper {
44
private _args;
55
private _cropImageRec;
6+
private _blockOutAreas;
67
constructor(_args: INsCapabilities);
78
cropImageRec: {
89
x: number;
910
y: number;
1011
width: number;
1112
height: number;
1213
};
14+
blockOutAreas: {
15+
x: number;
16+
y: number;
17+
width: number;
18+
height: number;
19+
}[];
1320
imageOutputLimit(): ImageOptions;
1421
thresholdType(): ImageOptions;
1522
threshold(): number;

lib/image-helper.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { INsCapabilities } from "./ins-capabilities";
55
export class ImageHelper {
66

77
private _cropImageRec: { x: number, y: number, width: number, height: number };
8-
8+
private _blockOutAreas: { x: number, y: number, width: number, height: number }[];
9+
910
constructor(private _args: INsCapabilities) {
1011
}
1112

@@ -17,6 +18,14 @@ export class ImageHelper {
1718
this._cropImageRec = rect;
1819
}
1920

21+
get blockOutAreas() {
22+
return this._blockOutAreas;
23+
}
24+
25+
set blockOutAreas(rectangles: { x: number, y: number, width: number, height: number }[]) {
26+
this._blockOutAreas = rectangles;
27+
}
28+
2029
public imageOutputLimit() {
2130
return ImageOptions.outputAll;
2231
}
@@ -38,7 +47,7 @@ export class ImageHelper {
3847
}
3948

4049
public static cropImageDefaultParams(_args: INsCapabilities) {
41-
return { x: 0, y: ImageHelper.getOffsetPixels(_args)};
50+
return { x: 0, y: ImageHelper.getOffsetPixels(_args) };
4251
}
4352

4453
private runDiff(diffOptions: blinkDiff, diffImage: string) {
@@ -80,9 +89,12 @@ export class ImageHelper {
8089

8190
cropImageA: rectToCrop,
8291
cropImageB: rectToCrop,
92+
blockOut: this._blockOutAreas,
8393
verbose: this._args.verbose,
8494
});
8595

86-
return this.runDiff(diff, output);
96+
const result = this.runDiff(diff, output);
97+
this._blockOutAreas = undefined;
98+
return result;
8799
}
88100
}

0 commit comments

Comments
 (0)