/** * {@inheritDoc} * * @return an execution, a state, a message, an interaction use, a combined fragment, a lost * message, a found message. */ protected Collection<SWTBotGefEditPart> getEditPartsToCheckDisabledActionsOn() { Collection<SWTBotGefEditPart> partsToTest = Lists.newArrayList(); // Retrieve instance role (do not retrieve the lifeline : it is not // selectable). partsToTest.add(instanceRoleEditPartBBot); // Retrieve end of life partsToTest.add( instanceRoleEditPartBBot .descendants(IsInstanceOf.instanceOf(EndOfLifeEditPart.class)) .get(0)); // Retrieve execution partsToTest.add( instanceRoleEditPartBBot .descendants(IsInstanceOf.instanceOf(ExecutionEditPart.class)) .get(0)); // Retrieve state partsToTest.add( instanceRoleEditPartBBot.descendants(IsInstanceOf.instanceOf(StateEditPart.class)).get(0)); // Retrieve message partsToTest.add(editor.getEditPart("m1").parent()); // Retrieve interactionUses partsToTest.add( sequenceDiagramBot .descendants(IsInstanceOf.instanceOf(InteractionUseEditPart.class)) .get(0)); // Retrieve cominedFragments partsToTest.add( sequenceDiagramBot .descendants(IsInstanceOf.instanceOf(CombinedFragmentEditPart.class)) .get(0)); // Retrieve Lost messages partsToTest.add(editor.getEditPart("m_create3").parent()); // Retrieve found messages partsToTest.add(editor.getEditPart("m6").parent()); return partsToTest; }
/** Test that move a the second InteractionUse under the end of lifeline is forbidden. */ public void testSecondInteractionUseMoveUnderEndLifelineNotPossible() { int endOfLifeline = editor .getBounds( instanceRoleEditPartABot .parent() .descendants(IsInstanceOf.instanceOf(LifelineEditPart.class)) .get(0)) .getBottom() .y; int dy = endOfLifeline - secondInteractionUseBounds.y + 20; editor.drag( secondInteractionUseBot, secondInteractionUseBounds.x, secondInteractionUseBounds.y + dy); testDiagramConsistency(); validateOrdering(20); }
/** test to move up the second interaction use */ public void testSecondInteractionUseVerticalMoveDownToCenterOfReflexiveSyncCallOnNotSemanticallyCoveredParticipant() { if (TestsUtil.shouldSkipLongTests()) { /* junit.framework.AssertionFailedError: The execution named is not displayed at the expected vertical position expected:<420.0> but was:<485.0> at junit.framework.Assert.fail(Assert.java:57) at junit.framework.Assert.failNotEquals(Assert.java:329) at junit.framework.Assert.assertEquals(Assert.java:142) at junit.framework.TestCase.assertEquals(TestCase.java:298) at org.eclipse.sirius.tests.swtbot.sequence.AbstractSequenceDiagramTestCase.assertSequenceNodeHasValidBounds(AbstractSequenceDiagramTestCase.java:1371) at org.eclipse.sirius.tests.swtbot.sequence.AbstractSequenceDiagramTestCase.assertExecutionHasValidScreenBounds(AbstractSequenceDiagramTestCase.java:1305) at org.eclipse.sirius.tests.swtbot.sequence.InteractionUseMoveDownTests.commonPreparationForMoveDownTests(InteractionUseMoveDownTests.java:227) at org.eclipse.sirius.tests.swtbot.sequence.InteractionUseMoveDownTests.testSecondInteractionUseVerticalMoveDownToCenterOfReflexiveSyncCallOnNotSemanticallyCoveredParticipant(InteractionUseMoveDownTests.java:360) */ return; } int dY = commonPreparationForMoveDownTests(); // Move second interaction to have its top in the middle of E6 CheckEditPartMoved checkMoved = new CheckEditPartMoved(secondInteractionUseBot); editor.drag(secondInteractionUseBounds.getTop(), e6Bounds.getCenter()); bot.waitUntil(checkMoved); int dy2 = e6Bounds.getCenter().y - secondInteractionUseBounds.getTop().y; int deltaResize = secondInteractionUseBounds.height; e6Bot = instanceRoleEditPartEBot .parent() .descendants(IsInstanceOf.instanceOf(ExecutionEditPart.class)) .get(0); callMessageOnE6Bot = e6Bot.targetConnections().get(0); returnMessageOfE6Bot = e6Bot.sourceConnections().get(0); assertInteractionUseHasValidScreenBounds( (InteractionUseEditPart) firstInteractionUseBot.part(), firstInteractionUseBounds); assertInteractionUseHasValidScreenBounds( (InteractionUseEditPart) secondInteractionUseBot.part(), secondInteractionUseBounds.getTranslated(0, dy2)); assertExecutionHasValidScreenBounds((ExecutionEditPart) e1Bot.part(), e1Bounds); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e2Bot.part(), e2Bounds.getResized(0, dY + deltaResize)); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e3Bot.part(), e3Bounds.getResized(0, dY + deltaResize)); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e4Bot.part(), e4Bounds.getResized(0, dY + deltaResize)); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e5Bot.part(), e5Bounds.getTranslated(0, dY + deltaResize)); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e6Bot.part(), e6Bounds.getResized(0, deltaResize)); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE1Bot.part(), callMessageOnE1Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE2Bot.part(), callMessageOnE2Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE4Bot.part(), callMessageOnE4Bounds.y); assertMessageHasValidScreenBounds( (SequenceMessageEditPart) callMessageOnE6Bot.part(), callMessageOnE6Bounds, true, false); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE1Bot.part(), returnMessageOfE1Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE2Bot.part(), returnMessageOfE2Bounds.getTranslated(0, dY + deltaResize).y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE4Bot.part(), returnMessageOfE4Bounds.getTranslated(0, dY + deltaResize).y); assertMessageHasValidScreenBounds( (SequenceMessageEditPart) returnMessageOfE6Bot.part(), returnMessageOfE6Bounds.getTranslated(0, deltaResize), true, false); validateOrdering(24); }
/** test to move up the second interaction use */ public void testSecondInteractionUseVerticalMoveDownToReturnOfReflexiveSyncCallOnNotSemanticallyCoveredParticipant() { int dY = commonPreparationForMoveDownTests(); // Move second interaction to have its top in the middle of E6 CheckEditPartMoved checkMoved = new CheckEditPartMoved(secondInteractionUseBot); editor.drag(secondInteractionUseBounds.getTop(), returnMessageOfE6Bounds.getCenter()); bot.waitUntil(checkMoved); int dy2 = returnMessageOfE6Bounds.getCenter().y - secondInteractionUseBounds.getTop().y; int deltaResize = secondInteractionUseBounds.height; e6Bot = instanceRoleEditPartEBot .parent() .descendants(IsInstanceOf.instanceOf(ExecutionEditPart.class)) .get(0); callMessageOnE6Bot = e6Bot.targetConnections().get(0); returnMessageOfE6Bot = e6Bot.sourceConnections().get(0); assertInteractionUseHasValidScreenBounds( (InteractionUseEditPart) firstInteractionUseBot.part(), firstInteractionUseBounds); assertInteractionUseHasValidScreenBounds( (InteractionUseEditPart) secondInteractionUseBot.part(), secondInteractionUseBounds.getTranslated(0, dy2)); assertExecutionHasValidScreenBounds((ExecutionEditPart) e1Bot.part(), e1Bounds); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e2Bot.part(), e2Bounds.getResized(0, dY + deltaResize)); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e3Bot.part(), e3Bounds.getResized(0, dY + deltaResize)); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e4Bot.part(), e4Bounds.getResized(0, dY + deltaResize)); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e5Bot.part(), e5Bounds.getTranslated(0, dY + deltaResize)); assertExecutionHasValidScreenBounds((ExecutionEditPart) e6Bot.part(), e6Bounds); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE1Bot.part(), callMessageOnE1Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE2Bot.part(), callMessageOnE2Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE4Bot.part(), callMessageOnE4Bounds.y); assertMessageHasValidScreenBounds( (SequenceMessageEditPart) callMessageOnE6Bot.part(), callMessageOnE6Bounds, true, false); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE1Bot.part(), returnMessageOfE1Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE2Bot.part(), returnMessageOfE2Bounds.getTranslated(0, dY + deltaResize).y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE4Bot.part(), returnMessageOfE4Bounds.getTranslated(0, dY + deltaResize).y); assertMessageHasValidScreenBounds( (SequenceMessageEditPart) returnMessageOfE6Bot.part(), returnMessageOfE6Bounds.getResized(0, deltaResize), true, false); validateOrdering(24); }
private int commonPreparationForMoveDownTests() { Rectangle lifelineEBounds = getLifelineEditPart(LIFELINE_E).getFigure().getBounds().getCopy(); Point start = new Point( lifelineEBounds.getCenter().x, secondInteractionUseBounds.getBottom().getTranslated(0, 10).y); Point finish = start.getTranslated(0, 9); assertInteractionUseHasValidScreenBounds( (InteractionUseEditPart) firstInteractionUseBot.part(), firstInteractionUseBounds); assertInteractionUseHasValidScreenBounds( (InteractionUseEditPart) secondInteractionUseBot.part(), secondInteractionUseBounds); assertExecutionHasValidScreenBounds((ExecutionEditPart) e1Bot.part(), e1Bounds); assertExecutionHasValidScreenBounds((ExecutionEditPart) e2Bot.part(), e2Bounds); assertExecutionHasValidScreenBounds((ExecutionEditPart) e3Bot.part(), e3Bounds); assertExecutionHasValidScreenBounds((ExecutionEditPart) e4Bot.part(), e4Bounds); assertExecutionHasValidScreenBounds((ExecutionEditPart) e5Bot.part(), e5Bounds); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE1Bot.part(), callMessageOnE1Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE2Bot.part(), callMessageOnE2Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE4Bot.part(), callMessageOnE4Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE1Bot.part(), returnMessageOfE1Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE2Bot.part(), returnMessageOfE2Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE4Bot.part(), returnMessageOfE4Bounds.y); validateOrdering(20); CheckNumberExecutionOnLifeline checkNewExecutionOnLifelineE = new CheckNumberExecutionOnLifeline(LIFELINE_E, 1, editor); createSyncCall(start, finish); bot.waitUntil(checkNewExecutionOnLifelineE); e6Bot = instanceRoleEditPartEBot .parent() .descendants(IsInstanceOf.instanceOf(ExecutionEditPart.class)) .get(0); e6Bounds = editor.getBounds(e6Bot); callMessageOnE6Bot = e6Bot.targetConnections().get(0); returnMessageOfE6Bot = e6Bot.sourceConnections().get(0); callMessageOnE6Bounds = editor.getBounds(callMessageOnE6Bot); returnMessageOfE6Bounds = editor.getBounds(returnMessageOfE6Bot); int dY = LayoutConstants.INTERACTION_EXECUTION_MIN_HEIGHT_AFTER_LAYOUT + LayoutConstants.MESSAGE_TO_SELF_BENDPOINT_VERTICAL_GAP * 2 - (start.y - secondInteractionUseBounds.getBottom().y) + LayoutConstants.EXECUTION_CHILDREN_MARGIN; assertInteractionUseHasValidScreenBounds( (InteractionUseEditPart) firstInteractionUseBot.part(), firstInteractionUseBounds); assertInteractionUseHasValidScreenBounds( (InteractionUseEditPart) secondInteractionUseBot.part(), secondInteractionUseBounds); assertExecutionHasValidScreenBounds((ExecutionEditPart) e1Bot.part(), e1Bounds); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e2Bot.part(), e2Bounds.getResized(0, dY)); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e3Bot.part(), e3Bounds.getResized(0, dY)); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e4Bot.part(), e4Bounds.getResized(0, dY)); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e5Bot.part(), e5Bounds.getTranslated(0, dY)); assertExecutionHasValidScreenBounds((ExecutionEditPart) e6Bot.part(), e6Bounds); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE1Bot.part(), callMessageOnE1Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE2Bot.part(), callMessageOnE2Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE4Bot.part(), callMessageOnE4Bounds.y); assertMessageHasValidScreenBounds( (SequenceMessageEditPart) callMessageOnE6Bot.part(), callMessageOnE6Bounds, true, false); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE1Bot.part(), returnMessageOfE1Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE2Bot.part(), returnMessageOfE2Bounds.getTranslated(0, dY).y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE4Bot.part(), returnMessageOfE4Bounds.getTranslated(0, dY).y); assertMessageHasValidScreenBounds( (SequenceMessageEditPart) returnMessageOfE6Bot.part(), returnMessageOfE6Bounds, true, false); validateOrdering(24); // Undo undo(); testDiagramConsistency(); assertInteractionUseHasValidScreenBounds( (InteractionUseEditPart) firstInteractionUseBot.part(), firstInteractionUseBounds); assertInteractionUseHasValidScreenBounds( (InteractionUseEditPart) secondInteractionUseBot.part(), secondInteractionUseBounds); assertExecutionHasValidScreenBounds((ExecutionEditPart) e1Bot.part(), e1Bounds); assertExecutionHasValidScreenBounds((ExecutionEditPart) e2Bot.part(), e2Bounds); assertExecutionHasValidScreenBounds((ExecutionEditPart) e3Bot.part(), e3Bounds); assertExecutionHasValidScreenBounds((ExecutionEditPart) e4Bot.part(), e4Bounds); assertExecutionHasValidScreenBounds((ExecutionEditPart) e5Bot.part(), e5Bounds); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE1Bot.part(), callMessageOnE1Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE2Bot.part(), callMessageOnE2Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE4Bot.part(), callMessageOnE4Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE1Bot.part(), returnMessageOfE1Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE2Bot.part(), returnMessageOfE2Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE4Bot.part(), returnMessageOfE4Bounds.y); validateOrdering(20); // Redo redo(); bot.waitUntil(checkNewExecutionOnLifelineE); assertInteractionUseHasValidScreenBounds( (InteractionUseEditPart) firstInteractionUseBot.part(), firstInteractionUseBounds); assertInteractionUseHasValidScreenBounds( (InteractionUseEditPart) secondInteractionUseBot.part(), secondInteractionUseBounds); assertExecutionHasValidScreenBounds((ExecutionEditPart) e1Bot.part(), e1Bounds); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e2Bot.part(), e2Bounds.getResized(0, dY)); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e3Bot.part(), e3Bounds.getResized(0, dY)); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e4Bot.part(), e4Bounds.getResized(0, dY)); assertExecutionHasValidScreenBounds( (ExecutionEditPart) e5Bot.part(), e5Bounds.getTranslated(0, dY)); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE1Bot.part(), callMessageOnE1Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE2Bot.part(), callMessageOnE2Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) callMessageOnE4Bot.part(), callMessageOnE4Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE1Bot.part(), returnMessageOfE1Bounds.y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE2Bot.part(), returnMessageOfE2Bounds.getTranslated(0, dY).y); assertMessageVerticalPosition( (SequenceMessageEditPart) returnMessageOfE4Bot.part(), returnMessageOfE4Bounds.getTranslated(0, dY).y); validateOrdering(24); return dY; }