33
44import '@wessberg/pointer-events' ;
55
6- import { ANCHOR_SIZE } from '@geti/smart-tools' ;
6+ import { ANCHOR_SIZE , EditBoundingBox as EditBoundingBoxTool } from '@geti/smart-tools' ;
7+ import { Annotation , RegionOfInterest } from '@geti/smart-tools/types' ;
78import { fireEvent , screen } from '@testing-library/react' ;
89
9- import { Annotation , RegionOfInterest } from '../../../../../core/annotations/annotation.interface' ;
10- import { ShapeType } from '../../../../../core/annotations/shapetype.enum' ;
11- import { getMockedImage , getMockedROI } from '../../../../../test-utils/utils' ;
12- import { AnnotationToolProvider } from '../../../providers/annotation-tool-provider/annotation-tool-provider.component' ;
13- import { annotatorRender as render } from '../../../test-utils/annotator-render' ;
14- import { EditBoundingBox as EditBoundingBoxTool } from './edit-bounding-box.component' ;
10+ import { getMockedImage , getMockedROI } from '../../../../test-utils/utils' ;
11+ import { AnnotationToolProvider } from '../../providers/annotation-tool-provider/annotation-tool-provider.component' ;
12+ import { annotatorRender as render } from '../../test-utils/annotator-render' ;
1513
1614const mockROI = getMockedROI ( { x : 0 , y : 0 , width : 1000 , height : 1000 } ) ;
1715const mockImage = getMockedImage ( mockROI ) ;
@@ -21,7 +19,7 @@ const zoom = 2.0;
2119const renderApp = async (
2220 annotation : Annotation & {
2321 shape : {
24- shapeType : ShapeType . Rect ;
22+ shapeType : 'rect' ;
2523 } ;
2624 } ,
2725 roi ?: RegionOfInterest
@@ -45,7 +43,7 @@ describe('EditRectangleTool', (): void => {
4543 const annotation = {
4644 id : 'rect-1' ,
4745 labels : [ ] ,
48- shape : { shapeType : ShapeType . Rect as const , x : 10 , y : 10 , width : 300 , height : 200 } ,
46+ shape : { shapeType : 'rect' as const , x : 10 , y : 10 , width : 300 , height : 200 } ,
4947 zIndex : 0 ,
5048 isHovered : false ,
5149 isSelected : false ,
@@ -106,7 +104,7 @@ describe('EditRectangleTool', (): void => {
106104 id : 'rect-1' ,
107105 labels : [ ] ,
108106 shape : {
109- shapeType : ShapeType . Rect as const ,
107+ shapeType : 'rect' as const ,
110108 x : iRoi . x ,
111109 y : iRoi . y ,
112110 width : iRoi . width / 2 ,
@@ -207,7 +205,7 @@ describe('EditRectangleTool', (): void => {
207205 { x : shape . x , y : shape . y } ,
208206 { x : 10 , y : 10 } ,
209207 {
210- shapeType : ShapeType . Rect ,
208+ shapeType : 'rect' ,
211209 x : shape . x + 10 ,
212210 y : shape . y + 10 ,
213211 width : shape . width - 10 ,
@@ -219,7 +217,7 @@ describe('EditRectangleTool', (): void => {
219217 { x : shape . x , y : shape . y } ,
220218 { x : - 10 , y : - 10 } ,
221219 {
222- shapeType : ShapeType . Rect ,
220+ shapeType : 'rect' ,
223221 x : shape . x - 10 ,
224222 y : shape . y - 10 ,
225223 width : shape . width + 10 ,
@@ -231,7 +229,7 @@ describe('EditRectangleTool', (): void => {
231229 { x : shape . x + shape . width / 2 , y : shape . y } ,
232230 { x : 10 , y : 10 } ,
233231 {
234- shapeType : ShapeType . Rect ,
232+ shapeType : 'rect' ,
235233 x : shape . x ,
236234 y : shape . y + 10 ,
237235 width : shape . width ,
@@ -243,7 +241,7 @@ describe('EditRectangleTool', (): void => {
243241 { x : shape . x , y : shape . y } ,
244242 { x : - 10 , y : - 10 } ,
245243 {
246- shapeType : ShapeType . Rect ,
244+ shapeType : 'rect' ,
247245 x : shape . x ,
248246 y : shape . y - 10 ,
249247 width : shape . width ,
@@ -255,7 +253,7 @@ describe('EditRectangleTool', (): void => {
255253 { x : shape . x + shape . width , y : shape . y } ,
256254 { x : 10 , y : 10 } ,
257255 {
258- shapeType : ShapeType . Rect ,
256+ shapeType : 'rect' ,
259257 x : shape . x ,
260258 y : shape . y + 10 ,
261259 width : shape . width + 10 ,
@@ -267,7 +265,7 @@ describe('EditRectangleTool', (): void => {
267265 { x : shape . x + shape . width , y : shape . y } ,
268266 { x : - 10 , y : - 10 } ,
269267 {
270- shapeType : ShapeType . Rect ,
268+ shapeType : 'rect' ,
271269 x : shape . x ,
272270 y : shape . y - 10 ,
273271 width : shape . width - 10 ,
@@ -279,7 +277,7 @@ describe('EditRectangleTool', (): void => {
279277 { x : shape . x + shape . width , y : shape . y + shape . height / 2 } ,
280278 { x : 10 , y : 10 } ,
281279 {
282- shapeType : ShapeType . Rect ,
280+ shapeType : 'rect' ,
283281 x : shape . x ,
284282 y : shape . y ,
285283 width : shape . width + 10 ,
@@ -291,7 +289,7 @@ describe('EditRectangleTool', (): void => {
291289 { x : shape . x + shape . width , y : shape . y + shape . height / 2 } ,
292290 { x : - 10 , y : - 10 } ,
293291 {
294- shapeType : ShapeType . Rect ,
292+ shapeType : 'rect' ,
295293 x : shape . x ,
296294 y : shape . y ,
297295 width : shape . width - 10 ,
@@ -303,7 +301,7 @@ describe('EditRectangleTool', (): void => {
303301 { x : shape . x + shape . width , y : shape . y + shape . height } ,
304302 { x : 10 , y : 10 } ,
305303 {
306- shapeType : ShapeType . Rect ,
304+ shapeType : 'rect' ,
307305 x : shape . x ,
308306 y : shape . y ,
309307 width : shape . width + 10 ,
@@ -315,7 +313,7 @@ describe('EditRectangleTool', (): void => {
315313 { x : shape . x + shape . width , y : shape . y + shape . height } ,
316314 { x : - 10 , y : - 10 } ,
317315 {
318- shapeType : ShapeType . Rect ,
316+ shapeType : 'rect' ,
319317 x : shape . x ,
320318 y : shape . y ,
321319 width : shape . width - 10 ,
@@ -327,7 +325,7 @@ describe('EditRectangleTool', (): void => {
327325 { x : shape . x + shape . width / 2 , y : shape . y + shape . height } ,
328326 { x : 10 , y : 10 } ,
329327 {
330- shapeType : ShapeType . Rect ,
328+ shapeType : 'rect' ,
331329 x : shape . x ,
332330 y : shape . y ,
333331 width : shape . width ,
@@ -339,7 +337,7 @@ describe('EditRectangleTool', (): void => {
339337 { x : shape . x + shape . width / 2 , y : shape . y + shape . height } ,
340338 { x : - 10 , y : - 10 } ,
341339 {
342- shapeType : ShapeType . Rect ,
340+ shapeType : 'rect' ,
343341 x : shape . x ,
344342 y : shape . y ,
345343 width : shape . width ,
@@ -351,7 +349,7 @@ describe('EditRectangleTool', (): void => {
351349 { x : shape . x , y : shape . y + shape . height } ,
352350 { x : 10 , y : 10 } ,
353351 {
354- shapeType : ShapeType . Rect ,
352+ shapeType : 'rect' ,
355353 x : shape . x + 10 ,
356354 y : shape . y ,
357355 width : shape . width - 10 ,
@@ -363,7 +361,7 @@ describe('EditRectangleTool', (): void => {
363361 { x : shape . x , y : shape . y + shape . height } ,
364362 { x : - 10 , y : - 10 } ,
365363 {
366- shapeType : ShapeType . Rect ,
364+ shapeType : 'rect' ,
367365 x : shape . x - 10 ,
368366 y : shape . y ,
369367 width : shape . width + 10 ,
@@ -375,7 +373,7 @@ describe('EditRectangleTool', (): void => {
375373 { x : shape . x , y : shape . y + shape . height / 2 } ,
376374 { x : 10 , y : 10 } ,
377375 {
378- shapeType : ShapeType . Rect ,
376+ shapeType : 'rect' ,
379377 x : shape . x + 10 ,
380378 y : shape . y ,
381379 width : shape . width - 10 ,
@@ -387,7 +385,7 @@ describe('EditRectangleTool', (): void => {
387385 { x : shape . x , y : shape . y + shape . height / 2 } ,
388386 { x : - 10 , y : - 10 } ,
389387 {
390- shapeType : ShapeType . Rect ,
388+ shapeType : 'rect' ,
391389 x : shape . x - 10 ,
392390 y : shape . y ,
393391 width : shape . width + 10 ,
@@ -400,7 +398,7 @@ describe('EditRectangleTool', (): void => {
400398 { x : shape . x , y : shape . y } ,
401399 { x : - 20 , y : - 20 } ,
402400 {
403- shapeType : ShapeType . Rect ,
401+ shapeType : 'rect' ,
404402 x : 0 ,
405403 y : 0 ,
406404 width : shape . width + shape . x ,
@@ -412,7 +410,7 @@ describe('EditRectangleTool', (): void => {
412410 { x : shape . x + shape . width / 2 , y : shape . y } ,
413411 { x : 10 , y : - 20 } ,
414412 {
415- shapeType : ShapeType . Rect ,
413+ shapeType : 'rect' ,
416414 x : shape . x ,
417415 y : 0 ,
418416 width : shape . width ,
@@ -424,7 +422,7 @@ describe('EditRectangleTool', (): void => {
424422 { x : shape . x + shape . width , y : shape . y } ,
425423 { x : mockROI . width , y : - 10 } ,
426424 {
427- shapeType : ShapeType . Rect ,
425+ shapeType : 'rect' ,
428426 x : shape . x ,
429427 y : 0 ,
430428 width : mockROI . width - shape . x ,
@@ -436,7 +434,7 @@ describe('EditRectangleTool', (): void => {
436434 { x : shape . x + shape . width , y : shape . y + shape . height / 2 } ,
437435 { x : mockROI . width , y : 10 } ,
438436 {
439- shapeType : ShapeType . Rect ,
437+ shapeType : 'rect' ,
440438 x : shape . x ,
441439 y : shape . y ,
442440 width : mockROI . width - shape . x ,
@@ -448,7 +446,7 @@ describe('EditRectangleTool', (): void => {
448446 { x : shape . x + shape . width , y : shape . y + shape . height } ,
449447 { x : mockROI . width , y : mockROI . height } ,
450448 {
451- shapeType : ShapeType . Rect ,
449+ shapeType : 'rect' ,
452450 x : shape . x ,
453451 y : shape . y ,
454452 width : mockROI . width - shape . x ,
@@ -460,7 +458,7 @@ describe('EditRectangleTool', (): void => {
460458 { x : shape . x + shape . width / 2 , y : shape . y + shape . height } ,
461459 { x : 10 , y : mockROI . height } ,
462460 {
463- shapeType : ShapeType . Rect ,
461+ shapeType : 'rect' ,
464462 x : shape . x ,
465463 y : shape . y ,
466464 width : shape . width ,
@@ -472,7 +470,7 @@ describe('EditRectangleTool', (): void => {
472470 { x : shape . x , y : shape . y + shape . height } ,
473471 { x : - mockROI . width , y : mockROI . height } ,
474472 {
475- shapeType : ShapeType . Rect ,
473+ shapeType : 'rect' ,
476474 x : 0 ,
477475 y : shape . y ,
478476 width : shape . width + shape . x ,
@@ -484,7 +482,7 @@ describe('EditRectangleTool', (): void => {
484482 { x : shape . x , y : shape . y + shape . height / 2 } ,
485483 { x : - mockROI . width , y : mockROI . height } ,
486484 {
487- shapeType : ShapeType . Rect ,
485+ shapeType : 'rect' ,
488486 x : 0 ,
489487 y : shape . y ,
490488 width : shape . width + shape . x ,
@@ -527,7 +525,7 @@ describe('EditRectangleTool', (): void => {
527525 const gap = ( 2 * ANCHOR_SIZE ) / zoom ;
528526 const startPoint = { x : shape . x , y : shape . y } ;
529527 const expectedRect = {
530- shapeType : ShapeType . Rect ,
528+ shapeType : 'rect' ,
531529 x : shape . x + shape . width - gap ,
532530 y : shape . y + shape . height - gap ,
533531 width : gap ,
0 commit comments