Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2016-05-04 14:24:31 +0000
committerLaurent Redor2016-06-22 08:57:16 +0000
commit2d65d2279bda22f36ddd385cd59c6e9457ce1bea (patch)
treebf49942b58cc2e1a3152ede7abbf77b2a3c22e6a
parent1f66b3c8dba6d35a10e9e015f913fdbb329aabd9 (diff)
downloadorg.eclipse.sirius-2d65d2279bda22f36ddd385cd59c6e9457ce1bea.tar.gz
org.eclipse.sirius-2d65d2279bda22f36ddd385cd59c6e9457ce1bea.tar.xz
org.eclipse.sirius-2d65d2279bda22f36ddd385cd59c6e9457ce1bea.zip
[490360] Change tests
The bug 490360 will change the behavior for border nodes (only center of border nodes will be considered for snap). So this commit adapts the tests according to this new rule. Bug: 490360 Change-Id: I27bd50760f01dce607e6cbddac108ea74c052a74 Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/snap/representations.aird22
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SnapAllShapesTest.java85
2 files changed, 85 insertions, 22 deletions
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/snap/representations.aird b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/snap/representations.aird
index 42a6c2fe7c..815dfcb13d 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/snap/representations.aird
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/snap/representations.aird
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<viewpoint:DAnalysis xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style" xmi:id="_mXL0MBWbEeW7GcqVYwuCiQ" selectedViews="_LWb4wBWdEeW7GcqVYwuCiQ" version="10.0.0.201505222000">
+<viewpoint:DAnalysis xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style" xmi:id="_mXL0MBWbEeW7GcqVYwuCiQ" selectedViews="_LWb4wBWdEeW7GcqVYwuCiQ" version="11.0.0.201604141600">
<semanticResources>My.ecore</semanticResources>
- <ownedViews xmi:type="viewpoint:DRepresentationContainer" xmi:id="_LWb4wBWdEeW7GcqVYwuCiQ">
+ <ownedViews xmi:type="viewpoint:DView" xmi:id="_LWb4wBWdEeW7GcqVYwuCiQ">
+ <viewpoint xmi:type="description:Viewpoint" href="snapToAll.odesign#//@ownedViewpoints[name='snapToAll']"/>
<ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_M0HXsBWdEeW7GcqVYwuCiQ" name="snapToAllDiagram">
<ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_M0HXsRWdEeW7GcqVYwuCiQ" source="DANNOTATION_CUSTOMIZATION_KEY">
<data xmi:type="diagram:ComputedStyleDescriptionRegistry" xmi:id="_M0HXshWdEeW7GcqVYwuCiQ"/>
@@ -29,7 +30,7 @@
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_Orca8haIEeWQ3O79R6E3Ug"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_OrbM0RaIEeWQ3O79R6E3Ug" fontName="Ubuntu" fontHeight="8"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_OrbM0haIEeWQ3O79R6E3Ug" x="-83" width="91" height="51"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_OrbM0haIEeWQ3O79R6E3Ug" x="-83" width="91" height="52"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_OrRb0RaIEeWQ3O79R6E3Ug" fontName="Ubuntu" fontHeight="8"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_OrRb0haIEeWQ3O79R6E3Ug" x="-92" width="100" height="101"/>
@@ -181,7 +182,7 @@
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_Or68EhaIEeWQ3O79R6E3Ug"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_Or4f0RaIEeWQ3O79R6E3Ug" fontName="Ubuntu" fontHeight="8"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Or4f0haIEeWQ3O79R6E3Ug" x="17" y="256" width="251" height="101"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Or4f0haIEeWQ3O79R6E3Ug" x="17" y="135" width="251" height="101"/>
</children>
<styles xmi:type="notation:SortingStyle" xmi:id="_OrQ0whaIEeWQ3O79R6E3Ug"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_OrQ0wxaIEeWQ3O79R6E3Ug"/>
@@ -206,10 +207,10 @@
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_Or8xQhaIEeWQ3O79R6E3Ug" x="-175" y="28" width="176" height="26"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_Or1cgRaIEeWQ3O79R6E3Ug" fontName="Ubuntu" fontHeight="8"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Or1cghaIEeWQ3O79R6E3Ug" x="448" y="150" width="100" height="104"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Or1cghaIEeWQ3O79R6E3Ug" x="448" y="9" width="100" height="104"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_OrQNsRaIEeWQ3O79R6E3Ug" fontName="Ubuntu" fontHeight="8"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_OrQNshaIEeWQ3O79R6E3Ug" x="1024" y="112" width="458" height="578"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_OrQNshaIEeWQ3O79R6E3Ug" x="1024" y="253" width="458" height="437"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_GxWhgBvTEeWBdP4r18ZtPw" type="Note" fontName="Ubuntu" description="Note" fillColor="13369343" transparency="0" lineColor="6737151" lineWidth="1">
<children xmi:type="notation:BasicDecorationNode" xmi:id="_GxcBEBvTEeWBdP4r18ZtPw" type="DiagramName">
@@ -221,7 +222,7 @@
<styles xmi:type="notation:TextStyle" xmi:id="_GxWhgRvTEeWBdP4r18ZtPw"/>
<styles xmi:type="notation:LineTypeStyle" xmi:id="_GxWhghvTEeWBdP4r18ZtPw"/>
<element xsi:nil="true"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_GxWhgxvTEeWBdP4r18ZtPw" x="842" y="100" width="67" height="43"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_GxWhgxvTEeWBdP4r18ZtPw" x="842" y="100" width="67" height="44"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_LMXUQBvTEeWBdP4r18ZtPw" type="Text" fontName="Ubuntu" description="Text">
<children xmi:type="notation:BasicDecorationNode" xmi:id="_LMX7UBvTEeWBdP4r18ZtPw" type="DiagramName">
@@ -334,7 +335,7 @@
<arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
<arrangeConstraints>KEEP_SIZE</arrangeConstraints>
<arrangeConstraints>KEEP_RATIO</arrangeConstraints>
- <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_Op8mIBaIEeWQ3O79R6E3Ug" borderColor="39,76,114" foregroundColor="194,239,255">
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_Op8mIBaIEeWQ3O79R6E3Ug" borderSize="1" borderSizeComputationExpression="1" borderColor="39,76,114" foregroundColor="194,239,255">
<description xmi:type="style:FlatContainerStyleDescription" href="snapToAll.odesign#//@ownedViewpoints[name='snapToAll']/@ownedRepresentations[name='snapToAllDiagram']/@defaultLayer/@containerMappings[name='ContainerPackage']/@style"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="snapToAll.odesign#//@ownedViewpoints[name='snapToAll']/@ownedRepresentations[name='snapToAllDiagram']/@defaultLayer/@containerMappings[name='ContainerPackage']"/>
@@ -355,7 +356,7 @@
<arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
<arrangeConstraints>KEEP_SIZE</arrangeConstraints>
<arrangeConstraints>KEEP_RATIO</arrangeConstraints>
- <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_OqCswRaIEeWQ3O79R6E3Ug" borderColor="39,76,114" foregroundColor="194,239,255">
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_OqCswRaIEeWQ3O79R6E3Ug" borderSize="1" borderSizeComputationExpression="1" borderColor="39,76,114" foregroundColor="194,239,255">
<description xmi:type="style:FlatContainerStyleDescription" href="snapToAll.odesign#//@ownedViewpoints[name='snapToAll']/@ownedRepresentations[name='snapToAllDiagram']/@defaultLayer/@containerMappings[name='ContainerPackage']/@style"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="snapToAll.odesign#//@ownedViewpoints[name='snapToAll']/@ownedRepresentations[name='snapToAllDiagram']/@defaultLayer/@containerMappings[name='ContainerPackage']"/>
@@ -419,7 +420,7 @@
<arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
<arrangeConstraints>KEEP_SIZE</arrangeConstraints>
<arrangeConstraints>KEEP_RATIO</arrangeConstraints>
- <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_Op9NMRaIEeWQ3O79R6E3Ug" borderColor="39,76,114" foregroundColor="194,239,255">
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_Op9NMRaIEeWQ3O79R6E3Ug" borderSize="1" borderSizeComputationExpression="1" borderColor="39,76,114" foregroundColor="194,239,255">
<description xmi:type="style:FlatContainerStyleDescription" href="snapToAll.odesign#//@ownedViewpoints[name='snapToAll']/@ownedRepresentations[name='snapToAllDiagram']/@defaultLayer/@containerMappings[name='ContainerPackage']/@style"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="snapToAll.odesign#//@ownedViewpoints[name='snapToAll']/@ownedRepresentations[name='snapToAllDiagram']/@defaultLayer/@containerMappings[name='ContainerPackage']"/>
@@ -460,6 +461,5 @@
<activatedLayers xmi:type="description_1:Layer" href="snapToAll.odesign#//@ownedViewpoints[name='snapToAll']/@ownedRepresentations[name='snapToAllDiagram']/@defaultLayer"/>
<target xmi:type="ecore:EPackage" href="My.ecore#/"/>
</ownedRepresentations>
- <viewpoint xmi:type="description:Viewpoint" href="snapToAll.odesign#//@ownedViewpoints[name='snapToAll']"/>
</ownedViews>
</viewpoint:DAnalysis>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SnapAllShapesTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SnapAllShapesTest.java
index e3132d49be..0977e0286e 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SnapAllShapesTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SnapAllShapesTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 THALES GLOBAL SERVICES.
+ * Copyright (c) 2015, 2016 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
@@ -100,7 +100,7 @@ public class SnapAllShapesTest extends AbstractSiriusSwtBotGefTestCase {
* This test also handles the case of scroll bar in diagram.
*/
public void testMoveContainer() {
- moveTopOfElementNearBottomOfAnother("Container_p1", AbstractDiagramContainerEditPart.class, "BNBNN_att1", AbstractDiagramBorderNodeEditPart.class);
+ moveCenterOfElementNearCenterOfAnotherVertically("Container_p1", AbstractDiagramContainerEditPart.class, "BNBNN_att1", AbstractDiagramBorderNodeEditPart.class);
}
/**
@@ -111,7 +111,7 @@ public class SnapAllShapesTest extends AbstractSiriusSwtBotGefTestCase {
* This test also handles the case of scroll bar in diagram.
*/
public void testMoveNode() {
- moveTopOfElementNearBottomOfAnother("Node_p1", AbstractDiagramNodeEditPart.class, "BNNC_att1", AbstractDiagramBorderNodeEditPart.class);
+ moveCenterOfElementNearCenterOfAnotherVertically("Node_p1", AbstractDiagramNodeEditPart.class, "BNNC_att1", AbstractDiagramBorderNodeEditPart.class);
}
/**
@@ -147,7 +147,7 @@ public class SnapAllShapesTest extends AbstractSiriusSwtBotGefTestCase {
* This test also handles the case of scroll bar in diagram.
*/
public void testMoveNote() {
- moveTopOfElementNearBottomOfAnother("Note", NoteEditPart.class, "BNNC_att1", AbstractDiagramBorderNodeEditPart.class);
+ moveCenterOfElementNearCenterOfAnotherVertically("Note", NoteEditPart.class, "BNNC_att1", AbstractDiagramBorderNodeEditPart.class);
}
/**
@@ -158,7 +158,7 @@ public class SnapAllShapesTest extends AbstractSiriusSwtBotGefTestCase {
* This test also handles the case of scroll bar in diagram.
*/
public void testResizeContainer() {
- resizeTopOfElementNearBottomOfAnother("Container_p1", AbstractDiagramContainerEditPart.class, "BNBNN_att1", AbstractDiagramBorderNodeEditPart.class);
+ resizeTopOfElementNearBottomOfAnother("Container_p1", AbstractDiagramContainerEditPart.class, "NC_C2", AbstractDiagramNodeEditPart.class);
}
/**
@@ -169,7 +169,7 @@ public class SnapAllShapesTest extends AbstractSiriusSwtBotGefTestCase {
* This test also handles the case of scroll bar in diagram.
*/
public void testResizeNode() {
- resizeTopOfElementNearBottomOfAnother("Node_p1", AbstractDiagramNodeEditPart.class, "BNNC_att1", AbstractDiagramBorderNodeEditPart.class);
+ resizeTopOfElementNearBottomOfAnother("Node_p1", AbstractDiagramNodeEditPart.class, "Container_subP1", AbstractDiagramContainerEditPart.class);
}
/**
@@ -205,7 +205,7 @@ public class SnapAllShapesTest extends AbstractSiriusSwtBotGefTestCase {
* This test also handles the case of scroll bar in diagram.
*/
public void testResizeNote() {
- resizeTopOfElementNearBottomOfAnother("Note", NoteEditPart.class, "BNNC_att1", AbstractDiagramBorderNodeEditPart.class);
+ resizeTopOfElementNearBottomOfAnother("Note", NoteEditPart.class, "NC_C1", AbstractDiagramNodeEditPart.class);
}
/**
@@ -216,7 +216,7 @@ public class SnapAllShapesTest extends AbstractSiriusSwtBotGefTestCase {
* This test also handles the case of scroll bar in diagram.
*/
public void testResizeText() {
- resizeTopOfElementNearBottomOfAnother("Text", TextEditPart.class, "BNNC_att1", AbstractDiagramBorderNodeEditPart.class);
+ resizeTopOfElementNearBottomOfAnother("Text", TextEditPart.class, "NC_C1", AbstractDiagramNodeEditPart.class);
}
/**
@@ -259,15 +259,15 @@ public class SnapAllShapesTest extends AbstractSiriusSwtBotGefTestCase {
// Compute the drop destination (at 2 pixels of the bottom of another
// figure)
- final Rectangle targetNodeBounds = GraphicalHelper.getAbsoluteBoundsIn100Percent((GraphicalEditPart) editor.getEditPart("BNBNC_att1", AbstractDiagramBorderNodeEditPart.class).part());
- final Point endpoint = new Point(pointToMove.x, targetNodeBounds.getBottom().y - 4);
+ final Rectangle targetNodeBounds = GraphicalHelper.getAbsoluteBoundsIn100Percent((GraphicalEditPart) editor.getEditPart("NC_C2", AbstractDiagramNodeEditPart.class).part());
+ final Point endpoint = new Point(pointToMove.x, targetNodeBounds.getBottom().y - 2);
pointToMove.scale(zoomLevel.getAmount());
endpoint.scale(zoomLevel.getAmount());
// First move without F4 key pressed
editor.dragWithKey(pointToMove.x, pointToMove.y, endpoint.x, endpoint.y, SWT.None);
SWTBotUtils.waitAllUiEvents();
- bot.waitUntil(new BendpointLocationCondition((PolylineConnection) connectionEditPart.getFigure(), 1, false, targetNodeBounds.getBottom().y - 4,
+ bot.waitUntil(new BendpointLocationCondition((PolylineConnection) connectionEditPart.getFigure(), 1, false, targetNodeBounds.getBottom().y - 2,
"Second bendpoint of edge is not at expected y location after resize without F4 key pressed", !ZoomLevel.ZOOM_100.equals(zoomLevel)));
// Move to initial location
@@ -288,6 +288,69 @@ public class SnapAllShapesTest extends AbstractSiriusSwtBotGefTestCase {
moveTopOfElementNearBottomOfAnother(elementNameToMove, expectedEditPartTypeOfMovedElement, referenceElementName, expectedEditPartTypeOfReferenceElement, ZoomLevel.ZOOM_100);
}
+ private void moveCenterOfElementNearCenterOfAnotherVertically(String elementNameToMove, Class<? extends EditPart> expectedEditPartTypeOfMovedElement, String referenceElementName,
+ Class<? extends EditPart> expectedEditPartTypeOfReferenceElement) {
+ moveCenterOfElementNearCenterOfAnotherVertically(elementNameToMove, expectedEditPartTypeOfMovedElement, referenceElementName, expectedEditPartTypeOfReferenceElement, ZoomLevel.ZOOM_100);
+ }
+
+ /**
+ * Move element a first time without F4 and check the location is the
+ * expected one (ie the mouse location).<BR>
+ * Move element a second time with F4 and check the location is the expected
+ * one (snap to another figure).<BR>
+ */
+ private void moveCenterOfElementNearCenterOfAnotherVertically(String elementNameToMove, Class<? extends EditPart> expectedEditPartTypeOfMovedElement, String referenceElementName,
+ Class<? extends EditPart> expectedEditPartTypeOfReferenceElement, ZoomLevel zoomLevel) {
+ editor.zoom(zoomLevel);
+ editor.scrollTo(0, 0);
+
+ SWTBotGefEditPart elementToMove = editor.getEditPart(elementNameToMove, expectedEditPartTypeOfMovedElement);
+ // Select the element to move
+ editor.select(elementToMove);
+
+ // Get the top center coordinates, just a little below, of the element
+ // to move
+ final Rectangle originalBounds = GraphicalHelper.getAbsoluteBoundsIn100Percent((GraphicalEditPart) elementToMove.part());
+ Point pointToDrag = originalBounds.getTop().getTranslated(0, 3);
+ if (TextEditPart.class.equals(expectedEditPartTypeOfMovedElement)) {
+ pointToDrag = originalBounds.getTop().getTranslated(0, 5);
+ }
+
+ Point scaledPointToDrag = new PrecisionPoint(pointToDrag);
+ GraphicalHelper.logical2screen(scaledPointToDrag, (IGraphicalEditPart) elementToMove.part());
+ // Compute the drop destination (at 4 pixels of the center of another
+ // part)
+
+ final Rectangle targetNodeBounds = GraphicalHelper.getAbsoluteBoundsIn100Percent((GraphicalEditPart) editor.getEditPart(referenceElementName, expectedEditPartTypeOfReferenceElement).part());
+ final Point endpoint = new Point(pointToDrag.x, pointToDrag.y - (originalBounds.getCenter().y - targetNodeBounds.getCenter().y + 4));
+ Point scaledEndpoint = new PrecisionPoint(endpoint);
+ GraphicalHelper.logical2screen(scaledEndpoint, (IGraphicalEditPart) elementToMove.part());
+
+ // First move without F4 key pressed
+ editor.drag(scaledPointToDrag.x, scaledPointToDrag.y, scaledEndpoint.x, scaledEndpoint.y);
+ SWTBotUtils.waitAllUiEvents();
+ // Get the new bounds and compare with the expected. It should be
+ // precisely where the drag has been done: at 4 pixels of the bottom of
+ // the other figure
+ Rectangle newBounds = GraphicalHelper.getAbsoluteBoundsIn100Percent((GraphicalEditPart) elementToMove.part());
+ assertEquals("Element \"" + elementNameToMove + "\" is not at expected y location after move without F4 key pressed", targetNodeBounds.getCenter().y - 4, newBounds.getCenter().y);
+
+ // Move to initial location
+ undo(localSession.getOpenedSession());
+ // Scroll to 0, 0 is needed because the first move can cause a scroll of
+ // the diagram not reverted by the Undo.
+ editor.scrollTo(0, 0);
+
+ // Second move with F4 key pressed
+ editor.dragWithKey(scaledPointToDrag.x, scaledPointToDrag.y, scaledEndpoint.x, scaledEndpoint.y, SWT.F4);
+ SWTBotUtils.waitAllUiEvents();
+ // Get the new bounds and compare with the expected. It should be
+ // aligned to the bottom of the other figure: at 1 pixel of the bottom
+ // as computed guide in SiriusSnapToGeometry.populateRowsAndCols(List)
+ newBounds = GraphicalHelper.getAbsoluteBoundsIn100Percent((GraphicalEditPart) elementToMove.part());
+ assertEquals("Element \"" + elementNameToMove + "\" is not at expected location after move with F4 key pressed", targetNodeBounds.getCenter().y, newBounds.getCenter().y);
+ }
+
/**
* Move element a first time without F4 and check the location is the
* expected one (ie the mouse location).<BR>

Back to the top