|
| 1 | +/* |
| 2 | + * Copyright (C) 2020 Intel Corporation |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: MIT |
| 5 | + */ |
| 6 | + |
| 7 | +/// <reference types="cypress" /> |
| 8 | + |
| 9 | +context('Check if the image is rotated', () => { |
| 10 | + |
| 11 | + const caseId = '5' |
| 12 | + const labelName = `Case ${caseId}` |
| 13 | + const taskName = `New annotation task for ${labelName}` |
| 14 | + const attrName = `Attr for ${labelName}` |
| 15 | + const textDefaultValue = 'Some default value for type Text' |
| 16 | + const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}` |
| 17 | + const image = `${imageFileName}.png` |
| 18 | + const width = 800 |
| 19 | + const height = 800 |
| 20 | + const posX = 10 |
| 21 | + const posY = 10 |
| 22 | + const color = 'gray' |
| 23 | + function imageRotate(direction='anticlockwise') { |
| 24 | + cy.get('.cvat-rotate-canvas-control') |
| 25 | + .trigger('mouseover') |
| 26 | + if (direction === 'clockwise') { |
| 27 | + cy.get('.cvat-rotate-canvas-controls-right') |
| 28 | + .click() |
| 29 | + } else { |
| 30 | + cy.get('.cvat-rotate-canvas-controls-left') |
| 31 | + .click() |
| 32 | + } |
| 33 | + } |
| 34 | + |
| 35 | + before(() => { |
| 36 | + cy.visit('auth/login') |
| 37 | + cy.login() |
| 38 | + cy.imageGenerator('cypress/fixtures', image, width, height, color, posX, posY, labelName) |
| 39 | + cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, image) |
| 40 | + cy.openTaskJob(taskName) |
| 41 | + }) |
| 42 | + |
| 43 | + describe(`Testing "${labelName}"`, () => { |
| 44 | + it('Rotate image clockwise 90deg', () => { |
| 45 | + imageRotate('clockwise') |
| 46 | + cy.get('#cvat_canvas_background') |
| 47 | + .should('have.attr', 'style').and('contain', 'rotate(90deg);') |
| 48 | + }) |
| 49 | + it('Rotate image clockwise 180deg', () => { |
| 50 | + imageRotate('clockwise') |
| 51 | + cy.get('#cvat_canvas_background') |
| 52 | + .should('have.attr', 'style').and('contain', 'rotate(180deg);') |
| 53 | + }) |
| 54 | + it('Rotate image clockwise 270deg', () => { |
| 55 | + imageRotate('clockwise') |
| 56 | + cy.get('#cvat_canvas_background') |
| 57 | + .should('have.attr', 'style').and('contain', 'rotate(270deg);') |
| 58 | + }) |
| 59 | + it('Rotate image clockwise 360deg', () => { |
| 60 | + imageRotate('clockwise') |
| 61 | + cy.get('#cvat_canvas_background') |
| 62 | + .should('have.attr', 'style').and('contain', 'rotate(0deg);') |
| 63 | + }) |
| 64 | + it('Rotate image anticlockwise 90deg', () => { |
| 65 | + imageRotate() |
| 66 | + cy.get('#cvat_canvas_background') |
| 67 | + .should('have.attr', 'style').and('contain', 'rotate(270deg);') |
| 68 | + }) |
| 69 | + it('Rotate image anticlockwise 180deg', () => { |
| 70 | + imageRotate() |
| 71 | + cy.get('#cvat_canvas_background') |
| 72 | + .should('have.attr', 'style').and('contain', 'rotate(180deg);') |
| 73 | + }) |
| 74 | + it('Rotate image anticlockwise 270deg', () => { |
| 75 | + imageRotate() |
| 76 | + cy.get('#cvat_canvas_background') |
| 77 | + .should('have.attr', 'style').and('contain', 'rotate(90deg);') |
| 78 | + }) |
| 79 | + it('Rotate image anticlockwise 360deg', () => { |
| 80 | + imageRotate() |
| 81 | + cy.get('#cvat_canvas_background') |
| 82 | + .should('have.attr', 'style').and('contain', 'rotate(0deg);') |
| 83 | + }) |
| 84 | + }) |
| 85 | +}) |
0 commit comments