From bb77816f77936ba86bd773a607731ece7bcd6b9b Mon Sep 17 00:00:00 2001 From: Steve Monnier Date: Fri, 13 Dec 2024 15:36:22 -0500 Subject: [PATCH] [518] Test InteractionContainerMapping on default or additional layer Separate test on InteractionContainerMapping in two classes to test if it is on the default layer (always displayed on diagram opening/creation) on in an additional layer (shown once displayed manually activated). Bug: https://github.com/eclipse-sirius/sirius-desktop/issues/518 Signed-off-by: Steve Monnier --- .../cornerCases/My.interactions | 109 + .../cornerCases/representations.aird | 1197 +++++++++++ .../cornerCases/types.ecore | 20 + .../interactionContainer/interaction.odesign | 1907 +++++++++++++++++ .../lifelines.interactions | 12 + .../interactionContainer/representations.aird | 279 +++ .../sequence/interactionContainer/types.ecore | 20 + ...eractionContainerAdditionalLayerTests.java | 306 +++ ...nteractionContainerDefaultLayerTests.java} | 119 +- .../InteractionContainerFromSampleTests.java | 185 ++ .../swtbot/suite/SequenceSwtBotTestSuite.java | 7 +- 11 files changed, 4127 insertions(+), 34 deletions(-) create mode 100644 plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/cornerCases/My.interactions create mode 100644 plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/cornerCases/representations.aird create mode 100644 plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/cornerCases/types.ecore create mode 100644 plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/interaction.odesign create mode 100644 plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/lifelines.interactions create mode 100644 plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/representations.aird create mode 100644 plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/types.ecore create mode 100644 plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerAdditionalLayerTests.java rename plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/{InteractionContainerTests.java => InteractionContainerDefaultLayerTests.java} (52%) create mode 100644 plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerFromSampleTests.java diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/cornerCases/My.interactions b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/cornerCases/My.interactions new file mode 100644 index 0000000000..fc17a20183 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/cornerCases/My.interactions @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/cornerCases/representations.aird b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/cornerCases/representations.aird new file mode 100644 index 0000000000..6ade2eeef6 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/cornerCases/representations.aird @@ -0,0 +1,1197 @@ + + + + My.interactions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/cornerCases/types.ecore b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/cornerCases/types.ecore new file mode 100644 index 0000000000..0a301e7c4a --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/cornerCases/types.ecore @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/interaction.odesign b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/interaction.odesign new file mode 100644 index 0000000000..9d1ad8b89c --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/interaction.odesign @@ -0,0 +1,1907 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/lifelines.interactions b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/lifelines.interactions new file mode 100644 index 0000000000..fe343ae142 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/lifelines.interactions @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/representations.aird b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/representations.aird new file mode 100644 index 0000000000..f2e91d5f1c --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/representations.aird @@ -0,0 +1,279 @@ + + + + lifelines.interactions + types.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/types.ecore b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/types.ecore new file mode 100644 index 0000000000..0a301e7c4a --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/sequence/interactionContainer/types.ecore @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerAdditionalLayerTests.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerAdditionalLayerTests.java new file mode 100644 index 0000000000..20be82aab0 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerAdditionalLayerTests.java @@ -0,0 +1,306 @@ +/******************************************************************************* + * Copyright (c) CEA. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.swtbot.sequence; + +import java.util.Optional; + +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.editparts.AbstractGraphicalEditPart; +import org.eclipse.sirius.diagram.sequence.business.internal.elements.InteractionContainer; +import org.eclipse.sirius.diagram.sequence.business.internal.layout.LayoutConstants; +import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.EndOfLifeEditPart; +import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.InteractionContainerEditPart; +import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.LifelineEditPart; +import org.eclipse.sirius.ext.base.Option; +import org.eclipse.sirius.ext.base.Options; +import org.eclipse.sirius.tests.swtbot.support.api.business.UIDiagramRepresentation; +import org.eclipse.sirius.tests.swtbot.support.api.condition.OperationDoneCondition; +import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor; +import org.eclipse.sirius.tests.unit.diagram.sequence.InteractionsConstants; +import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart; +import org.eclipse.swtbot.swt.finder.waits.ICondition; + +/** + * Check Interaction Container size depending on sequence diagram element. This test uses the default sequence VSM + * interaction. The Interaction Container mapping is in an additional layer, not active by default. + * + * @author smonnier + */ +public class InteractionContainerAdditionalLayerTests extends AbstractSequenceDiagramTestCase { + + private static final String PATH = DATA_UNIT_DIR + "reorder/instanceRole/"; + + private static final String REPRESENTATION_NAME = "Sequence Diagram on Lifelines"; + + private static final String MODEL = "lifelines.interactions"; + + private static final String SESSION_FILE = "lifelines.aird"; + + private static final String TYPES_FILE = "types.ecore"; + + private SWTBotGefEditPart instanceRoleEditPartABot; + + private SWTBotGefEditPart instanceRoleEditPartBBot; + + private SWTBotGefEditPart instanceRoleEditPartCBot; + + private Rectangle instanceRoleEditPartABounds; + + private Rectangle instanceRoleEditPartBBounds; + + private Rectangle instanceRoleEditPartCBounds; + + private String INTERACTION_CONTAINER_LAYER = "Interaction Container"; + + private UIDiagramRepresentation diagram; + + /** + * {@inheritDoc} + */ + @Override + protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { + super.onSetUpAfterOpeningDesignerPerspective(); + + diagram = localSession.getLocalSessionBrowser().perCategory().selectViewpoint(VIEWPOINT_NAME).selectRepresentation(getRepresentationId()) + .selectRepresentationInstance(getDRepresentationName().get(), UIDiagramRepresentation.class); + + editor.reveal(LIFELINE_A); + + // Arrange All + arrangeAll(); + maximizeEditor(editor); + + initBotsAndBounds(editor); + } + + /** + * Check that on lifeline move and change position, the interaction container bounds also move accordingly. + */ + public void testInteractionResizeOnInstanceRolePositionChange() { + // Activate the extension layer. + ICondition done = new OperationDoneCondition(); + diagram.changeLayerActivation(INTERACTION_CONTAINER_LAYER); + bot.waitUntil(done); + + // Check that the Interaction Container east bound correspond to the Instance Role C east bound + margin + SWTBotGefEditPart interactionContainereditPart = editor.getEditPart("Lifelines", InteractionContainerEditPart.class); + Rectangle interactionContainerBounds = editor.getBounds(interactionContainereditPart); + assertEquals("Interaction Container east bound is not where expected", instanceRoleEditPartCBounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 1); + + /* + * Move lifelines to graphically change their order. + */ + // drag LIFELINE_C to (250,0) delta + editor.drag(instanceRoleEditPartCBot, instanceRoleEditPartCBounds.x + 250, origin.y); + // Drag LIFELINE_A to (300,0) delta, Lifeline A forth between Lifeline B + // and Lifeline C + editor.drag(instanceRoleEditPartABot, instanceRoleEditPartABounds.x + 300, origin.y); + + // Check that the Interaction Container east bound still correspond to the Instance Role C east bound + margin + instanceRoleEditPartCBot = editor.getEditPart(LIFELINE_C); + instanceRoleEditPartCBounds = editor.getBounds(instanceRoleEditPartCBot); + instanceRoleEditPartBBot = editor.getEditPart(LIFELINE_B); + instanceRoleEditPartBBounds = editor.getBounds(instanceRoleEditPartBBot); + interactionContainereditPart = editor.getEditPart("Lifelines", InteractionContainerEditPart.class); + interactionContainerBounds = editor.getBounds(interactionContainereditPart); + assertEquals("Interaction Container east bound is not where expected", instanceRoleEditPartCBounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 1); + assertEquals("Interaction Container west bound is not where expected", instanceRoleEditPartBBounds.getLeft().x - InteractionContainer.MARGIN, interactionContainerBounds.getLeft().x, 1); + } + + /** + * Check that when the last lifeline move back and forth, the interaction container bounds also move accordingly. + */ + public void testInteractionResizeOnInstanceRoleMoveBackAndForth() { + // Activate the extension layer. + ICondition done = new OperationDoneCondition(); + diagram.changeLayerActivation(INTERACTION_CONTAINER_LAYER); + bot.waitUntil(done); + + // Check that the Interaction Container east bound correspond to the Instance Role C east bound + margin + SWTBotGefEditPart interactionContainereditPart = editor.getEditPart("Lifelines", InteractionContainerEditPart.class); + Rectangle interactionContainerBounds = editor.getBounds(interactionContainereditPart); + assertEquals("Interaction Container east bound is not where expected", instanceRoleEditPartCBounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 1); + + /* + * Move lifelines further on the right + */ + editor.drag(instanceRoleEditPartCBot, instanceRoleEditPartCBounds.x + 250, origin.y); + + // Check that the Interaction Container east bound still correspond to the Instance Role C east bound + margin + instanceRoleEditPartCBot = editor.getEditPart(LIFELINE_C); + instanceRoleEditPartCBounds = editor.getBounds(instanceRoleEditPartCBot); + interactionContainereditPart = editor.getEditPart("Lifelines", InteractionContainerEditPart.class); + interactionContainerBounds = editor.getBounds(interactionContainereditPart); + assertEquals("Interaction Container east bound is not where expected", instanceRoleEditPartCBounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 1); + + /* + * Move lifelines back on the left + */ + editor.drag(instanceRoleEditPartCBot, instanceRoleEditPartCBounds.x - 100, origin.y); + + // Check that the Interaction Container east bound still correspond to the Instance Role C east bound + margin + instanceRoleEditPartCBot = editor.getEditPart(LIFELINE_C); + instanceRoleEditPartCBounds = editor.getBounds(instanceRoleEditPartCBot); + interactionContainereditPart = editor.getEditPart("Lifelines", InteractionContainerEditPart.class); + interactionContainerBounds = editor.getBounds(interactionContainereditPart); + assertEquals("Interaction Container east bound is not where expected", instanceRoleEditPartCBounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 1); + } + + /** + * Check that when an execution moves down and resize the lifelines, the interaction container bounds also resizes + * accordingly. + */ + public void testInteractionResizeOnExecutionMove() { + // Activate the extension layer. + ICondition done = new OperationDoneCondition(); + diagram.changeLayerActivation(INTERACTION_CONTAINER_LAYER); + bot.waitUntil(done); + + // Check that the Interaction Container south bound correspond to an End of Life south bound + margin + SWTBotGefEditPart interactionContainerEditPart = editor.getEditPart("Lifelines", InteractionContainerEditPart.class); + Rectangle interactionContainerBounds = editor.getBounds(interactionContainerEditPart); + + LifelineEditPart lifelineAEditPart = getLifelineEditPart(LIFELINE_A); + SWTBotGefEditPart lifelineABotEditPart = getBotEditPart(lifelineAEditPart, LifelineEditPart.class); + Rectangle lifelineABounds = editor.getAbsoluteBounds(lifelineABotEditPart); + Optional optionalEOLEditPart = lifelineAEditPart.getChildren().stream().filter(EndOfLifeEditPart.class::isInstance).map(EndOfLifeEditPart.class::cast).findFirst(); + assertTrue("Lifeline A should have and end of life at the bottom", optionalEOLEditPart.isPresent()); + SWTBotGefEditPart eolABotEditPart = getBotEditPart(optionalEOLEditPart.get(), EndOfLifeEditPart.class); + Rectangle eolABounds = editor.getAbsoluteBounds(eolABotEditPart); + assertEquals("Interaction Container south bound is not where expected", eolABounds.getBottom().y + InteractionContainer.MARGIN, interactionContainerBounds.getBottom().y, 1); + + // Create an execution on lifeline A + editor.activateTool("Execution"); + editor.click(instanceRoleEditPartABounds.getCenter().x, 150); + + // Validates the position of the execution + assertNotNull("The execution index 0 on lifeline " + LIFELINE_A + " has not been found", getExecutionScreenPosition(LIFELINE_A, 0)); + + Point executionScreenPosition = getExecutionScreenPosition(LIFELINE_A, 0).getCopy(); + Dimension executionDimension = getExecutionScreenDimension(LIFELINE_A, 0).getCopy(); + + // Move the execution down at the limit of the lifeline so it will expend the lifeline and interaction container + Point targetedLocation = lifelineABounds.getBottom().getTranslated(0, -10); + editor.drag(executionScreenPosition, targetedLocation); + executionScreenPosition = getExecutionScreenPosition(LIFELINE_A, 0).getCopy(); + executionDimension = getExecutionScreenDimension(LIFELINE_A, 0).getCopy(); + assertEquals("Execution has not been moved at the expected location", targetedLocation.y, executionScreenPosition.y, 1); + + // Check that the bottom of the lifeline has been expanded + lifelineAEditPart = getLifelineEditPart(LIFELINE_A); + lifelineABotEditPart = getBotEditPart(lifelineAEditPart, LifelineEditPart.class); + lifelineABounds = editor.getAbsoluteBounds(lifelineABotEditPart); + optionalEOLEditPart = lifelineAEditPart.getChildren().stream().filter(EndOfLifeEditPart.class::isInstance).map(EndOfLifeEditPart.class::cast).findFirst(); + eolABotEditPart = getBotEditPart(optionalEOLEditPart.get(), EndOfLifeEditPart.class); + eolABounds = editor.getAbsoluteBounds(eolABotEditPart); + assertEquals("The lifeline has not been expanded as expected", eolABounds.y, + executionScreenPosition.y + executionDimension.height + LayoutConstants.INTERACTION_EXECUTION_MIN_HEIGHT_AFTER_LAYOUT, 1); + + // Check that the interaction container has been expanded as well + interactionContainerEditPart = editor.getEditPart("Lifelines", InteractionContainerEditPart.class); + interactionContainerBounds = editor.getBounds(interactionContainerEditPart); + assertEquals("Interaction Container south bound is not where expected", eolABounds.getBottom().y + InteractionContainer.MARGIN, interactionContainerBounds.getBottom().y, 1); + + // Move the Execution up + targetedLocation = lifelineABounds.getTop().getTranslated(0, 50); + editor.drag(executionScreenPosition, targetedLocation); + + // Move the End of life up to shorten the lifeline length by 10px + targetedLocation = eolABounds.getCenter().getTranslated(0, -10); + editor.drag(eolABounds.getCenter(), targetedLocation); + lifelineAEditPart = getLifelineEditPart(LIFELINE_A); + lifelineABotEditPart = getBotEditPart(lifelineAEditPart, LifelineEditPart.class); + lifelineABounds = editor.getAbsoluteBounds(lifelineABotEditPart); + optionalEOLEditPart = lifelineAEditPart.getChildren().stream().filter(EndOfLifeEditPart.class::isInstance).map(EndOfLifeEditPart.class::cast).findFirst(); + eolABotEditPart = getBotEditPart(optionalEOLEditPart.get(), EndOfLifeEditPart.class); + eolABounds = editor.getAbsoluteBounds(eolABotEditPart); + assertEquals("The lifeline has not been shorten as expected", eolABounds.getCenter().y, targetedLocation.y, 1); + + // Check that the interaction container has been shorten as well + interactionContainerEditPart = editor.getEditPart("Lifelines", InteractionContainerEditPart.class); + interactionContainerBounds = editor.getBounds(interactionContainerEditPart); + assertEquals("Interaction Container south bound is not where expected", eolABounds.getBottom().y + InteractionContainer.MARGIN, interactionContainerBounds.getBottom().y, 1); + } + + private SWTBotGefEditPart getBotEditPart(AbstractGraphicalEditPart parentExec, final Class expectedEditPartType) { + return editor.getEditPart(parentExec.getFigure().getBounds().getCopy().getCenter(), expectedEditPartType); + } + + private void initBotsAndBounds(SWTBotSiriusDiagramEditor swtBotEditor) { + instanceRoleEditPartABot = swtBotEditor.getEditPart(LIFELINE_A); + instanceRoleEditPartBBot = swtBotEditor.getEditPart(LIFELINE_B); + instanceRoleEditPartCBot = swtBotEditor.getEditPart(LIFELINE_C); + + instanceRoleEditPartABounds = swtBotEditor.getBounds(instanceRoleEditPartABot); + instanceRoleEditPartBBounds = swtBotEditor.getBounds(instanceRoleEditPartBBot); + instanceRoleEditPartCBounds = swtBotEditor.getBounds(instanceRoleEditPartCBot); + } + + /** + * {@inheritDoc} + */ + @Override + protected void tearDown() throws Exception { + instanceRoleEditPartABot = null; + instanceRoleEditPartBBot = null; + instanceRoleEditPartCBot = null; + + instanceRoleEditPartABounds = null; + instanceRoleEditPartBBounds = null; + instanceRoleEditPartCBounds = null; + + super.tearDown(); + } + + /** + * {@inheritDoc} + */ + @Override + protected String getPath() { + return PATH; + } + + @Override + protected String getSemanticModel() { + return MODEL; + } + + @Override + protected String getTypesSemanticModel() { + return TYPES_FILE; + } + + @Override + protected String getSessionModel() { + return SESSION_FILE; + } + + /** + * {@inheritDoc} + */ + @Override + protected String getRepresentationId() { + return InteractionsConstants.SEQUENCE_DIAGRAM_REPRESENTATION_ID; + } + + /** + * {@inheritDoc} + */ + @Override + protected Option getDRepresentationName() { + return Options.newSome(REPRESENTATION_NAME); + } +} diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerTests.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerDefaultLayerTests.java similarity index 52% rename from plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerTests.java rename to plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerDefaultLayerTests.java index a555099f5d..e4c57a4b6d 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerTests.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerDefaultLayerTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 THALES GLOBAL SERVICES. + * Copyright (c) CEA. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,36 +13,41 @@ package org.eclipse.sirius.tests.swtbot.sequence; import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.sirius.diagram.sequence.SequenceDDiagram; -import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.editparts.AbstractGraphicalEditPart; +import org.eclipse.sirius.diagram.sequence.business.internal.elements.InteractionContainer; import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.InteractionContainerEditPart; -import org.eclipse.sirius.diagram.sequence.ui.tool.internal.util.EditPartsHelper; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; +import org.eclipse.sirius.tests.swtbot.Activator; import org.eclipse.sirius.tests.swtbot.support.api.business.UIDiagramRepresentation; -import org.eclipse.sirius.tests.swtbot.support.api.condition.OperationDoneCondition; import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor; -import org.eclipse.sirius.tests.unit.diagram.sequence.InteractionsConstants; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart; -import org.eclipse.swtbot.swt.finder.waits.ICondition; /** - * Check Interaction Container size depending on sequence diagram element. + * Check Interaction Container size depending on sequence diagram element. This test uses a custom sequence VSM + * interaction. The Interaction Container mapping is in the default layer, so it is always displayed. * * @author smonnier */ -public class InteractionContainerTests extends AbstractSequenceDiagramTestCase { +public class InteractionContainerDefaultLayerTests extends AbstractSequenceDiagramTestCase { - private static final String PATH = DATA_UNIT_DIR + "reorder/instanceRole/"; + protected static final String VIEWPOINT_NAME = "Interactions_local_vsm"; - private static final String REPRESENTATION_NAME = "Sequence Diagram on Lifelines"; + private static final String PATH = DATA_UNIT_DIR + "interactionContainer/"; + + private static final String REPRESENTATION_NAME = "Sequence Diagram2 on Lifelines"; + + private static final String REPRESENTATION_DESCRIPTION_NAME = "Sequence Diagram2 on Interaction"; private static final String MODEL = "lifelines.interactions"; - private static final String SESSION_FILE = "lifelines.aird"; + private static final String SESSION_FILE = "representations.aird"; private static final String TYPES_FILE = "types.ecore"; + private static final String VSM_FILE = "interaction.odesign"; + private SWTBotGefEditPart instanceRoleEditPartABot; private SWTBotGefEditPart instanceRoleEditPartBBot; @@ -55,8 +60,6 @@ public class InteractionContainerTests extends AbstractSequenceDiagramTestCase { private Rectangle instanceRoleEditPartCBounds; - private String INTERACTION_CONTAINER_LAYER = "Interaction Container"; - private UIDiagramRepresentation diagram; /** @@ -78,44 +81,80 @@ protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { initBotsAndBounds(editor); } + @Override + protected void onSetUpBeforeClosingWelcomePage() throws Exception { + super.onSetUpBeforeClosingWelcomePage(); + if (getVsmFile() != null) { + copyFileToTestProject(Activator.PLUGIN_ID, getPath(), getVsmFile()); + } + } + /** - * Check that on lifeline move, the interaction container bounds also move accordingly. + * Check that on lifeline move and change position, the interaction container bounds also move accordingly. */ - public void testInteractionResizeOnInstanceRoleMove() { - SequenceDiagram sequenceDiagram = EditPartsHelper.getSequenceDiagram(instanceRoleEditPartABot.part()); - SequenceDDiagram sequenceDDiagram = sequenceDiagram.getSequenceDDiagram(); - - // Activate the extension layer. - ICondition done = new OperationDoneCondition(); - diagram.changeLayerActivation(INTERACTION_CONTAINER_LAYER); - bot.waitUntil(done); - + public void testInteractionResizeOnInstanceRolePositionChange() { // Check that the Interaction Container east bound correspond to the Instance Role C east bound + margin SWTBotGefEditPart interactionContainereditPart = editor.getEditPart("Lifelines", InteractionContainerEditPart.class); Rectangle interactionContainerBounds = editor.getBounds(interactionContainereditPart); - assertEquals("Interaction Container east bound is not where expected", instanceRoleEditPartCBounds.getRight().x + 50, interactionContainerBounds.getRight().x); + assertEquals("Interaction Container east bound is not where expected", instanceRoleEditPartCBounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 1); /* * Move lifelines to graphically change their order. */ - moveLifelines_A_and_C(); + // drag LIFELINE_C to (250,0) delta + editor.drag(instanceRoleEditPartCBot, instanceRoleEditPartCBounds.x + 250, origin.y); + // Drag LIFELINE_A to (300,0) delta, Lifeline A forth between Lifeline B + // and Lifeline C + editor.drag(instanceRoleEditPartABot, instanceRoleEditPartABounds.x + 300, origin.y); // Check that the Interaction Container east bound still correspond to the Instance Role C east bound + margin instanceRoleEditPartCBot = editor.getEditPart(LIFELINE_C); instanceRoleEditPartCBounds = editor.getBounds(instanceRoleEditPartCBot); + instanceRoleEditPartBBot = editor.getEditPart(LIFELINE_B); + instanceRoleEditPartBBounds = editor.getBounds(instanceRoleEditPartBBot); interactionContainereditPart = editor.getEditPart("Lifelines", InteractionContainerEditPart.class); interactionContainerBounds = editor.getBounds(interactionContainereditPart); - assertEquals("Interaction Container east bound is not where expected", instanceRoleEditPartCBounds.getRight().x + 50, interactionContainerBounds.getRight().x); + assertEquals("Interaction Container east bound is not where expected", instanceRoleEditPartCBounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 1); + assertEquals("Interaction Container west bound is not where expected", instanceRoleEditPartBBounds.getLeft().x - InteractionContainer.MARGIN, interactionContainerBounds.getLeft().x, 1); } - private void moveLifelines_A_and_C() { - // drag LIFELINE_C to (250,0) delta + /** + * Check that when the last lifeline move back and forth, the interaction container bounds also move accordingly. + */ + public void testInteractionResizeOnInstanceRoleMoveBackAndForth() { + // Check that the Interaction Container east bound correspond to the Instance Role C east bound + margin + SWTBotGefEditPart interactionContainereditPart = editor.getEditPart("Lifelines", InteractionContainerEditPart.class); + Rectangle interactionContainerBounds = editor.getBounds(interactionContainereditPart); + assertEquals("Interaction Container east bound is not where expected", instanceRoleEditPartCBounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 1); + + /* + * Move lifelines further on the right + */ editor.drag(instanceRoleEditPartCBot, instanceRoleEditPartCBounds.x + 250, origin.y); - // Drag LIFELINE_A to (300,0) delta, Lifeline A forth between Lifeline B - // and Lifeline C - editor.drag(instanceRoleEditPartABot, instanceRoleEditPartABounds.x + 300, origin.y); + + // Check that the Interaction Container east bound still correspond to the Instance Role C east bound + margin + instanceRoleEditPartCBot = editor.getEditPart(LIFELINE_C); + instanceRoleEditPartCBounds = editor.getBounds(instanceRoleEditPartCBot); + interactionContainereditPart = editor.getEditPart("Lifelines", InteractionContainerEditPart.class); + interactionContainerBounds = editor.getBounds(interactionContainereditPart); + assertEquals("Interaction Container east bound is not where expected", instanceRoleEditPartCBounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 1); + + /* + * Move lifelines back on the left + */ + editor.drag(instanceRoleEditPartCBot, instanceRoleEditPartCBounds.x - 100, origin.y); + + // Check that the Interaction Container east bound still correspond to the Instance Role C east bound + margin + instanceRoleEditPartCBot = editor.getEditPart(LIFELINE_C); + instanceRoleEditPartCBounds = editor.getBounds(instanceRoleEditPartCBot); + interactionContainereditPart = editor.getEditPart("Lifelines", InteractionContainerEditPart.class); + interactionContainerBounds = editor.getBounds(interactionContainereditPart); + assertEquals("Interaction Container east bound is not where expected", instanceRoleEditPartCBounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 1); } + private SWTBotGefEditPart getBotEditPart(AbstractGraphicalEditPart parentExec, final Class expectedEditPartType) { + return editor.getEditPart(parentExec.getFigure().getBounds().getCopy().getCenter(), expectedEditPartType); + } private void initBotsAndBounds(SWTBotSiriusDiagramEditor swtBotEditor) { instanceRoleEditPartABot = swtBotEditor.getEditPart(LIFELINE_A); @@ -166,12 +205,26 @@ protected String getSessionModel() { return SESSION_FILE; } + /** + * @return the vsmFile + */ + public static String getVsmFile() { + return VSM_FILE; + } + + /** + * @return the representationDescriptionName + */ + public static String getRepresentationDescriptionName() { + return REPRESENTATION_DESCRIPTION_NAME; + } + /** * {@inheritDoc} */ @Override protected String getRepresentationId() { - return InteractionsConstants.SEQUENCE_DIAGRAM_REPRESENTATION_ID; + return REPRESENTATION_DESCRIPTION_NAME; } /** diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerFromSampleTests.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerFromSampleTests.java new file mode 100644 index 0000000000..276e216354 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/InteractionContainerFromSampleTests.java @@ -0,0 +1,185 @@ +/******************************************************************************* + * Copyright (c) CEA. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.swtbot.sequence; + +import java.util.Optional; + +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.DEdge; +import org.eclipse.sirius.diagram.sequence.business.internal.elements.InteractionContainer; +import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.CombinedFragmentEditPart; +import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.InstanceRoleEditPart; +import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.InteractionContainerEditPart; +import org.eclipse.sirius.ext.base.Option; +import org.eclipse.sirius.ext.base.Options; +import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor; +import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefConnectionEditPart; +import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart; + +/** + * Check Interaction Container size depending on sequence diagram element. This test uses the default sequence VSM + * interaction. The Interaction Container mapping is in an additional layer, not active by default. This test classes + * uses a sample with sequence diagram that are 'unusual'. + * + * @author smonnier + */ +public class InteractionContainerFromSampleTests extends AbstractSequenceDiagramTestCase { + + // protected static final String VIEWPOINT_NAME = "Interactions_local_vsm"; + + private static final String PATH = DATA_UNIT_DIR + "interactionContainer/cornerCases/"; + + private static final String REPRESENTATION_NAME1 = "Sequence Diagram on interaction1"; + + private static final String REPRESENTATION_NAME2 = "Sequence Diagram on interaction2"; + + private static final String REPRESENTATION_DESCRIPTION_NAME = "Sequence Diagram on Interaction"; + + private static final String MODEL = "My.interactions"; + + private static final String SESSION_FILE = "representations.aird"; + + private static final String TYPES_FILE = "types.ecore"; + + // private UIDiagramRepresentation diagram; + + protected static final String LIFELINE_2 = "newParticipant2 : "; + + protected static final String LIFELINE_3 = "newParticipant3 : "; + + /** + * {@inheritDoc} + */ + @Override + protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { + super.onSetUpAfterOpeningDesignerPerspective(); + + // diagram = + // localSession.getLocalSessionBrowser().perCategory().selectViewpoint(VIEWPOINT_NAME).selectRepresentation(getRepresentationId()) + // .selectRepresentationInstance(getDRepresentationName().get(), UIDiagramRepresentation.class); + + editor.reveal(LIFELINE_1); + + // Arrange All + arrangeAll(); + maximizeEditor(editor); + } + + /** + * Check that on lifeline move, the interaction container bounds also move accordingly. Here the east bound depends on + * the east bound of the main combined fragment. + */ + public void testInteractionResizeOnInstanceRolePositionChangeWithMultipleMessages() { + // Check that the Interaction Container east bound correspond to the combined east bound + margin + SWTBotGefEditPart interactionContainerEditPart = editor.getEditPart("interaction1", InteractionContainerEditPart.class); + Rectangle interactionContainerBounds = editor.getBounds(interactionContainerEditPart); + Optional optionalm7SWTBotGefConnectionEditPart = editor.getConnectionsEditPart().stream().filter(cep-> ((DEdge)((Edge)cep.part().getModel()).getElement()).getName().equals("m7")).findFirst(); + assertTrue("message m7 has not been found on the diagram", optionalm7SWTBotGefConnectionEditPart.isPresent()); + Rectangle m7bounds = editor.getBounds(optionalm7SWTBotGefConnectionEditPart.get()); + assertEquals("Interaction Container east bound is not where expected", m7bounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 3); + + SWTBotGefEditPart instanceRole3EditPart = editor.getEditPart(LIFELINE_3, InstanceRoleEditPart.class); + Rectangle instanceRole3Bounds = editor.getBounds(instanceRole3EditPart); + + // Move newParticipant3 further on the right to resize the interaction container + editor.drag(instanceRole3EditPart, instanceRole3Bounds.x + 250, origin.y); + + // Check that the Interaction Container east bound still correspond to the Instance Role C east bound + margin + interactionContainerEditPart = editor.getEditPart("interaction1", InteractionContainerEditPart.class); + interactionContainerBounds = editor.getBounds(interactionContainerEditPart); + optionalm7SWTBotGefConnectionEditPart = editor.getConnectionsEditPart().stream().filter(cep -> ((DEdge) ((Edge) cep.part().getModel()).getElement()).getName().equals("m7")).findFirst(); + m7bounds = editor.getBounds(optionalm7SWTBotGefConnectionEditPart.get()); + assertTrue("message m7 has not been found on the diagram", optionalm7SWTBotGefConnectionEditPart.isPresent()); + assertEquals("Interaction Container east bound is not where expected", m7bounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 3); + } + + + + /** + * Check that on lifeline move, the interaction container bounds also move accordingly. Here the east bound depends on + * the east bound of the main combined fragment. + */ + public void testInteractionResizeOnInstanceRolePositionChangeWithMultipleCombinedFragments() { + // TODO open representation2 + editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), getRepresentationId(), REPRESENTATION_NAME2, DDiagram.class, true, true); + // Check that the Interaction Container east bound correspond to the combined east bound + margin + SWTBotGefEditPart interactionContainerEditPart = editor.getEditPart("interaction2", InteractionContainerEditPart.class); + Rectangle interactionContainerBounds = editor.getBounds(interactionContainerEditPart); + SWTBotGefEditPart combinedFragmentEditPart = editor.getEditPart("alt.1", CombinedFragmentEditPart.class); + Rectangle combinedFragmentBounds = editor.getBounds(combinedFragmentEditPart); + assertEquals("Interaction Container east bound is not where expected", combinedFragmentBounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 1); + + SWTBotGefEditPart instanceRole2EditPart = editor.getEditPart(LIFELINE_2, InstanceRoleEditPart.class); + Rectangle instanceRole2Bounds = editor.getBounds(instanceRole2EditPart); + + // Move newParticipant3 further on the right to resize the interaction container + editor.drag(instanceRole2EditPart, instanceRole2Bounds.x + 250, origin.y); + + // Check that the Interaction Container east bound still correspond to the Instance Role C east bound + margin + interactionContainerEditPart = editor.getEditPart("interaction2", InteractionContainerEditPart.class); + interactionContainerBounds = editor.getBounds(interactionContainerEditPart); + combinedFragmentEditPart = editor.getEditPart("alt.1", CombinedFragmentEditPart.class); + combinedFragmentBounds = editor.getBounds(combinedFragmentEditPart); + assertEquals("Interaction Container east bound is not where expected", combinedFragmentBounds.getRight().x + InteractionContainer.MARGIN, interactionContainerBounds.getRight().x, 1); + } + + + /** + * {@inheritDoc} + */ + @Override + protected String getPath() { + return PATH; + } + + @Override + protected String getSemanticModel() { + return MODEL; + } + + @Override + protected String getTypesSemanticModel() { + return TYPES_FILE; + } + + @Override + protected String getSessionModel() { + return SESSION_FILE; + } + + /** + * @return the representationDescriptionName + */ + public static String getRepresentationDescriptionName() { + return REPRESENTATION_DESCRIPTION_NAME; + } + + /** + * {@inheritDoc} + */ + @Override + protected String getRepresentationId() { + return REPRESENTATION_DESCRIPTION_NAME; + } + + /** + * {@inheritDoc} + */ + @Override + protected Option getDRepresentationName() { + return Options.newSome(REPRESENTATION_NAME1); + } + +} diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/SequenceSwtBotTestSuite.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/SequenceSwtBotTestSuite.java index 2c1ec834a6..198df02841 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/SequenceSwtBotTestSuite.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/SequenceSwtBotTestSuite.java @@ -48,6 +48,9 @@ import org.eclipse.sirius.tests.swtbot.sequence.HeaderSequenceDiagramTests; import org.eclipse.sirius.tests.swtbot.sequence.InstanceRoleOrderingTests; import org.eclipse.sirius.tests.swtbot.sequence.InstanceRoleResizableEditPolicyTests; +import org.eclipse.sirius.tests.swtbot.sequence.InteractionContainerAdditionalLayerTests; +import org.eclipse.sirius.tests.swtbot.sequence.InteractionContainerDefaultLayerTests; +import org.eclipse.sirius.tests.swtbot.sequence.InteractionContainerFromSampleTests; import org.eclipse.sirius.tests.swtbot.sequence.InteractionUseCoverageTests; import org.eclipse.sirius.tests.swtbot.sequence.InteractionUseMoveDownTests; import org.eclipse.sirius.tests.swtbot.sequence.InteractionUseResizeTests; @@ -149,7 +152,9 @@ public static void addGerritPart(TestSuite suite) { suite.addTestSuite(SequenceSpaceTest.class); suite.addTestSuite(RefreshLayoutScopeTests.class); suite.addTestSuite(InstanceRoleOrderingTests.class); - // suite.addTestSuite(InteractionContainerTests.class); + suite.addTestSuite(InteractionContainerDefaultLayerTests.class); + suite.addTestSuite(InteractionContainerAdditionalLayerTests.class); + suite.addTestSuite(InteractionContainerFromSampleTests.class); // suite.addTestSuite(ContextMenuInDiagramTest.class); }