From 9a018cc4e03e04e2efaff9f330ba3e58f8f5295d Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin <33020454+dvkruchinin@users.noreply.github.com> Date: Mon, 17 May 2021 12:13:29 +0300 Subject: [PATCH] Cypress test. Cropping polygon in some corner cases. (#3196) --- ...7_cropping_polygon_in_some_corner_cases.js | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 tests/cypress/integration/actions_objects2/case_77_cropping_polygon_in_some_corner_cases.js diff --git a/tests/cypress/integration/actions_objects2/case_77_cropping_polygon_in_some_corner_cases.js b/tests/cypress/integration/actions_objects2/case_77_cropping_polygon_in_some_corner_cases.js new file mode 100644 index 00000000..708be4b2 --- /dev/null +++ b/tests/cypress/integration/actions_objects2/case_77_cropping_polygon_in_some_corner_cases.js @@ -0,0 +1,59 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { labelName, taskName } from '../../support/const'; + +context('Cropping polygon in some corner cases.', () => { + const caseId = '77'; + const createPolygonShapeRightSide = { + reDraw: false, + type: 'Shape', + labelName: labelName, + pointsMap: [ + { x: 500, y: 120 }, + { x: 900, y: 10 }, + { x: 850, y: 800 }, + { x: 500, y: 750 }, + ], + complete: true, + numberOfPoints: null, + }; + + const createPolygonShapeLeftSide = { + reDraw: false, + type: 'Shape', + labelName: labelName, + pointsMap: [ + { x: 500, y: 120 }, + { x: 30, y: 10 }, + { x: 50, y: 800 }, + { x: 500, y: 750 }, + ], + complete: true, + numberOfPoints: null, + }; + + before(() => { + cy.openTask(taskName); + cy.openJob(); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Checking the right side of the canvas.', () => { + cy.get('.cvat-canvas-container').trigger('wheel', { deltaY: 5 }).trigger('wheel', { deltaY: 5 }); + cy.createPolygon(createPolygonShapeRightSide); + cy.get('.cvat-canvas-container').trigger('mousemove', 650, 250); // Hover over a point that was free of the shape before the fix + cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated'); + }); + + it('Checking the lift side of the canvas.', () => { + cy.removeAnnotations(); + cy.createPolygon(createPolygonShapeLeftSide); + cy.get('.cvat-canvas-container').trigger('mousemove', 300, 250); // Hover over a point that was free of the shape before the fix + cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated'); + }); + }); +});