1
1
import type { WaferMap } from '..' ;
2
2
import { Computations } from '../modules/computations' ;
3
3
import { Margin , WaferMapOriginLocation } from '../types' ;
4
- import { getWaferMapDies } from './utilities' ;
4
+ import { getWaferMapMockComputations , getWaferMapDies } from './utilities' ;
5
5
6
6
describe ( 'Wafermap Computations module' , ( ) => {
7
7
let computationsModule : Computations ;
@@ -14,20 +14,12 @@ describe('Wafermap Computations module', () => {
14
14
left : 4
15
15
} ;
16
16
beforeEach ( ( ) => {
17
- const waferMock : Pick <
18
- WaferMap ,
19
- | 'dies'
20
- | 'originLocation'
21
- | 'canvasWidth'
22
- | 'canvasHeight'
23
- | 'validity'
24
- > = {
25
- dies : getWaferMapDies ( ) ,
26
- originLocation : WaferMapOriginLocation . topLeft ,
27
- canvasWidth : 100 ,
28
- canvasHeight : 100 ,
29
- validity : { invalidGridDimensions : false }
30
- } ;
17
+ const waferMock = getWaferMapMockComputations (
18
+ getWaferMapDies ( ) ,
19
+ WaferMapOriginLocation . topLeft ,
20
+ 100 ,
21
+ 100
22
+ ) ;
31
23
computationsModule = new Computations ( waferMock as WaferMap ) ;
32
24
computationsModule . updateContainerDimensions ( ) ;
33
25
} ) ;
@@ -72,20 +64,12 @@ describe('Wafermap Computations module', () => {
72
64
73
65
describe ( 'with rectangular canvas' , ( ) => {
74
66
beforeEach ( ( ) => {
75
- const waferMock : Pick <
76
- WaferMap ,
77
- | 'dies'
78
- | 'originLocation'
79
- | 'canvasWidth'
80
- | 'canvasHeight'
81
- | 'validity'
82
- > = {
83
- dies : getWaferMapDies ( ) ,
84
- originLocation : WaferMapOriginLocation . topLeft ,
85
- canvasWidth : 200 ,
86
- canvasHeight : 100 ,
87
- validity : { invalidGridDimensions : false }
88
- } ;
67
+ const waferMock = getWaferMapMockComputations (
68
+ getWaferMapDies ( ) ,
69
+ WaferMapOriginLocation . topLeft ,
70
+ 200 ,
71
+ 100
72
+ ) ;
89
73
computationsModule = new Computations ( waferMock as WaferMap ) ;
90
74
computationsModule . updateContainerDimensions ( ) ;
91
75
} ) ;
@@ -124,20 +108,12 @@ describe('Wafermap Computations module', () => {
124
108
125
109
describe ( 'with top left originLocation' , ( ) => {
126
110
beforeEach ( ( ) => {
127
- const waferMock : Pick <
128
- WaferMap ,
129
- | 'dies'
130
- | 'originLocation'
131
- | 'canvasWidth'
132
- | 'canvasHeight'
133
- | 'validity'
134
- > = {
135
- dies : getWaferMapDies ( ) ,
136
- originLocation : WaferMapOriginLocation . topLeft ,
137
- canvasWidth : 100 ,
138
- canvasHeight : 100 ,
139
- validity : { invalidGridDimensions : false }
140
- } ;
111
+ const waferMock = getWaferMapMockComputations (
112
+ getWaferMapDies ( ) ,
113
+ WaferMapOriginLocation . topLeft ,
114
+ 100 ,
115
+ 100
116
+ ) ;
141
117
computationsModule = new Computations ( waferMock as WaferMap ) ;
142
118
computationsModule . updateContainerDimensions ( ) ;
143
119
} ) ;
@@ -146,27 +122,20 @@ describe('Wafermap Computations module', () => {
146
122
expect ( computationsModule . horizontalScale . range ( ) ) . toEqual ( [ 0 , 92 ] ) ;
147
123
} ) ;
148
124
149
- it ( 'should have decreasing vertical range' , ( ) => {
150
- expect ( computationsModule . verticalScale . range ( ) ) . toEqual ( [ 92 , 0 ] ) ;
125
+ it ( 'should have increasing vertical range' , ( ) => {
126
+ // because the canvas has top-left origin location we need to flip the vertical scale
127
+ expect ( computationsModule . verticalScale . range ( ) ) . toEqual ( [ 0 , 92 ] ) ;
151
128
} ) ;
152
129
} ) ;
153
130
154
131
describe ( 'with top right originLocation' , ( ) => {
155
132
beforeEach ( ( ) => {
156
- const waferMock : Pick <
157
- WaferMap ,
158
- | 'dies'
159
- | 'originLocation'
160
- | 'canvasWidth'
161
- | 'canvasHeight'
162
- | 'validity'
163
- > = {
164
- dies : getWaferMapDies ( ) ,
165
- originLocation : WaferMapOriginLocation . topRight ,
166
- canvasWidth : 100 ,
167
- canvasHeight : 100 ,
168
- validity : { invalidGridDimensions : false }
169
- } ;
133
+ const waferMock = getWaferMapMockComputations (
134
+ getWaferMapDies ( ) ,
135
+ WaferMapOriginLocation . topRight ,
136
+ 100 ,
137
+ 100
138
+ ) ;
170
139
computationsModule = new Computations ( waferMock as WaferMap ) ;
171
140
computationsModule . updateContainerDimensions ( ) ;
172
141
} ) ;
@@ -175,27 +144,20 @@ describe('Wafermap Computations module', () => {
175
144
expect ( computationsModule . horizontalScale . range ( ) ) . toEqual ( [ 92 , 0 ] ) ;
176
145
} ) ;
177
146
178
- it ( 'should have decreasing vertical range' , ( ) => {
179
- expect ( computationsModule . verticalScale . range ( ) ) . toEqual ( [ 92 , 0 ] ) ;
147
+ it ( 'should have increasing vertical range' , ( ) => {
148
+ // because the canvas has top-left origin location we need to flip the vertical scale
149
+ expect ( computationsModule . verticalScale . range ( ) ) . toEqual ( [ 0 , 92 ] ) ;
180
150
} ) ;
181
151
} ) ;
182
152
183
153
describe ( 'with bottom left originLocation' , ( ) => {
184
154
beforeEach ( ( ) => {
185
- const waferMock : Pick <
186
- WaferMap ,
187
- | 'dies'
188
- | 'originLocation'
189
- | 'canvasWidth'
190
- | 'canvasHeight'
191
- | 'validity'
192
- > = {
193
- dies : getWaferMapDies ( ) ,
194
- originLocation : WaferMapOriginLocation . bottomLeft ,
195
- canvasWidth : 100 ,
196
- canvasHeight : 100 ,
197
- validity : { invalidGridDimensions : false }
198
- } ;
155
+ const waferMock = getWaferMapMockComputations (
156
+ getWaferMapDies ( ) ,
157
+ WaferMapOriginLocation . bottomLeft ,
158
+ 100 ,
159
+ 100
160
+ ) ;
199
161
computationsModule = new Computations ( waferMock as WaferMap ) ;
200
162
computationsModule . updateContainerDimensions ( ) ;
201
163
} ) ;
@@ -204,27 +166,20 @@ describe('Wafermap Computations module', () => {
204
166
expect ( computationsModule . horizontalScale . range ( ) ) . toEqual ( [ 0 , 92 ] ) ;
205
167
} ) ;
206
168
207
- it ( 'should have increasing vertical range' , ( ) => {
208
- expect ( computationsModule . verticalScale . range ( ) ) . toEqual ( [ 0 , 92 ] ) ;
169
+ it ( 'should have decreasing vertical range' , ( ) => {
170
+ // because the canvas has top-left origin location we need to flip the vertical scale
171
+ expect ( computationsModule . verticalScale . range ( ) ) . toEqual ( [ 92 , 0 ] ) ;
209
172
} ) ;
210
173
} ) ;
211
174
212
175
describe ( 'with bottom right originLocation' , ( ) => {
213
176
beforeEach ( ( ) => {
214
- const waferMock : Pick <
215
- WaferMap ,
216
- | 'dies'
217
- | 'originLocation'
218
- | 'canvasWidth'
219
- | 'canvasHeight'
220
- | 'validity'
221
- > = {
222
- dies : getWaferMapDies ( ) ,
223
- originLocation : WaferMapOriginLocation . bottomRight ,
224
- canvasWidth : 100 ,
225
- canvasHeight : 100 ,
226
- validity : { invalidGridDimensions : false }
227
- } ;
177
+ const waferMock = getWaferMapMockComputations (
178
+ getWaferMapDies ( ) ,
179
+ WaferMapOriginLocation . bottomRight ,
180
+ 100 ,
181
+ 100
182
+ ) ;
228
183
computationsModule = new Computations ( waferMock as WaferMap ) ;
229
184
computationsModule . updateContainerDimensions ( ) ;
230
185
} ) ;
@@ -233,8 +188,9 @@ describe('Wafermap Computations module', () => {
233
188
expect ( computationsModule . horizontalScale . range ( ) ) . toEqual ( [ 92 , 0 ] ) ;
234
189
} ) ;
235
190
236
- it ( 'should have increasing vertical range' , ( ) => {
237
- expect ( computationsModule . verticalScale . range ( ) ) . toEqual ( [ 0 , 92 ] ) ;
191
+ it ( 'should have decreasing vertical range' , ( ) => {
192
+ // because the canvas has top-left origin location we need to flip the vertical scale
193
+ expect ( computationsModule . verticalScale . range ( ) ) . toEqual ( [ 92 , 0 ] ) ;
238
194
} ) ;
239
195
} ) ;
240
196
} ) ;
0 commit comments