Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2022-07-20 13:24:02 +0000
committerLaurent Redor2022-07-20 13:32:56 +0000
commitfa07a218e1348571c049ba7a3f87d48e73259504 (patch)
tree442390df2301274b131ae48c9bb44a616a0acb54
parent8231aff182a746452f00fe136b1a062c6873d8c1 (diff)
downloadorg.eclipse.sirius-fa07a218e1348571c049ba7a3f87d48e73259504.tar.gz
org.eclipse.sirius-fa07a218e1348571c049ba7a3f87d48e73259504.tar.xz
org.eclipse.sirius-fa07a218e1348571c049ba7a3f87d48e73259504.zip
[471816] Add a corresponding test to validate the fix of bug 471814
The problem of bug 471816 has been fixed a long time ago, indirectly by bug 471814, but this corresponding test has never been merged. Bug: 471816 Change-Id: Ic04d4e0e8480195dcbd8838e001b31de54573ff6 Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/edgeReconnection/Bug467663.aird22
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeReconnectionTests.java130
2 files changed, 151 insertions, 1 deletions
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/edgeReconnection/Bug467663.aird b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/edgeReconnection/Bug467663.aird
index d28b866352..d0bcef904a 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/edgeReconnection/Bug467663.aird
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/edgeReconnection/Bug467663.aird
@@ -13,7 +13,7 @@
<description xmi:type="description_1:DiagramDescription" href="Bug467663.odesign#//@ownedViewpoints[name='ComponentViewpointForBug467663']/@ownedRepresentations[name='DiagramForBug467663']"/>
<target xmi:type="ecore:EPackage" href="Bug467663.ecore#/"/>
</ownedRepresentationDescriptors>
- <ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_XRr8APb2EeyRspMicPuGiw" name="new DiagramForBug467663WithRectilinear" repPath="#_i7bPcBXREeWwcbvMkwT-CQ" changeId="32b1e427-c8e2-489d-a3c0-de5a0613fe86">
+ <ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_XRr8APb2EeyRspMicPuGiw" name="new DiagramForBug467663WithRectilinear" repPath="#_i7bPcBXREeWwcbvMkwT-CQ" changeId="e941f894-4765-4528-bdb2-e98b0c7fed9c">
<description xmi:type="description_1:DiagramDescription" href="Bug467663.odesign#//@ownedViewpoints[name='ComponentViewpointForBug467663']/@ownedRepresentations[name='DiagramForBug467663']"/>
<target xmi:type="ecore:EPackage" href="Bug467663.ecore#/"/>
</ownedRepresentationDescriptors>
@@ -695,6 +695,15 @@
<styles xmi:type="notation:ShapeStyle" xmi:id="_i7bPjxXREeWwcbvMkwT-CQ" fontName="Cantarell" fontHeight="8"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_i7bPkBXREeWwcbvMkwT-CQ" x="485" y="45" width="288" height="248"/>
</children>
+ <children xmi:type="notation:Node" xmi:id="_svA9QgguEe2Pe4F27G9wVQ" type="2002" element="_su_IFAguEe2Pe4F27G9wVQ">
+ <children xmi:type="notation:Node" xmi:id="_svBkUAguEe2Pe4F27G9wVQ" type="5006"/>
+ <children xmi:type="notation:Node" xmi:id="_svBkUQguEe2Pe4F27G9wVQ" type="7001">
+ <styles xmi:type="notation:SortingStyle" xmi:id="_svBkUgguEe2Pe4F27G9wVQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_svBkUwguEe2Pe4F27G9wVQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_svA9QwguEe2Pe4F27G9wVQ" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_vbBQgAguEe2Pe4F27G9wVQ" x="790" y="45" width="117" height="248"/>
+ </children>
<styles xmi:type="notation:DiagramStyle" xmi:id="_i7bPkRXREeWwcbvMkwT-CQ"/>
<edges xmi:type="notation:Edge" xmi:id="_i7bPkhXREeWwcbvMkwT-CQ" type="4001" element="_i7bPshXREeWwcbvMkwT-CQ" source="_i7bPeBXREeWwcbvMkwT-CQ" target="_i7bPdRXREeWwcbvMkwT-CQ">
<children xmi:type="notation:Node" xmi:id="_i7bPkxXREeWwcbvMkwT-CQ" type="6001">
@@ -811,6 +820,17 @@
</ownedStyle>
<actualMapping xmi:type="description_1:EdgeMapping" href="Bug467663.odesign#//@ownedViewpoints[name='ComponentViewpointForBug467663']/@ownedRepresentations[name='DiagramForBug467663']/@defaultLayer/@edgeMappings[name='ETypeMapping']"/>
</ownedDiagramElements>
+ <ownedDiagramElements xmi:type="diagram:DNodeContainer" uid="_su_IFAguEe2Pe4F27G9wVQ" name="EClassKO">
+ <target xmi:type="ecore:EClass" href="Bug467663.ecore#//EClassKO"/>
+ <semanticElements xmi:type="ecore:EClass" href="Bug467663.ecore#//EClassKO"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_su_IFQguEe2Pe4F27G9wVQ" borderSize="1" borderSizeComputationExpression="1">
+ <description xmi:type="style:FlatContainerStyleDescription" href="Bug467663.odesign#//@ownedViewpoints[name='ComponentViewpointForBug467663']/@ownedRepresentations[name='DiagramForBug467663']/@defaultLayer/@containerMappings[name='EClassMapping']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:ContainerMapping" href="Bug467663.odesign#//@ownedViewpoints[name='ComponentViewpointForBug467663']/@ownedRepresentations[name='DiagramForBug467663']/@defaultLayer/@containerMappings[name='EClassMapping']"/>
+ </ownedDiagramElements>
<description xmi:type="description_1:DiagramDescription" href="Bug467663.odesign#//@ownedViewpoints[name='ComponentViewpointForBug467663']/@ownedRepresentations[name='DiagramForBug467663']"/>
<filterVariableHistory xmi:type="diagram:FilterVariableHistory" uid="_i7bPuBXREeWwcbvMkwT-CQ"/>
<activatedLayers xmi:type="description_1:Layer" href="Bug467663.odesign#//@ownedViewpoints[name='ComponentViewpointForBug467663']/@ownedRepresentations[name='DiagramForBug467663']/@defaultLayer"/>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeReconnectionTests.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeReconnectionTests.java
index ad9fa862a1..ca553b7c9a 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeReconnectionTests.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeReconnectionTests.java
@@ -31,6 +31,7 @@ import org.eclipse.sirius.diagram.ui.internal.edit.parts.DDiagramEditPart;
import org.eclipse.sirius.tests.support.api.GraphicTestsSupportHelp;
import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase;
import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource;
+import org.eclipse.sirius.tests.swtbot.support.api.condition.CheckSelectedCondition;
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;
@@ -59,6 +60,8 @@ public class EdgeReconnectionTests extends AbstractSiriusSwtBotGefTestCase {
private static final String REPRESENTATION2_NAME = "DiagramForBug467663Bis";
+ private static final String REPRESENTATION3_NAME = "DiagramForBug467663WithRectilinear";
+
/**
* A selection listener to detect if the diagram is selected during the reconnection of an edge.
*
@@ -363,6 +366,133 @@ public class EdgeReconnectionTests extends AbstractSiriusSwtBotGefTestCase {
}
/**
+ * Test reconnection of target edge end point from a container to another
+ * with rectilinear style routing.
+ */
+ public void testSimpleEdgeSourceReconnectionWithRectilinearStyleRouting() {
+ editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION1_NAME, "new " + REPRESENTATION3_NAME, DDiagram.class, true);
+ SWTBotGefEditPart eClass1EditPartBot = editor.getEditPart("EClass1", AbstractDiagramContainerEditPart.class);
+ SWTBotGefEditPart eClass2EditPartBot = editor.getEditPart("EClass2", AbstractDiagramContainerEditPart.class);
+ SWTBotGefEditPart ref1EditPartBot = editor.getEditPart("ref1", AbstractDiagramContainerEditPart.class);
+ SWTBotGefEditPart ref2EditPartBot = editor.getEditPart("ref2", AbstractDiagramContainerEditPart.class);
+ SWTBotGefEditPart ref3EditPartBot = editor.getEditPart("ref3", AbstractDiagramContainerEditPart.class);
+ SWTBotGefEditPart ref4EditPartBot = editor.getEditPart("ref4", AbstractDiagramContainerEditPart.class);
+ SWTBotGefConnectionEditPart connection1EditPartBot = editor.getConnectionEditPart(ref1EditPartBot, eClass1EditPartBot).get(0);
+ SWTBotGefConnectionEditPart connection2EditPartBot = editor.getConnectionEditPart(ref2EditPartBot, eClass1EditPartBot).get(0);
+
+ // Reconnect target of first connection
+ PointList connection1Points = ((AbstractConnectionEditPart) connection1EditPartBot.part()).getConnectionFigure().getPoints().getCopy();
+ Point from = connection1Points.getLastPoint();
+ Point to = from.getCopy().setX(editor.getBounds(eClass2EditPartBot).x);
+ connection1EditPartBot.select();
+ bot.waitUntil(new CheckSelectedCondition(editor, connection1EditPartBot.part()));
+ editor.drag(from, to);
+ // Check that reconnection is correct
+ assertEquals(0, editor.getConnectionEditPart(ref1EditPartBot, eClass1EditPartBot).size());
+ List<SWTBotGefConnectionEditPart> newConnection1EditPartBotList = editor.getConnectionEditPart(ref1EditPartBot, eClass2EditPartBot);
+ assertEquals(1, newConnection1EditPartBotList.size());
+ SWTBotGefConnectionEditPart newConnection1EditPartBot = newConnection1EditPartBotList.get(0);
+ PointList newConnection1Points = ((AbstractConnectionEditPart) newConnection1EditPartBot.part()).getConnectionFigure().getPoints();
+ assertEquals(2, newConnection1Points.size());
+ // Dimension delta = new Dimension(1, 2);
+ assertEquals("After reconnection source end point is not at the correct position.", connection1Points.getFirstPoint(), newConnection1Points.getFirstPoint());
+ assertEquals("After reconnection target end point is not at the correct position.", to, newConnection1Points.getLastPoint());
+ connection1EditPartBot = newConnection1EditPartBot;
+
+ // Reconnect target of second connection
+ PointList connection2Points = ((AbstractConnectionEditPart) connection2EditPartBot.part()).getConnectionFigure().getPoints().getCopy();
+ from = connection2Points.getLastPoint();
+ to = from.getCopy().setX(editor.getBounds(eClass2EditPartBot).x);
+ connection2EditPartBot.select();
+ bot.waitUntil(new CheckSelectedCondition(editor, connection2EditPartBot.part()));
+ editor.drag(from, to);
+ // Check that reconnection is correct
+ assertEquals(0, editor.getConnectionEditPart(ref2EditPartBot, eClass1EditPartBot).size());
+ List<SWTBotGefConnectionEditPart> newConnection2EditPartBotList = editor.getConnectionEditPart(ref2EditPartBot, eClass2EditPartBot);
+ assertEquals(1, newConnection2EditPartBotList.size());
+ SWTBotGefConnectionEditPart newConnection2EditPartBot = newConnection2EditPartBotList.get(0);
+ PointList newConnection2Points = ((AbstractConnectionEditPart) newConnection2EditPartBot.part()).getConnectionFigure().getPoints();
+ assertEquals(2, newConnection2Points.size());
+ GraphicTestsSupportHelp.assertEquals("After reconnection source end point is not at the correct position.", connection2Points.getFirstPoint(), newConnection2Points.getFirstPoint(), 1, 2);
+ GraphicTestsSupportHelp.assertEquals("After reconnection target end point is not at the correct position.", to, newConnection2Points.getLastPoint(), 1, 2);
+ connection2EditPartBot = newConnection2EditPartBot;
+
+ // Reconnect target of first connection as initially
+ connection1Points = ((AbstractConnectionEditPart) connection1EditPartBot.part()).getConnectionFigure().getPoints().getCopy();
+ from = connection1Points.getLastPoint();
+ to = from.getCopy().setX(editor.getBounds(eClass1EditPartBot).getRight().x - 2);
+ connection1EditPartBot.select();
+ bot.waitUntil(new CheckSelectedCondition(editor, connection1EditPartBot.part()));
+ editor.drag(from, to);
+ // Check that reconnection is correct
+ assertEquals(0, editor.getConnectionEditPart(ref1EditPartBot, eClass2EditPartBot).size());
+ newConnection1EditPartBotList = editor.getConnectionEditPart(ref1EditPartBot, eClass1EditPartBot);
+ assertEquals(1, newConnection1EditPartBotList.size());
+ newConnection1EditPartBot = newConnection1EditPartBotList.get(0);
+ newConnection1Points = ((AbstractConnectionEditPart) newConnection1EditPartBot.part()).getConnectionFigure().getPoints();
+ assertEquals(2, newConnection1Points.size());
+ GraphicTestsSupportHelp.assertEquals("After reconnection source end point is not at the correct position.", connection1Points.getFirstPoint(), newConnection1Points.getFirstPoint(), 1, 2);
+ GraphicTestsSupportHelp.assertEquals("After reconnection target end point is not at the correct position.", to, newConnection1Points.getLastPoint(), 1, 2);
+ connection1EditPartBot = newConnection1EditPartBot;
+
+ // Reconnect target of second connection as initially
+ connection2Points = ((AbstractConnectionEditPart) connection2EditPartBot.part()).getConnectionFigure().getPoints().getCopy();
+ from = connection2Points.getLastPoint();
+ to = from.getCopy().setX(editor.getBounds(eClass1EditPartBot).getRight().x - 2);
+ connection2EditPartBot.select();
+ bot.waitUntil(new CheckSelectedCondition(editor, connection2EditPartBot.part()));
+ editor.drag(from, to);
+ // Check that reconnection is correct
+ assertEquals(0, editor.getConnectionEditPart(ref2EditPartBot, eClass2EditPartBot).size());
+ newConnection2EditPartBotList = editor.getConnectionEditPart(ref2EditPartBot, eClass1EditPartBot);
+ assertEquals(1, newConnection2EditPartBotList.size());
+ newConnection2EditPartBot = newConnection2EditPartBotList.get(0);
+ newConnection2Points = ((AbstractConnectionEditPart) newConnection2EditPartBot.part()).getConnectionFigure().getPoints();
+ assertEquals(2, newConnection2Points.size());
+ GraphicTestsSupportHelp.assertEquals("After reconnection source end point is not at the correct position.", connection2Points.getFirstPoint(), newConnection2Points.getFirstPoint(), 1, 2);
+ GraphicTestsSupportHelp.assertEquals("After reconnection target end point is not at the correct position.", to, newConnection2Points.getLastPoint(), 1, 2);
+ connection2EditPartBot = newConnection2EditPartBot;
+
+ // Reconnect source of first connection
+ connection1Points = ((AbstractConnectionEditPart) connection1EditPartBot.part()).getConnectionFigure().getPoints().getCopy();
+ from = connection1Points.getFirstPoint();
+ to = from.getCopy().setX(editor.getBounds(ref3EditPartBot).x);
+ connection1EditPartBot.select();
+ bot.waitUntil(new CheckSelectedCondition(editor, connection1EditPartBot.part()));
+ editor.drag(from, to);
+ // Check that reconnection is correct
+ assertEquals(0, editor.getConnectionEditPart(ref1EditPartBot, eClass1EditPartBot).size());
+ newConnection1EditPartBotList = editor.getConnectionEditPart(ref3EditPartBot, eClass1EditPartBot);
+ assertEquals(1, newConnection1EditPartBotList.size());
+ newConnection1EditPartBot = newConnection1EditPartBotList.get(0);
+ newConnection1Points = ((AbstractConnectionEditPart) newConnection1EditPartBot.part()).getConnectionFigure().getPoints();
+ assertEquals(2, newConnection1Points.size());
+ GraphicTestsSupportHelp.assertEquals("After reconnection source end point is not at the correct position.", to, newConnection1Points.getFirstPoint(), 0, 2);
+ // GraphicTestsSupportHelp.assertEquals("After reconnection target end point is not at the correct position.", connection1Points.getLastPoint(),
+ // newConnection1Points.getLastPoint(), 0, 2);
+ connection1EditPartBot = newConnection1EditPartBot;
+
+ // Reconnect source of second connection
+ connection2Points = ((AbstractConnectionEditPart) connection2EditPartBot.part()).getConnectionFigure().getPoints().getCopy();
+ from = connection2Points.getFirstPoint();
+ to = from.getCopy().setX(editor.getBounds(ref4EditPartBot).x);
+ connection2EditPartBot.select();
+ bot.waitUntil(new CheckSelectedCondition(editor, connection2EditPartBot.part()));
+ editor.drag(from, to);
+ // Check that reconnection is correct
+ assertEquals(0, editor.getConnectionEditPart(ref2EditPartBot, eClass1EditPartBot).size());
+ newConnection2EditPartBotList = editor.getConnectionEditPart(ref4EditPartBot, eClass1EditPartBot);
+ assertEquals(1, newConnection2EditPartBotList.size());
+ newConnection2EditPartBot = newConnection2EditPartBotList.get(0);
+ newConnection2Points = ((AbstractConnectionEditPart) newConnection2EditPartBot.part()).getConnectionFigure().getPoints();
+ assertEquals(2, newConnection2Points.size());
+ GraphicTestsSupportHelp.assertEquals("After reconnection source end point is not at the correct position.", to, newConnection2Points.getFirstPoint(), 0, 1);
+ // GraphicTestsSupportHelp.assertEquals("After reconnection target end point is not at the correct position.", connection2Points.getLastPoint(),
+ // newConnection2Points.getLastPoint(), 0, 1);
+ connection2EditPartBot = newConnection2EditPartBot;
+ }
+
+ /**
* Test reconnection of source edge port from a container to another with oblique style routing.
*/
public void testEdgeWithPortSourceDnDWithObliqueStyleRouting() {

Back to the top