Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2017-08-17 14:15:16 +0000
committerFlorian Barbin2017-08-25 14:37:07 +0000
commit13b05cd1d99cceae86c94241d333dcd79f489d04 (patch)
tree04280c0c63ce96d2a57030ab36b9454447e044cb
parent69c1fb1fbcd980be8282cc8ac84ce8b3f4996202 (diff)
downloadorg.eclipse.sirius-13b05cd1d99cceae86c94241d333dcd79f489d04.tar.gz
org.eclipse.sirius-13b05cd1d99cceae86c94241d333dcd79f489d04.tar.xz
org.eclipse.sirius-13b05cd1d99cceae86c94241d333dcd79f489d04.zip
[520881] Add sub EdgeLayoutData to handle edge creation with border node
The main goal of this commit is to add a sub EdgeLayoutData to handle correctly the specific case of edge creation with associated border nodes. We only discover if data is needed for border nodes during the real GMF View creation (DDiagramCanonicalSynchronizer). So we must store 2 data during the tool execution and choose the right one at creation. Bug: 520881 Change-Id: I8ea842845277684dc29bd0cf4b53a5feace987ef Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/EdgeLayoutData.java31
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/SiriusLayoutDataManagerImpl.java37
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SiriusGraphicalNodeEditPolicy.java69
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.html8
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile5
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/images/borderNodesWithSnapToGrid.pngbin0 -> 1237218 bytes
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionTest.java15
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionWithSnapToGridTest.java7
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionTest.java178
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionWithSnapToGridTest.java182
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllCreationTestSuite.java2
11 files changed, 441 insertions, 93 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/EdgeLayoutData.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/EdgeLayoutData.java
index 17e13c4211..e3bdf57168 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/EdgeLayoutData.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/EdgeLayoutData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2009 THALES GLOBAL SERVICES.
+ * Copyright (c) 2009, 2017 THALES GLOBAL SERVICES.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -78,6 +78,14 @@ public class EdgeLayoutData extends AbstractEdgeLayoutData {
private LayoutData edgeTargetLayoutData;
/**
+ * A secondary edgeLayoutData that can replace the current if it must be used for edge created directly with
+ * associated border nodes. In this case, the placement rule is not the same, the source and target location must be
+ * stored to allow later computation. The source and target point stored in this layout data is only the nearest
+ * grid location from the original click (the computation for border nodes are done later when consuming the data).
+ */
+ private EdgeLayoutData edgeLayoutDataForBorderNodes;
+
+ /**
* Constructor.
*
* @param parent
@@ -305,6 +313,27 @@ public class EdgeLayoutData extends AbstractEdgeLayoutData {
}
/**
+ * Set the layout data that will replace the current one if the edge to create is created in the same time as its
+ * border nodes.
+ *
+ * @param edgeLayoutDataForBorderNodes
+ * The EdgeLayoutData to set
+ */
+ public void setEdgeLayoutDataForBorderNodes(EdgeLayoutData edgeLayoutDataForBorderNodes) {
+ this.edgeLayoutDataForBorderNodes = edgeLayoutDataForBorderNodes;
+ }
+
+ /**
+ * Get the layout data that will replace the current one if the edge to create is created in the same time as its
+ * border nodes.
+ *
+ * @return a specific edge layout data
+ */
+ public EdgeLayoutData getEdgeLayoutDataForBorderNodes() {
+ return edgeLayoutDataForBorderNodes;
+ }
+
+ /**
* Get the origin of this layout data:
* <UL>
* <LI>Caused by a move of the source: CAUSED_BY_SOURCE</LI>
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/SiriusLayoutDataManagerImpl.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/SiriusLayoutDataManagerImpl.java
index 5aa2ccd891..2a177cd670 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/SiriusLayoutDataManagerImpl.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/SiriusLayoutDataManagerImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2009, 2017 THALES GLOBAL SERVICES and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -284,18 +284,16 @@ public final class SiriusLayoutDataManagerImpl implements SiriusLayoutDataManage
for (final AbstractLayoutData abstractLayoutData : rootsLayoutData) {
if (abstractLayoutData instanceof EdgeLayoutData) {
EdgeLayoutData edgeLayoutData = (EdgeLayoutData) abstractLayoutData;
- LayoutData edgeSourceLayoutData = edgeLayoutData.getEdgeSourceLayoutData();
- if (edgeSourceLayoutData != null) {
- result = edgeSourceLayoutData.getData(searchNode, ignoreConsumeState);
- }
- if (result == null) {
- LayoutData edgeTargetLayoutData = edgeLayoutData.getEdgeTargetLayoutData();
- if (edgeTargetLayoutData != null) {
- result = edgeTargetLayoutData.getData(searchNode, ignoreConsumeState);
+ // Search if the specific layout data for border nodes is the good one.
+ EdgeLayoutData edgeLayoutDataBN = edgeLayoutData.getEdgeLayoutDataForBorderNodes();
+ if (edgeLayoutDataBN != null) {
+ result = getLayoutDataFromEdgeLayoutData(edgeLayoutDataBN, searchNode);
+ if (result != null) {
+ break;
}
- } else {
- break;
}
+ // Search in the "standard" layout data
+ result = getLayoutDataFromEdgeLayoutData(edgeLayoutData, searchNode);
if (result != null) {
break;
}
@@ -304,6 +302,23 @@ public final class SiriusLayoutDataManagerImpl implements SiriusLayoutDataManage
return result;
}
+ private LayoutData getLayoutDataFromEdgeLayoutData(EdgeLayoutData edgeLayoutData, AbstractDNode searchNode) {
+ LayoutData result = null;
+ if (edgeLayoutData != null) {
+ LayoutData edgeSourceLayoutData = edgeLayoutData.getEdgeSourceLayoutData();
+ if (edgeSourceLayoutData != null) {
+ result = edgeSourceLayoutData.getData(searchNode, ignoreConsumeState);
+ }
+ if (result == null) {
+ LayoutData edgeTargetLayoutData = edgeLayoutData.getEdgeTargetLayoutData();
+ if (edgeTargetLayoutData != null) {
+ result = edgeTargetLayoutData.getData(searchNode, ignoreConsumeState);
+ }
+ }
+ }
+ return result;
+ }
+
/**
* Search recursively in all the LayoutData is there is one which have the
* edge for target.
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SiriusGraphicalNodeEditPolicy.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SiriusGraphicalNodeEditPolicy.java
index 49796b02d7..3114fef9f2 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SiriusGraphicalNodeEditPolicy.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SiriusGraphicalNodeEditPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2016 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2007, 2017 THALES GLOBAL SERVICES and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -865,11 +865,10 @@ public class SiriusGraphicalNodeEditPolicy extends TreeGraphicalNodeEditPolicy {
* the {@link EditPart} that the target end of the connection
* should be connected to.
* @param sourceLocation
- * the location of the first click (relative to the source edit
- * part)
+ * the location of the first click (relative to the source edit part), snapped to grid if feature enabled
* @param targetLocation
- * the location of the second click (relative to the target edit
- * part)
+ * the location of the second click (relative to the target edit part), snapped to grid if feature
+ * enabled
* @return The edge layout data corresponding to the creation request and to
* the snapToGrid state.
*/
@@ -891,23 +890,31 @@ public class SiriusGraphicalNodeEditPolicy extends TreeGraphicalNodeEditPolicy {
// location) and the target node
Option<Point> intersectionTargetPoint = GraphicalHelper.getIntersection(absoluteSourceLocationIn100Percent, absoluteTargetLocationIn100Percent, tgtEditPart, true, true);
// Compute the snap source location and the snap target location
- Point absoluteSourceLocationSnapIn100Percent;
- Point absoluteTargetLocationSnapIn100Percent;
if (intersectionSourcePoint.some() && intersectionTargetPoint.some()) {
- absoluteSourceLocationSnapIn100Percent = snapLocationToGridAndToParentBorder(absoluteSourceLocationIn100Percent, absoluteSourceBoundsIn100Percent, intersectionSourcePoint.get());
- absoluteTargetLocationSnapIn100Percent = snapLocationToGridAndToParentBorder(absoluteTargetLocationIn100Percent, absoluteTargetBoundsIn100Percent, intersectionTargetPoint.get());
+ PointList sourceSnappedPoints = snapLocationToGridAndToParentBorder(absoluteSourceLocationIn100Percent, absoluteSourceBoundsIn100Percent, intersectionSourcePoint.get());
+ PointList targetSnappedPoints = snapLocationToGridAndToParentBorder(absoluteTargetLocationIn100Percent, absoluteTargetBoundsIn100Percent, intersectionTargetPoint.get());
+ EdgeLayoutData edgeLayoutData = createEdgeLayoutData(srcEditPart, tgtEditPart, absoluteSourceBoundsIn100Percent, absoluteTargetBoundsIn100Percent, sourceSnappedPoints.getFirstPoint(),
+ targetSnappedPoints.getFirstPoint());
+ EdgeLayoutData edgeLayoutData2 = createEdgeLayoutData(srcEditPart, tgtEditPart, absoluteSourceBoundsIn100Percent, absoluteTargetBoundsIn100Percent, sourceSnappedPoints.getLastPoint(),
+ targetSnappedPoints.getLastPoint());
+ edgeLayoutData.setEdgeLayoutDataForBorderNodes(edgeLayoutData2);
+ return edgeLayoutData;
} else {
// There is probably a case not handle, use the default layout data
return getEdgeLayoutData(request, sourceEditPart, targetEditPart, sourceLocation, targetLocation);
}
+ }
+ private EdgeLayoutData createEdgeLayoutData(IGraphicalEditPart sourceEditPart, IGraphicalEditPart targetEditPart, Rectangle absoluteSourceBoundsIn100Percent,
+ Rectangle absoluteTargetBoundsIn100Percent, Point absoluteSourceLocationSnapIn100Percent, Point absoluteTargetLocationSnapIn100Percent) {
+ EdgeLayoutData edgeLayoutData;
// Make snap source point relative to the source edit part
Point sourceLocationSnapIn100Percent = getTranslatedToRelative(absoluteSourceLocationSnapIn100Percent, absoluteSourceBoundsIn100Percent);
final LayoutData sourceLayoutData = new RootLayoutData(sourceEditPart, sourceLocationSnapIn100Percent, null);
// Make snap target point relative to the source edit part
Point targetLocationSnapIn100Percent = getTranslatedToRelative(absoluteTargetLocationSnapIn100Percent, absoluteTargetBoundsIn100Percent);
final LayoutData targetLayoutData = new RootLayoutData(targetEditPart, targetLocationSnapIn100Percent, null);
- EdgeLayoutData edgeLayoutData = new EdgeLayoutData(sourceLayoutData, targetLayoutData);
+ edgeLayoutData = new EdgeLayoutData(sourceLayoutData, targetLayoutData);
// Compute the new source terminal anchor
PrecisionPoint sourceTerminalPosition = new PrecisionPoint((double) sourceLocationSnapIn100Percent.x / absoluteSourceBoundsIn100Percent.width,
(double) sourceLocationSnapIn100Percent.y / absoluteSourceBoundsIn100Percent.height);
@@ -921,9 +928,9 @@ public class SiriusGraphicalNodeEditPolicy extends TreeGraphicalNodeEditPolicy {
// Applied the zoom of the current diagram to set the pointList, the
// source reference point and the target reference point.
PrecisionPoint absoluteSourceLocationSnap = new PrecisionPoint(absoluteSourceLocationSnapIn100Percent);
- GraphicalHelper.logical2screen(absoluteSourceLocationSnap, srcEditPart);
+ GraphicalHelper.logical2screen(absoluteSourceLocationSnap, sourceEditPart);
PrecisionPoint absoluteTargteLoactionSnap = new PrecisionPoint(absoluteTargetLocationSnapIn100Percent);
- GraphicalHelper.logical2screen(absoluteTargteLoactionSnap, tgtEditPart);
+ GraphicalHelper.logical2screen(absoluteTargteLoactionSnap, targetEditPart);
edgeLayoutData.setSourceRefPoint(absoluteSourceLocationSnap);
edgeLayoutData.setTargetRefPoint(absoluteTargteLoactionSnap);
@@ -932,23 +939,23 @@ public class SiriusGraphicalNodeEditPolicy extends TreeGraphicalNodeEditPolicy {
pointList.addPoint(absoluteSourceLocationSnap.getCopy());
pointList.addPoint(absoluteTargteLoactionSnap.getCopy());
edgeLayoutData.setPointList(pointList.getCopy());
-
return edgeLayoutData;
}
/**
- * * @param absoluteLocation The location in absolute coordinates (and in
- * 100%)
- *
+ * @param absoluteLocation
+ * The location in absolute coordinates (and in 100%)
* @param absoluteParentBounds
* The parent bounds in absolute coordinates (and in 100%)
* @param intersectionPoint
- * The intersection location in absolute coordinates (and in
- * 100%)
- * @return
+ * The intersection location in absolute coordinates (and in 100%)
+ * @return a list of 2 points: the first is the intersection point snap to grid and to parent border, the second is
+ * snap to grid but on the nearest side of the parent border according to the click location
*/
- private Point snapLocationToGridAndToParentBorder(Point absoluteLocation, Rectangle absoluteParentBounds, Point intersectionPoint) {
- Point absoluteSourceLocationSnapIn100Percent;
+ private PointList snapLocationToGridAndToParentBorder(Point absoluteLocation, Rectangle absoluteParentBounds, Point intersectionPoint) {
+ PointList result = new PointList();
+ Point absoluteLocationSnapIn100PercentOnIntersection;
+ Point absoluteLocationSnapIn100PercentOnNearestSide;
if (intersectionPoint.x == absoluteParentBounds.x || intersectionPoint.x == (absoluteParentBounds.x + absoluteParentBounds.width)) {
int yCoordinate = absoluteLocation.y;
// If y coordinate of absoluteLocation is outside the parent
@@ -959,7 +966,13 @@ public class SiriusGraphicalNodeEditPolicy extends TreeGraphicalNodeEditPolicy {
} else if (yCoordinate > (absoluteParentBounds.y + absoluteParentBounds.height)) {
yCoordinate = absoluteParentBounds.y + absoluteParentBounds.height;
}
- absoluteSourceLocationSnapIn100Percent = new Point(intersectionPoint.x, yCoordinate);
+ absoluteLocationSnapIn100PercentOnIntersection = new Point(intersectionPoint.x, yCoordinate);
+ // Compute the x coordinate according to the nearest parent side
+ int xCoordinate = intersectionPoint.x;
+ if (absoluteLocation.x - absoluteParentBounds.x > absoluteParentBounds.getRight().x - absoluteLocation.x) {
+ xCoordinate = absoluteParentBounds.getRight().x;
+ }
+ absoluteLocationSnapIn100PercentOnNearestSide = absoluteLocation.getCopy();
} else {
int xCoordinate = absoluteLocation.x;
// If x coordinate of absoluteLocation is outside the parent
@@ -970,9 +983,17 @@ public class SiriusGraphicalNodeEditPolicy extends TreeGraphicalNodeEditPolicy {
} else if (xCoordinate > (absoluteParentBounds.x + absoluteParentBounds.width)) {
xCoordinate = absoluteParentBounds.x + absoluteParentBounds.width;
}
- absoluteSourceLocationSnapIn100Percent = new Point(xCoordinate, intersectionPoint.y);
+ absoluteLocationSnapIn100PercentOnIntersection = new Point(xCoordinate, intersectionPoint.y);
+ // Compute the y coordinate according to the nearest parent side
+ int yCoordinate = absoluteLocation.y;
+ if (absoluteLocation.y - absoluteParentBounds.y > absoluteParentBounds.getBottom().y - absoluteLocation.y) {
+ yCoordinate = absoluteParentBounds.getBottom().y;
+ }
+ absoluteLocationSnapIn100PercentOnNearestSide = absoluteLocation.getCopy();
}
- return absoluteSourceLocationSnapIn100Percent;
+ result.addPoint(absoluteLocationSnapIn100PercentOnIntersection);
+ result.addPoint(absoluteLocationSnapIn100PercentOnNearestSide);
+ return result;
}
/**
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
index 3109160c80..e5589ef31f 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
@@ -123,8 +123,14 @@
<li><span class="label label-success">Added</span> The user now have a drop down menu in the tabbar with all available straighten to edge actions. </li>
<li><span class="label label-success">Added</span> Straighten to actions on edge are now available even if the selection contains incompatible elements (edge labels for example). Their execution affects only compatible edges.</li>
<li><span class="label label-success">Added</span> Four new straighten actions are available (with top pinned, with bottom pinned, with left pinned, with right pinned) and allow to straighten edges from the opposed straightening axis point of view.</li>
- <li><span class="label label-info">Modified</span> In a diagram, when selecting an edge or a node that are not fully displayed in the editor, now, the reveal is not done anymore, that is, the displayed content of the editor is not moved anymore. If the user want to fully see the selected element, he may drag the editor content using center mouse button.</li>
+ <li><span class="label label-info">Modified</span> In a diagram, when selecting an edge or a node that are not fully displayed in the editor, now, the reveal is not done anymore, that is, the displayed content of the editor is not moved anymore. If the user want to fully see the selected element, he may drag the editor content using center mouse button. </li>
+ <li><span class="label label-info">Modified</span> In a diagram with
+ <em>snapToGrid</em> enabled, when you create an edge with a tool that also create the associated border nodes, the border nodes are now snapped near the click location. Before, it was created to respect a shortest path.
+ </li>
</ul>
+ <p>
+ <img border="0" src="./images/borderNodesWithSnapToGrid.png"/>
+ </p>
<h3 id="SpecifierVisibleChanges">Specifier-Visible Changes</h3>
<ul>
<li><span class="label label-success">Added</span> An
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
index 37aefb75aa..30b082236b 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
@@ -13,8 +13,9 @@ h3. User-Visible Changes
* <span class="label label-success">Added</span> The user now have a drop down menu in the tabbar with all available straighten to edge actions.
* <span class="label label-success">Added</span> Straighten to actions on edge are now available even if the selection contains incompatible elements (edge labels for example). Their execution affects only compatible edges.
* <span class="label label-success">Added</span> Four new straighten actions are available (with top pinned, with bottom pinned, with left pinned, with right pinned) and allow to straighten edges from the opposed straightening axis point of view.
-* <span class="label label-info">Modified</span> In a diagram, when selecting an edge or a node that are not fully displayed in the editor, now, the reveal is not done anymore, that is, the displayed content of the editor is not moved anymore. If the user want to fully see the selected element, he may drag the editor content using center mouse button.
-
+* <span class="label label-info">Modified</span> In a diagram, when selecting an edge or a node that are not fully displayed in the editor, now, the reveal is not done anymore, that is, the displayed content of the editor is not moved anymore. If the user want to fully see the selected element, he may drag the editor content using center mouse button.
+* <span class="label label-info">Modified</span> In a diagram with _snapToGrid_ enabled, when you create an edge with a tool that also create the associated border nodes, the border nodes are now snapped near the click location. Before, it was created to respect a shortest path.
+!./images/borderNodesWithSnapToGrid.png!
h3. Specifier-Visible Changes
diff --git a/plugins/org.eclipse.sirius.doc/doc/images/borderNodesWithSnapToGrid.png b/plugins/org.eclipse.sirius.doc/doc/images/borderNodesWithSnapToGrid.png
new file mode 100644
index 0000000000..b7a82f2855
--- /dev/null
+++ b/plugins/org.eclipse.sirius.doc/doc/images/borderNodesWithSnapToGrid.png
Binary files differ
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionTest.java
index 647e57cdaf..203e35625f 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionTest.java
@@ -117,6 +117,13 @@ public class EdgeCreationPositionTest extends AbstractSiriusSwtBotGefTestCase {
createEdgeAndValidateAnchors("Node", "A", AbstractDiagramNodeEditPart.class, "B", AbstractDiagramNodeEditPart.class);
}
+ /**
+ * Same as test_Container_Aligned() but with a specific zoom.
+ */
+ public void test_Node_WithZoom() {
+ createEdgeAndValidateAnchors("Node", "A", AbstractDiagramNodeEditPart.class, TOP_LEFT_CORNER, "B", AbstractDiagramNodeEditPart.class, BOTTOM_RIGHT_CORNER, ZoomLevel.ZOOM_200);
+ }
+
/** */
public void test_Node_WithRectilinearEdge() {
changeDiagramPreference(SiriusDiagramCorePreferences.PREF_ENABLE_OVERRIDE, true);
@@ -279,7 +286,7 @@ public class EdgeCreationPositionTest extends AbstractSiriusSwtBotGefTestCase {
IGraphicalEditPart targetPart = (IGraphicalEditPart) editor.getEditPart(targetName, expectedTargetType).part();
createEdge(sourcePart, sourcePosition, targetPart, targetPosition, getCreateEdgeToolName());
DEdgeEditPart edge = getSingleDEdgeFrom((NodeEditPart) sourcePart);
- assertAreValidAnchors(sourcePart, targetPart, edge);
+ assertAreValidAnchors(sourcePart, sourcePosition, targetPart, targetPosition, edge);
if (!ZoomLevel.ZOOM_100.equals(zoomLevel)) {
// Reset to original zoom to avoid problem in further tests
editor.zoom(ZoomLevel.ZOOM_100);
@@ -333,12 +340,16 @@ public class EdgeCreationPositionTest extends AbstractSiriusSwtBotGefTestCase {
/**
* @param source
* The source of the edge
+ * @param sourcePosition
+ * The position for the first point of the edge (source)
* @param target
* The target of the edge
+ * @param targetPosition
+ * The position for the last point of the edge (target)
* @param edge
* Edge to consider
*/
- protected void assertAreValidAnchors(IGraphicalEditPart source, IGraphicalEditPart target, DEdgeEditPart edge) {
+ protected void assertAreValidAnchors(IGraphicalEditPart source, PrecisionPoint sourcePosition, IGraphicalEditPart target, PrecisionPoint targetPosition, DEdgeEditPart edge) {
assertAreValidAnchorsAndBendpoints(source, target, edge);
}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionWithSnapToGridTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionWithSnapToGridTest.java
index 36e982398b..2147870afe 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionWithSnapToGridTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionWithSnapToGridTest.java
@@ -13,6 +13,7 @@ package org.eclipse.sirius.tests.swtbot;
import org.eclipse.draw2d.Connection;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.PrecisionPoint;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.sirius.diagram.ui.internal.edit.parts.DEdgeEditPart;
@@ -42,8 +43,8 @@ public class EdgeCreationPositionWithSnapToGridTest extends EdgeCreationPosition
}
@Override
- protected void assertAreValidAnchors(IGraphicalEditPart source, IGraphicalEditPart target, DEdgeEditPart edge) {
- super.assertAreValidAnchors(source, target, edge);
+ protected void assertAreValidAnchors(IGraphicalEditPart source, PrecisionPoint sourcePosition, IGraphicalEditPart target, PrecisionPoint targetPosition, DEdgeEditPart edge) {
+ super.assertAreValidAnchors(source, sourcePosition, target, targetPosition, edge);
// Check that at least
// * the x coordinate is on the grid
// * or the y coordinate is on the grid
@@ -60,7 +61,7 @@ public class EdgeCreationPositionWithSnapToGridTest extends EdgeCreationPosition
private boolean checkLocation(Point location, IGraphicalEditPart parentPart) {
boolean result = (location.x % gridStep) == 0 || (location.y % gridStep) == 0;
if (!result) {
- Rectangle parentBounds = GraphicalHelper.getAbsoluteBoundsIn100Percent(parentPart);
+ Rectangle parentBounds = GraphicalHelper.getAbsoluteBoundsIn100Percent(parentPart, true);
result = (location.x == parentBounds.x || location.x == (parentBounds.x + parentBounds.width)) && (location.y == parentBounds.y || location.y == (parentBounds.y + parentBounds.height));
}
return result;
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionTest.java
new file mode 100644
index 0000000000..0d174e771e
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionTest.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2017 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.tests.swtbot;
+
+import java.util.NoSuchElementException;
+
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.PrecisionPoint;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.NodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.notation.Routing;
+import org.eclipse.sirius.diagram.DEdge;
+import org.eclipse.sirius.diagram.ui.business.internal.query.DEdgeQuery;
+import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramBorderNodeEditPart;
+import org.eclipse.sirius.diagram.ui.internal.edit.parts.DEdgeEditPart;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+
+import com.google.common.collect.Iterables;
+
+/**
+ * Same tests as {@link EdgeCreationPositionTest} but with border nodes at the
+ * ends of the edge.
+ *
+ * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a>
+ */
+public class EdgeWithBorderNodeCreationPositionTest extends EdgeCreationPositionTest {
+
+ /**
+ * Possibility to override computed value in
+ * {@link #checkSide(PrecisionPoint, IGraphicalEditPart, int)} by a specific
+ * one. This value must be reset to PositionConstants.NONE at the end of the
+ * test it it is changed.
+ */
+ protected int sourceSide = PositionConstants.NONE;
+
+ /**
+ * Possibility to override computed value in
+ * {@link #checkSide(PrecisionPoint, IGraphicalEditPart, int)} by a specific
+ * one. This value must be reset to PositionConstants.NONE at the end of the
+ * test it it is changed.
+ */
+ protected int targetSide = PositionConstants.NONE;
+
+ @Override
+ protected String getCreateEdgeToolName() {
+ return "SuperWithBorderNode";
+ }
+
+ @Override
+ protected DEdgeEditPart getSingleDEdgeFrom(NodeEditPart sourcePart) {
+ // Get the new source border node
+ AbstractDiagramBorderNodeEditPart sourceBorderNode = getBorderNode(sourcePart);
+ assertEquals(1, sourceBorderNode.getSourceConnections().size());
+ ConnectionEditPart edge = (ConnectionEditPart) sourceBorderNode.getSourceConnections().get(0);
+ assertTrue(edge instanceof DEdgeEditPart);
+ return (DEdgeEditPart) edge;
+ }
+
+ /**
+ * Get the only one border node of this parent.
+ *
+ * @param parent
+ * The edit part containing the border node
+ * @return the only one border node of this parent (fail otherwise)
+ */
+ protected AbstractDiagramBorderNodeEditPart getBorderNode(EditPart parent) {
+ AbstractDiagramBorderNodeEditPart result = null;
+ try {
+ result = Iterables.getOnlyElement(Iterables.filter(parent.getChildren(), AbstractDiagramBorderNodeEditPart.class));
+ } catch (NoSuchElementException e) {
+ fail("There is no border node created on source.");
+ } catch (IllegalArgumentException e) {
+ fail("There should be only one border node created on source.");
+ }
+ return result;
+ }
+
+ @Override
+ protected void assertAreValidAnchors(IGraphicalEditPart source, PrecisionPoint sourcePosition, IGraphicalEditPart target, PrecisionPoint targetPosition, DEdgeEditPart edge) {
+ // Get the new source border node
+ IGraphicalEditPart sourceBorderNode = getBorderNode(source);
+ // Get the new target border node
+ IGraphicalEditPart targetBorderNode = getBorderNode(target);
+
+ super.assertAreValidAnchors(sourceBorderNode, sourcePosition, targetBorderNode, targetPosition, edge);
+
+ // Check that the side is as expected ( for edge creation with border
+ // nodes, the side must be the at least
+ checkSide(sourcePosition, sourceBorderNode, sourceSide);
+ checkSide(targetPosition, targetBorderNode, targetSide);
+ }
+
+ @Override
+ protected void assertAreValidAnchorsAndBendpoints(IGraphicalEditPart source, IGraphicalEditPart target, DEdgeEditPart edge) {
+ // The super method is only called for oblique edges as for rectilinear
+ // and tree the intersection points are not the same.
+ if (new DEdgeQuery((DEdge) edge.resolveSemanticElement()).getRouting().equals(Routing.MANUAL_LITERAL)) {
+ super.assertAreValidAnchorsAndBendpoints(source, target, edge);
+ }
+ }
+
+ private void checkSide(PrecisionPoint location, IGraphicalEditPart borderNodeEditPart, int expectedSide) {
+ if (expectedSide == PositionConstants.NONE) {
+ expectedSide = getExpectedSide(location, borderNodeEditPart);
+ }
+ assertTrue("The edit part should be a IBorderItemEditPart.", borderNodeEditPart instanceof IBorderItemEditPart);
+ final IBorderItemEditPart borderPart = (IBorderItemEditPart) borderNodeEditPart;
+ final IBorderItemLocator borderItemLocator = borderPart.getBorderItemLocator();
+ bot.waitUntil(new ICondition() {
+
+ @Override
+ public boolean test() throws Exception {
+ return borderItemLocator.getCurrentSideOfParent() != PositionConstants.NSEW;
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "The current side of parent is not set in BorderItemLocator.";
+ }
+ });
+ assertEquals("The border node side is not correct.", expectedSide, borderItemLocator.getCurrentSideOfParent());
+ }
+
+ /**
+ * Return the expected side according to a location.
+ *
+ * @param location
+ * A location expressed in a ratio compared to the container
+ * (from 0 to 1).
+ */
+ private int getExpectedSide(PrecisionPoint location, IGraphicalEditPart borderNodeEditPart) {
+ Dimension parentFigureSize = ((IGraphicalEditPart) borderNodeEditPart.getParent()).getFigure().getSize();
+ double horizontalRatio = parentFigureSize.preciseWidth() * location.preciseX();
+ double verticalRatio = parentFigureSize.preciseHeight() * location.preciseY();
+ if (location.preciseX() > 0.5) {
+ horizontalRatio = parentFigureSize.preciseWidth() - (parentFigureSize.preciseWidth() * location.preciseX());
+ }
+ if (location.preciseY() > 0.5) {
+ verticalRatio = parentFigureSize.preciseHeight() - (parentFigureSize.preciseHeight() * location.preciseY());
+ }
+
+ int expectedSide = PositionConstants.NONE;
+ if (location.preciseX() < 0.5) {
+ if (horizontalRatio < verticalRatio) {
+ expectedSide = PositionConstants.WEST;
+ } else if (location.preciseY() < 0.5) {
+ expectedSide = PositionConstants.NORTH;
+ } else {
+ expectedSide = PositionConstants.SOUTH;
+ }
+ } else if (horizontalRatio < verticalRatio) {
+ expectedSide = PositionConstants.EAST;
+ } else if (location.preciseY() < 0.5) {
+ expectedSide = PositionConstants.NORTH;
+ } else {
+ expectedSide = PositionConstants.SOUTH;
+ }
+ return expectedSide;
+ }
+}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionWithSnapToGridTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionWithSnapToGridTest.java
index 3fdd52da0c..8418b7f336 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionWithSnapToGridTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionWithSnapToGridTest.java
@@ -10,20 +10,19 @@
*******************************************************************************/
package org.eclipse.sirius.tests.swtbot;
-import java.util.NoSuchElementException;
-
+import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionPoint;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
-import org.eclipse.gef.NodeEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.sirius.diagram.DDiagram;
import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramBorderNodeEditPart;
import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramContainerEditPart;
import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramNodeEditPart;
import org.eclipse.sirius.diagram.ui.internal.edit.parts.DEdgeEditPart;
+import org.eclipse.sirius.diagram.ui.internal.refresh.GMFHelper;
import org.eclipse.sirius.ext.base.Option;
import org.eclipse.sirius.ext.base.Options;
import org.eclipse.sirius.ext.gmf.runtime.editparts.GraphicalHelper;
@@ -35,14 +34,12 @@ import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.waits.ICondition;
-import com.google.common.collect.Iterables;
-
/**
* Same tests as {@link EdgeCreationPositionTest} but with snapToGrid enabled.
*
* @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a>
*/
-public class EdgeWithBorderNodeCreationPositionWithSnapToGridTest extends EdgeCreationPositionTest {
+public class EdgeWithBorderNodeCreationPositionWithSnapToGridTest extends EdgeWithBorderNodeCreationPositionTest {
private static final double gridStep = 100;
@@ -60,54 +57,44 @@ public class EdgeWithBorderNodeCreationPositionWithSnapToGridTest extends EdgeCr
}
@Override
- protected String getCreateEdgeToolName() {
- return "SuperWithBorderNode";
- }
-
- @Override
- protected DEdgeEditPart getSingleDEdgeFrom(NodeEditPart sourcePart) {
- // Get the new source border node
- AbstractDiagramBorderNodeEditPart sourceBorderNode = getBorderNode(sourcePart);
- assertEquals(1, sourceBorderNode.getSourceConnections().size());
- ConnectionEditPart edge = (ConnectionEditPart) sourceBorderNode.getSourceConnections().get(0);
- assertTrue(edge instanceof DEdgeEditPart);
- return (DEdgeEditPart) edge;
- }
-
- private AbstractDiagramBorderNodeEditPart getBorderNode(EditPart parent) {
- AbstractDiagramBorderNodeEditPart result = null;
- try {
- result = Iterables.getOnlyElement(Iterables.filter(parent.getChildren(), AbstractDiagramBorderNodeEditPart.class));
- } catch (NoSuchElementException e) {
- fail("There is no border node created on source.");
- } catch (IllegalArgumentException e) {
- fail("There should be only one border node created on source.");
- }
- return result;
- }
-
- @Override
- protected void assertAreValidAnchors(IGraphicalEditPart source, IGraphicalEditPart target, DEdgeEditPart edge) {
- // Get the new source border node
- IGraphicalEditPart sourceBorderNode = getBorderNode(source);
- // Get the new target border node
- IGraphicalEditPart targetBorderNode = getBorderNode(target);
-
- super.assertAreValidAnchors(sourceBorderNode, targetBorderNode, edge);
+ protected void assertAreValidAnchors(IGraphicalEditPart source, PrecisionPoint sourcePosition, IGraphicalEditPart target, PrecisionPoint targetPosition, DEdgeEditPart edge) {
+ super.assertAreValidAnchors(source, sourcePosition, target, targetPosition, edge);
// Check that at least
// * the x coordinate of the border node is on the grid
// * or the y coordinate of the border node is on the grid
// * or one of them is the same as parent (case when the grid is outside
- // the
- // node).
+ // the node).
+ bot.waitUntil(new ICondition() {
+
+ @Override
+ public boolean test() throws Exception {
+ return !GraphicalHelper.getAbsoluteBoundsIn100Percent(source, true).getTopLeft().equals(0, 0);
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "The border node location is not yet correctly set.";
+ }
+ });
Rectangle parentSourceBounds = GraphicalHelper.getAbsoluteBoundsIn100Percent(source, true);
- Point sourceBNLocation = GraphicalHelper.getAbsoluteBoundsIn100Percent(sourceBorderNode, true).getTopLeft();
- assertTrue("For starting point (" + sourceBNLocation.preciseX() + ", " + sourceBNLocation.preciseY() + "), the x or y coordinate should be on the grid (step=" + gridStep
- + ") or at least one should be the same as parent: " + parentSourceBounds + ".", checkLocation(sourceBNLocation, parentSourceBounds));
+ Point draw2DSourceBNLocation = GraphicalHelper.getAbsoluteBoundsIn100Percent(source, true).getTopLeft();
+ assertTrue("For starting point (" + draw2DSourceBNLocation.preciseX() + ", " + draw2DSourceBNLocation.preciseY() + "), the x or y coordinate should be on the grid (step=" + gridStep
+ + ") or at least one should be the same as parent: " + parentSourceBounds + ".", checkLocation(draw2DSourceBNLocation, parentSourceBounds));
+ Point gmfSourceBNLocation = GMFHelper.getAbsoluteLocation((Node) source.getModel(), true);
+ assertEquals("The computing starting point from GMF data should be the same than draw2D", draw2DSourceBNLocation, gmfSourceBNLocation);
+
Rectangle parentTargetBounds = GraphicalHelper.getAbsoluteBoundsIn100Percent(target, true);
- Point targetBNLocation = GraphicalHelper.getAbsoluteBoundsIn100Percent(targetBorderNode, true).getTopLeft();
- assertTrue("For ending point (" + targetBNLocation.preciseX() + ", " + targetBNLocation.preciseY() + "), the x or y coordinate should be on the grid (step=" + gridStep
- + ") or at least one should be the same as parent: " + parentTargetBounds + ".", checkLocation(targetBNLocation, parentTargetBounds));
+ Point draw2DTargetBNLocation = GraphicalHelper.getAbsoluteBoundsIn100Percent(target, true).getTopLeft();
+ assertTrue("For ending point (" + draw2DTargetBNLocation.preciseX() + ", " + draw2DTargetBNLocation.preciseY() + "), the x or y coordinate should be on the grid (step=" + gridStep
+ + ") or at least one should be the same as parent: " + parentTargetBounds + ".", checkLocation(draw2DTargetBNLocation, parentTargetBounds));
+ Point gmfTargetBNLocation = GMFHelper.getAbsoluteLocation((Node) target.getModel(), true);
+ assertEquals("The computing starting point from GMF data should be the same than draw2D", draw2DTargetBNLocation, gmfTargetBNLocation);
+ // Contrary to super class, the checkSide are not done because
+ // snapToGrid is enabled and has effect on the side.
}
private boolean checkLocation(Point location, Rectangle parentBounds) {
@@ -118,6 +105,103 @@ public class EdgeWithBorderNodeCreationPositionWithSnapToGridTest extends EdgeCr
return result;
}
+ @Override
+ public void test_Node() {
+ // Force the expected source side as the snapToGrid change the "computed
+ // one" in the test code.
+ sourceSide = PositionConstants.WEST;
+ try {
+ super.test_Node();
+ } finally {
+ sourceSide = PositionConstants.NONE;
+ }
+ }
+
+ @Override
+ public void test_Node_WithZoom() {
+ // Force the expected source side as the snapToGrid change the "computed
+ // one" in the test code.
+ sourceSide = PositionConstants.WEST;
+ try {
+ super.test_Node_WithZoom();
+ } finally {
+ sourceSide = PositionConstants.NONE;
+ }
+ }
+
+ @Override
+ public void test_List() {
+ // Force the expected source side and target side as the snapToGrid
+ // change the "computed ones" in the test code.
+ sourceSide = PositionConstants.NORTH;
+ targetSide = PositionConstants.EAST;
+ try {
+ super.test_List();
+ } finally {
+ sourceSide = PositionConstants.NONE;
+ targetSide = PositionConstants.NONE;
+ }
+ }
+
+ @Override
+ public void test_Node_WithRectilinearEdge() {
+ // Force the expected source side and target side as the snapToGrid
+ // change the "computed ones" in the test code.
+ sourceSide = PositionConstants.NORTH;
+ targetSide = PositionConstants.WEST;
+ try {
+ super.test_Node_WithRectilinearEdge();
+ } finally {
+ sourceSide = PositionConstants.NONE;
+ targetSide = PositionConstants.NONE;
+ }
+ }
+
+ @Override
+ public void test_Bordered_Node_on_Node() {
+ // Force the expected source side and target side as the snapToGrid
+ // change the "computed ones" in the test code.
+ sourceSide = PositionConstants.WEST;
+ targetSide = PositionConstants.WEST;
+ try {
+ super.test_Bordered_Node_on_Node();
+ } finally {
+ sourceSide = PositionConstants.NONE;
+ targetSide = PositionConstants.NONE;
+ }
+ }
+
+ @Override
+ public void test_Container_in_Container() {
+ // Force the expected source side and target side as the snapToGrid
+ // change the "computed ones" in the test code.
+ sourceSide = PositionConstants.NORTH;
+ targetSide = PositionConstants.SOUTH;
+ try {
+ super.test_Container_in_Container();
+ } finally {
+ sourceSide = PositionConstants.NONE;
+ targetSide = PositionConstants.NONE;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.sirius.tests.swtbot.EdgeCreationPositionTest#
+ * test_Bordered_Node_on_Container()
+ */
+ @Override
+ public void test_Bordered_Node_on_Container() {
+ // Force the expected source side as the snapToGrid change the "computed
+ // ones" in the test code.
+ sourceSide = PositionConstants.EAST;
+ try {
+ super.test_Bordered_Node_on_Container();
+ } finally {
+ sourceSide = PositionConstants.NONE;
+ }
+ }
+
/**
* For closed source and target points on an axis, the feedback shows a
* straighten edge, the result must be also 2 aligned border nodes.
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllCreationTestSuite.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllCreationTestSuite.java
index a6a996c15f..d20225c491 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllCreationTestSuite.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllCreationTestSuite.java
@@ -25,6 +25,7 @@ import org.eclipse.sirius.tests.swtbot.DNodeListCreationTest;
import org.eclipse.sirius.tests.swtbot.DNodeListCreationWithSnapToGridTest;
import org.eclipse.sirius.tests.swtbot.EdgeCreationPositionTest;
import org.eclipse.sirius.tests.swtbot.EdgeCreationPositionWithSnapToGridTest;
+import org.eclipse.sirius.tests.swtbot.EdgeWithBorderNodeCreationPositionTest;
import org.eclipse.sirius.tests.swtbot.EdgeWithBorderNodeCreationPositionWithSnapToGridTest;
import org.eclipse.sirius.tests.swtbot.NodeCreationPositionTest;
import org.eclipse.sirius.tests.swtbot.NodeCreationTest;
@@ -82,6 +83,7 @@ public class AllCreationTestSuite extends TestCase {
suite.addTestSuite(CollapsedBorderedNodeCreationNearCollapsedWithSnapToGridTest.class);
suite.addTestSuite(EdgeCreationPositionTest.class);
suite.addTestSuite(EdgeCreationPositionWithSnapToGridTest.class);
+ suite.addTestSuite(EdgeWithBorderNodeCreationPositionTest.class);
suite.addTestSuite(EdgeWithBorderNodeCreationPositionWithSnapToGridTest.class);
suite.addTestSuite(BorderNodeSideTest.class);

Back to the top