diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode/borderedNode.aird b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode/borderedNode.aird index 8f3992dc58..0c67a4f020 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode/borderedNode.aird +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode/borderedNode.aird @@ -1,846 +1,882 @@ - - - - - - - - - - - - - + + + borderedNode.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + - - + + - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + - - - + + + + + + + + + + - - - - - - - - - - + + + - - + + - - + + - - - - - - - - - - + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + - - - + + + + + + - - - - - - - - - - + + + - - + + - - - - - - + + + - - - + + + + + + + + + + - - + + - - + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + - - - - - - - - - - + + + + + + - - - + + + - - + + + + + + - - - + + + + + + + + + + - - - - - - - - - - + + + - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - + + + - - + + - - - - - - + + + - - - + + + + + + + + + + - - + + - - + + - - - - - + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + + + + + + + + + + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + - - - + + + - - + + - - + + - - - - - + + + + + + + + + + + - - + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + - + - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - + + + + + + + + - + - - - - - + + - + - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - + + - - + + - - - - - - - - - - - - - - - - + + + - - - - - - - - - - + + + - - + + - - - - - + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - + + + - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION KEEP_SIZE KEEP_RATIO - - - - - + + - - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - - - - - - - - - - - - - - - - - - - + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + KEEP_LOCATION KEEP_SIZE KEEP_RATIO - - - - - - - - - - - - - - - - - - - - - - - strokeColor - - - - - + + - + - - - - - strokeColor - - - - - + + + + + + + + + - - - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + - + - - - - - - - - + + + + + strokeColor + + + + + + + + + + strokeColor + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode/borderedNode.ecore b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode/borderedNode.ecore index 1916068d87..e842a4d92c 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode/borderedNode.ecore +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode/borderedNode.ecore @@ -51,4 +51,7 @@ + + + diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode/borderedNode.odesign b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode/borderedNode.odesign index 61cfccdfe7..b478003b65 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode/borderedNode.odesign +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode/borderedNode.odesign @@ -1,10 +1,10 @@ - + - - + + @@ -58,6 +58,45 @@ + + + + + + + + + + + + + + + @@ -197,6 +236,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/BorderedNodeCreationTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/BorderedNodeCreationTest.java index 21e4d900be..d54d813aa8 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/BorderedNodeCreationTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/BorderedNodeCreationTest.java @@ -113,6 +113,8 @@ public class BorderedNodeCreationTest extends AbstractSiriusSwtBotGefTestCase { /** Name of the fourth package */ protected static final String PACKAGE_4_NAME = "P4"; + private static final String PACKAGE_6_NAME = "P6ForVStack"; + private static final String CLASS_1_NAME = "Class1"; private static final String CLASS_2_NAME = "Class2"; @@ -135,6 +137,11 @@ public class BorderedNodeCreationTest extends AbstractSiriusSwtBotGefTestCase { */ protected boolean createCollapsedBorderedNode; + /** + * If true the tool to create the border node is named "BorderClassOnVStack". + */ + protected boolean createBorderedNodeOnVStack; + /** * {@inheritDoc} */ @@ -276,7 +283,7 @@ protected void testBNC_OnNode(ZoomLevel zoomLevel, String classToRevealName, boo // Get the location of the class (relative the part visible on the // screen) Point classLocation = editor.getLocation(classEditPart); - // Get the absolute location of p2 package from origin (0, 0) + // Get the absolute location of the class from origin (0, 0) Point classAbsoluteLocation = editor.getAbsoluteLocation((GraphicalEditPart) classEditPart.part()); // Get the insertion location for the bordered node (use the relative // coordinate, that's what is send to the request in reality) @@ -495,18 +502,23 @@ private void testBNC_OnContainer(ZoomLevel zoomLevel, String packageToRevealName fail("Problem during getting expanded bounds of the collapse bordered node."); } } else { - // Try to locate the bordered node at 8 pixels to the top-left + // Try to locate the bordered node on the left border, at 8 pixels from the top-left // corner of the package - Point delta = new Point(8, 0); + Point delta = new Point(0, 8); + if (createBorderedNodeOnVStack) { + // For a VStack container try to locate the bordered node a little bit lower to be under the "title" + // area. + delta = delta.getTranslated(0, 22); + } // We compute the location according the the package location, the // zoom factor and an insets to be sure to be in the package and not - // just above. - location = packageLocation.getTranslated(delta.getScaled(zoomLevel.getAmount()).translate(0, 1)); + // just nearby. + location = packageLocation.getTranslated(delta.getScaled(zoomLevel.getAmount()).translate(1, 0)); // The expected location is in absolute coordinate the delta is // translate with -2 in y axis corresponding to the shift of the // bordered node make by BorderItemLocator // (IBorderItemOffsets.DEFAULT_OFFSET - size of the node). - expectedLocation = packageAbsoluteLocation.getTranslated(delta.translate(0, -2)); + expectedLocation = packageAbsoluteLocation.getTranslated(delta.translate(-2, 0)); } expectedLocation = adaptExpectedLocation(((GraphicalEditPart) editPart.part()).getFigure(), packageAbsoluteLocation, expectedLocation); @@ -656,6 +668,18 @@ private void assertBorderedNodeSize(String borderedNodeLabel) { assertEquals("The port size should have 1 pixel height.", 1, size.getHeight()); } + /** + * Ensures that a bordered node created on a vertical stack region (zoom level: 100%) has the expected location. + */ + public void testBNC_OnVStackContainer() { + createBorderedNodeOnVStack = true; + try { + testBNC_OnContainer(ZoomLevel.ZOOM_100, PACKAGE_6_NAME); + } finally { + createBorderedNodeOnVStack = false; + } + } + /** * Ensures that a bordered node created on a Node in Container (zoom level : * 100%) has the expected location. @@ -727,10 +751,18 @@ protected String getBorderedNodeCreationOnClassToolName() { * @return the name of the tool to use. */ protected String getBorderedNodeCreationOnPackageToolName() { - if (createCollapsedBorderedNode) { - return COLLASPED_BORDERED_NODE_CREATION_ON_PACKAGE_TOOL_NAME; + if (createBorderedNodeOnVStack) { + if (createCollapsedBorderedNode) { + return "CollapsedBorderClassOnVStack"; + } else { + return "BorderClassOnVStack"; + } } else { - return BORDERED_NODE_CREATION_ON_PACKAGE_TOOL_NAME; + if (createCollapsedBorderedNode) { + return COLLASPED_BORDERED_NODE_CREATION_ON_PACKAGE_TOOL_NAME; + } else { + return BORDERED_NODE_CREATION_ON_PACKAGE_TOOL_NAME; + } } }