Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test to check "Remove underlying pixels" tool #7684

Merged
merged 5 commits into from
Mar 27, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion tests/cypress/e2e/features/masks_basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,39 @@ context('Manipulations with masks', { scrollBehavior: false }, () => {
cy.drawMask(editingActions);
cy.finishMaskDrawing();
});

it('Underlying pixels are removed on enabling "Remove underlying pixels" tool', () => {
const mask1 = [{
method: 'brush',
coordinates: [[450, 250], [600, 400]],
}];
const mask2 = [{
method: 'brush',
coordinates: [[450, 250], [525, 325]],
}];

cy.startMaskDrawing();
cy.drawMask(mask1);
cy.get('.cvat-brush-tools-continue').click();

cy.drawMask(mask2);
cy.get('.cvat-brush-tools-underlying-pixels').click();
cy.get('.cvat-brush-tools-underlying-pixels').should('have.class', 'cvat-brush-tools-active-tool');
cy.finishMaskDrawing();

cy.get('#cvat-objects-sidebar-state-item-2').within(() => {
cy.get('.cvat-object-item-button-hidden').click();
});

cy.get('.cvat-canvas-container').then(([$canvas]) => {
cy.wrap($canvas).trigger('mousemove', { clientX: 450, clientY: 250, bubbles: true });
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
cy.get('#cvat_canvas_shape_1').should('not.have.class', 'cvat_canvas_shape_activated');

cy.wrap($canvas).trigger('mousemove', { clientX: 550, clientY: 350, bubbles: true });
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated');
});
cy.removeAnnotations();
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
});
});

describe('Tests to make sure that empty masks cannot be created', () => {
Expand Down Expand Up @@ -249,7 +282,11 @@ context('Manipulations with masks', { scrollBehavior: false }, () => {
}]];

cy.startMaskDrawing();
cy.get('.cvat-brush-tools-underlying-pixels').click();
cy.get('.cvat-brush-tools-underlying-pixels').then(($el) => {
if (!$el.hasClass('cvat-brush-tools-active-tool')) {
cy.wrap($el).click();
}
});
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
cy.get('.cvat-brush-tools-underlying-pixels').should('have.class', 'cvat-brush-tools-active-tool');
cy.finishMaskDrawing();

Expand Down
Loading