diff options
| author | Laurent Redor | 2017-08-24 09:52:25 +0000 |
|---|---|---|
| committer | Laurent Redor | 2017-08-31 08:46:13 +0000 |
| commit | d8c7667824651c5776c402236724e68f1150a931 (patch) | |
| tree | c0e755f326bba8a7156224968d6888b4e2b030c1 | |
| parent | 7a13d1bdb44e11b9d96cce887867791c6f456c81 (diff) | |
| download | org.eclipse.sirius-d8c7667824651c5776c402236724e68f1150a931.tar.gz org.eclipse.sirius-d8c7667824651c5776c402236724e68f1150a931.tar.xz org.eclipse.sirius-d8c7667824651c5776c402236724e68f1150a931.zip | |
[521356] Add tests to reveal the problem
Bug: 521356
Change-Id: Icbe118fdfe2b99238eeac76cbdf9b4a827d0d097
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
2 files changed, 59 insertions, 3 deletions
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/AbstractSequenceDiagramTestCase.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/AbstractSequenceDiagramTestCase.java index 98151989c7..e94df1b6ed 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/AbstractSequenceDiagramTestCase.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/AbstractSequenceDiagramTestCase.java @@ -1477,8 +1477,8 @@ public abstract class AbstractSequenceDiagramTestCase extends AbstractSiriusSwtB GraphicalHelper.screen2logical(bottom, isep); } - assertEquals(errorLabel + "do not have the good range lower bound.", top.y, range.getLowerBound(), 1); - assertEquals(errorLabel + "do not have the good range upper bound.", bottom.y, range.getUpperBound(), 2); + assertEquals(errorLabel + " do not have the good range lower bound.", top.y, range.getLowerBound(), 1); + assertEquals(errorLabel + " do not have the good range upper bound.", bottom.y, range.getUpperBound(), 2); if (ise instanceof Message) { SequenceMessageViewQuery query = new SequenceMessageViewQuery(((Message) ise).getNotationEdge()); diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/ExecutionTests.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/ExecutionTests.java index 7df59d466a..69cbe25d01 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/ExecutionTests.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/sequence/ExecutionTests.java @@ -824,7 +824,7 @@ public class ExecutionTests extends AbstractDefaultModelSequenceTests { arrangeAll(); editor.maximize(); // Create first execution on lifeLine A - createExecutionWithResult(new Point(getLifelineScreenX(LIFELINE_A), 150)).get(); + SWTBotGefEditPart firstExecutionA = createExecutionWithResult(new Point(getLifelineScreenX(LIFELINE_A), 150)).get(); Rectangle firstExecutionBoundsA = assertExecutionHasValidScreenBounds(LIFELINE_A, 0, new Rectangle(0, 150, 0, 30), false); // Create second execution on lifeLine A SWTBotGefEditPart secondExecutionA = createExecutionWithResult(new Point(getLifelineScreenX(LIFELINE_A), 250)).get(); @@ -909,6 +909,14 @@ public class ExecutionTests extends AbstractDefaultModelSequenceTests { secondExecutionBoundsAResize = new Rectangle(secondExecutionBoundsA.x, secondExecutionBoundsA.y, secondExecutionBoundsA.width, secondExecutionBoundsA.height); assertExecutionHasValidScreenBounds(LIFELINE_A, 2, thirdExecutionBoundsAResize, true); assertExecutionHasValidScreenBounds(LIFELINE_A, 1, secondExecutionBoundsAResize, true); + + // Resize first execution on the life line bound limit. This action is + // forbidden. + editor.select(firstExecutionA); + bot.waitUntil(new CheckSelectedCondition(editor, firstExecutionA.part())); + editor.drag(firstExecutionBoundsA.getTop(), firstExecutionBoundsA.getTop().x, getBounds(LIFELINE_A, true).getBottom().y + LayoutConstants.TIME_START_MIN_OFFSET - 1); + bot.sleep(500); + assertExecutionHasValidScreenBounds(LIFELINE_A, 0, firstExecutionBoundsA, true); } /** @@ -1188,6 +1196,54 @@ public class ExecutionTests extends AbstractDefaultModelSequenceTests { } /** + * Test move execution in combinedFragment and on life line. + * <p> + * Step 1 : Resize execution in limits of Operand upper bounds. This + * operation is forbidden. + * <p> + * Step 2 : Resize execution in combinedFragment + */ + public void test_Resize_In_CombinedFragment() { + editor.reveal(LIFELINE_A); + arrangeAll(); + editor.maximize(); + + int positionXBeforeLifeLineA = getLifelineScreenX(LIFELINE_A) - 20; + int positionXAfterLifeLineA = getLifelineScreenX(LIFELINE_A) + 20; + Point pointBefore = new Point(positionXBeforeLifeLineA, 200); + Point pointAfter = new Point(positionXAfterLifeLineA, 200); + + // Create combined fragment on life line A + SWTBotGefEditPart combinedFragmentA = createCombinedFragmentWithResult(pointBefore, pointAfter); + Rectangle combinedFragmentBoundsA = editor.getBounds(combinedFragmentA); + assertEquals("the combinedFragment position is wrong", 200, combinedFragmentBoundsA.getTop().y); + + // Create execution in CombinedFragment + SWTBotGefEditPart executionB = createExecutionWithResult(combinedFragmentBoundsA.getCenter().x, combinedFragmentBoundsA.getCenter().y).get(); + Rectangle executionBoundsB = editor.getBounds(executionB); + assertEquals("the execution position is wrong", combinedFragmentBoundsA.getCenter().y, executionBoundsB.getTop().y); + + // Resize execution in combined fragment, near the upper bound of the + // Operand (it's forbidden) + int limitAuthorized = combinedFragmentBoundsA.getTop().y + LayoutConstants.COMBINED_FRAGMENT_TITLE_HEIGHT + LayoutConstants.EXECUTION_CHILDREN_MARGIN; + int previousExecutionTop = executionBoundsB.getTop().y; + editor.drag(executionBoundsB.getTop(), combinedFragmentBoundsA.getCenter().x, limitAuthorized - 1); + bot.sleep(500); + + executionBoundsB = editor.getBounds(executionB); + assertEquals("the execution must not be moved", previousExecutionTop, executionBoundsB.getTop().y); + + // Resize execution in combined fragment, just after the upper bound of + // the Operand + ICondition done = new OperationDoneCondition(); + editor.drag(executionBoundsB.getTop(), combinedFragmentBoundsA.getCenter().x, limitAuthorized); + bot.waitUntil(done); + + executionBoundsB = editor.getBounds(executionB); + assertEquals("the execution must be resized in combined fragment", limitAuthorized, executionBoundsB.getTop().y); + } + + /** * {@inheritDoc} */ @Override |
