@@ -7,10 +7,9 @@ import { ImageHelper } from "./image-helper";
7
7
8
8
export function loadFrameComparer ( nsCapabilities : INsCapabilities ) {
9
9
try {
10
- const frameComparer = frComparer . createFrameComparer ( ) ;
11
10
const storage = getStorageByDeviceName ( nsCapabilities ) ;
12
11
const logPath = getReportPath ( nsCapabilities ) ;
13
- return new FrameComparer ( nsCapabilities , storage , logPath , frameComparer ) ;
12
+ return new FrameComparer ( nsCapabilities , storage , logPath ) ;
14
13
} catch ( error ) {
15
14
console . error ( "In order to use frame comaprer, please read carefully https://github.com/SvetoslavTsenov/frame-comparer/blob/master/README.md for dependecies that are required!" ) ;
16
15
}
@@ -20,25 +19,25 @@ export class FrameComparer {
20
19
private _framesGeneralName : string = "frame" ;
21
20
private _cropImageRect : IRectangle ;
22
21
23
- constructor ( private _nsCapabilities : INsCapabilities , private _storage : string , private _logPath : string , private _frameComparer : frComparer . FrameComparer ) {
22
+ constructor ( private _nsCapabilities : INsCapabilities , private _storage : string , private _logPath : string ) {
24
23
this . _cropImageRect = ImageHelper . cropImageDefault ( this . _nsCapabilities ) ;
25
24
}
26
25
27
26
async processVideo ( videoFullName , framesGeneralName ?: string , videoTempStorage = "tempFramesFolder" ) {
28
27
this . _framesGeneralName = framesGeneralName || this . _framesGeneralName ;
29
28
this . _framesGeneralName = this . _framesGeneralName . replace ( / \s / gi, "" ) ;
30
- await this . _frameComparer . processVideo ( videoFullName , videoTempStorage , this . _framesGeneralName ) ;
29
+ return await frComparer . FrameComparer . processVideo ( videoFullName , videoTempStorage , this . _framesGeneralName ) ;
31
30
}
32
31
33
- async compareFrameRanges ( imageFrameCount : number , startRange , endRange , logImageComparisonResults : boolean = false , tollerancePixels = 0.1 , verbose = false ) : Promise < boolean > {
34
- const result = await this . _frameComparer . compareImageFromVideo ( resolve ( this . _storage , `${ this . _framesGeneralName } ${ imageFrameCount } .png` ) , this . _logPath , startRange , endRange , tollerancePixels , this . _cropImageRect , true , logImageComparisonResults , verbose ) ;
32
+ async compareFrameRanges ( frames : Array < string > , imageFrameCount : number , startRange , endRange , logImageComparisonResults : boolean = false , tollerancePixels = 0.1 , verbose = false ) : Promise < boolean > {
33
+ const result = await frComparer . FrameComparer . compareImageFromVideo ( frames , resolve ( this . _storage , `${ this . _framesGeneralName } ${ imageFrameCount } .png` ) , this . _logPath , startRange , endRange , tollerancePixels , true , logImageComparisonResults , this . _cropImageRect , verbose ) ;
35
34
return result ;
36
35
}
37
36
38
- async compareFrames ( imageFrameCount : number , tolleranceRange = 3 , tollerancePixels = 0.1 , logImageComparisonResults : boolean = false , verbose = false ) : Promise < boolean > {
37
+ async compareFrames ( frames : Array < string > , imageFrameCount : number , tolleranceRange = 3 , tollerancePixels = 0.1 , logImageComparisonResults : boolean = false , verbose = false ) : Promise < boolean > {
39
38
const start = imageFrameCount - tolleranceRange > 0 ? imageFrameCount - tolleranceRange : 0 ;
40
39
const end = imageFrameCount + tolleranceRange ;
41
- const result = await this . compareFrameRanges ( imageFrameCount , start , end , logImageComparisonResults , tollerancePixels )
40
+ const result = await this . compareFrameRanges ( frames , imageFrameCount , start , end , logImageComparisonResults , tollerancePixels )
42
41
return result ;
43
42
}
44
43
}
0 commit comments