Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2020-10-28 11:31:17 +0000
committerLaurent Redor2020-11-05 16:55:50 +0000
commit3e2e640c4569fe1214079941922ae7d11030d2b6 (patch)
tree6419fe33a781effa47682be27bec0ba3a3e254a4
parenteb17055c5bf38d3084c5e08d9bcfdac7dd662c52 (diff)
downloadorg.eclipse.sirius-3e2e640c4569fe1214079941922ae7d11030d2b6.tar.gz
org.eclipse.sirius-3e2e640c4569fe1214079941922ae7d11030d2b6.tar.xz
org.eclipse.sirius-3e2e640c4569fe1214079941922ae7d11030d2b6.zip
[568037] Add test about result of arrange selection in a container
The test is expected to fail (fixed with the following commit). Bug: 568037 Change-Id: I5c896e95d6160d7002bbed7da969bf32f8047963 Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/SimpleELKLayoutTest.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/SimpleELKLayoutTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/SimpleELKLayoutTest.java
index d642475dfc..afac20c3c8 100644
--- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/SimpleELKLayoutTest.java
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/SimpleELKLayoutTest.java
@@ -770,6 +770,37 @@ public class SimpleELKLayoutTest extends SiriusDiagramTestCase {
}
/**
+ * Makes sure that the result of an arrange selection of some children of a container respect the following rules:
+ * <UL>
+ * <LI>The top-left corner of bounding box of selected elements remains the same</LI>
+ * <LI>Selected elements are layouted according to each others (but by ignoring other not selected elements,
+ * potential overlap with these elements)</LI>
+ * <LI>The container size and location are not changed.</LI>
+ * <UL>
+ */
+ public void testArrangeSelectionResultOnSomeContainerChildren() {
+ openDiagram("diagramWithContainer");
+
+ IGraphicalEditPart p2EditPart = getEditPart("p2");
+ Rectangle boundsOfP2BeforeLayout = p2EditPart.getFigure().getBounds().getCopy();
+ IGraphicalEditPart class22EditPart = getEditPart("Class2_2");
+ IGraphicalEditPart class21EditPart = getEditPart("Class2_1");
+ Point topLeftCornerBeforeLayout = getTopLeftCorner(class21EditPart, class22EditPart);
+
+ // Launch an arrange selection
+ arrangeSelection(class22EditPart, class21EditPart);
+
+ // Assert that the top-left corner of bounding box remains the same
+ assertEquals("The top-left corner of the bounding box of layouted elements should remain the same.", topLeftCornerBeforeLayout, getTopLeftCorner(class21EditPart, class22EditPart));
+
+ // Assert content is layouted
+ assertAlignCentered(50, "Class2_1", "Class2_2");
+
+ // Assert that the location and the size of the container is the same before and after the layout
+ assertEquals("The location and the size of the container should be the same before and after the layout.", boundsOfP2BeforeLayout, p2EditPart.getFigure().getBounds());
+ }
+
+ /**
* Makes sure that the result of an arrange selection of a container and some children of other container respect
* the following rules:
* <UL>

Back to the top