1
- import { NativeAdapter } from "./adapter/native.adapter.class" ;
2
- import { VisionAdapter } from "./adapter/vision.adapter.class" ;
3
- import { Image } from "./image.class" ;
4
- import { LocationParameters } from "./locationparameters.class" ;
5
- import { MatchRequest } from "./match-request.class" ;
6
- import { MatchResult } from "./match-result.class" ;
7
- import { Region } from "./region.class" ;
8
- import { Screen } from "./screen.class" ;
1
+ import { VisionAdapter } from "./adapter/vision.adapter.class" ;
2
+ import { Image } from "./image.class" ;
3
+ import { LocationParameters } from "./locationparameters.class" ;
4
+ import { MatchRequest } from "./match-request.class" ;
5
+ import { MatchResult } from "./match-result.class" ;
6
+ import { Region } from "./region.class" ;
7
+ import { Screen } from "./screen.class" ;
9
8
10
9
jest . mock ( "./adapter/native.adapter.class" ) ;
11
10
jest . mock ( "./adapter/vision.adapter.class" ) ;
12
11
13
12
const searchRegion = new Region ( 0 , 0 , 100 , 100 ) ;
14
13
15
14
beforeAll ( ( ) => {
16
- NativeAdapter . prototype . grabScreen = jest . fn ( ( ) => {
15
+ VisionAdapter . prototype . grabScreen = jest . fn ( ( ) => {
17
16
return new Image ( searchRegion . width , searchRegion . height , new ArrayBuffer ( 0 ) , 3 ) ;
18
17
} ) ;
19
18
20
- NativeAdapter . prototype . screenSize = jest . fn ( ( ) => {
19
+ VisionAdapter . prototype . screenSize = jest . fn ( ( ) => {
21
20
return searchRegion ;
22
21
} ) ;
23
22
} ) ;
@@ -31,9 +30,8 @@ describe("Screen.", () => {
31
30
} ) ;
32
31
33
32
const visionAdapterMock = new VisionAdapter ( ) ;
34
- const nativeAdapterMock = new NativeAdapter ( ) ;
35
33
36
- const SUT = new Screen ( visionAdapterMock , nativeAdapterMock ) ;
34
+ const SUT = new Screen ( visionAdapterMock ) ;
37
35
const imagePath = "test/path/to/image.png" ;
38
36
await expect ( SUT . findOnScreen ( imagePath ) ) . resolves . toEqual ( matchResult . location ) ;
39
37
const matchRequest = new MatchRequest (
@@ -53,9 +51,8 @@ describe("Screen.", () => {
53
51
} ) ;
54
52
55
53
const visionAdapterMock = new VisionAdapter ( ) ;
56
- const nativeAdapterMock = new NativeAdapter ( ) ;
57
54
58
- const SUT = new Screen ( visionAdapterMock , nativeAdapterMock ) ;
55
+ const SUT = new Screen ( visionAdapterMock ) ;
59
56
const imagePath = "test/path/to/image.png" ;
60
57
await expect ( SUT . findOnScreen ( imagePath ) )
61
58
. rejects
@@ -71,9 +68,8 @@ describe("Screen.", () => {
71
68
} ) ;
72
69
73
70
const visionAdapterMock = new VisionAdapter ( ) ;
74
- const nativeAdapterMock = new NativeAdapter ( ) ;
75
71
76
- const SUT = new Screen ( visionAdapterMock , nativeAdapterMock ) ;
72
+ const SUT = new Screen ( visionAdapterMock ) ;
77
73
78
74
const imagePath = "test/path/to/image.png" ;
79
75
const parameters = new LocationParameters ( undefined , minMatch ) ;
@@ -96,9 +92,8 @@ describe("Screen.", () => {
96
92
} ) ;
97
93
98
94
const visionAdapterMock = new VisionAdapter ( ) ;
99
- const nativeAdapterMock = new NativeAdapter ( ) ;
100
95
101
- const SUT = new Screen ( visionAdapterMock , nativeAdapterMock ) ;
96
+ const SUT = new Screen ( visionAdapterMock ) ;
102
97
103
98
const imagePath = "test/path/to/image.png" ;
104
99
const parameters = new LocationParameters ( customSearchRegion ) ;
@@ -122,9 +117,8 @@ describe("Screen.", () => {
122
117
} ) ;
123
118
124
119
const visionAdapterMock = new VisionAdapter ( ) ;
125
- const nativeAdapterMock = new NativeAdapter ( ) ;
126
120
127
- const SUT = new Screen ( visionAdapterMock , nativeAdapterMock ) ;
121
+ const SUT = new Screen ( visionAdapterMock ) ;
128
122
129
123
const imagePath = "test/path/to/image.png" ;
130
124
const parameters = new LocationParameters ( customSearchRegion , minMatch ) ;
0 commit comments