Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2020-10-26 18:01:24 +0000
committerLaurent Redor2020-11-05 16:56:01 +0000
commite96e20e29cfde10b353b635bc34bc1d4e6ce8f0f (patch)
treea929b9713b0efe3f336f646fcf724545ddaa99ed
parentcfdb8f1a70d27ffe0177552075b6c1eaf168c593 (diff)
downloadorg.eclipse.sirius-e96e20e29cfde10b353b635bc34bc1d4e6ce8f0f.tar.gz
org.eclipse.sirius-e96e20e29cfde10b353b635bc34bc1d4e6ce8f0f.tar.xz
org.eclipse.sirius-e96e20e29cfde10b353b635bc34bc1d4e6ce8f0f.zip
[568037] Add tests for ELK arrange selection of container in container
These tests are expected to fail (fixed with the following commit). Bug: 568037 Change-Id: I23e8db918c0e46432dedca4295ec3d7384ddaae9 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.java60
1 files changed, 60 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 dff5287b85..4620dc8974 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
@@ -688,6 +688,34 @@ public class SimpleELKLayoutTest extends SiriusDiagramTestCase {
assertAlignCentered(50, "Class1_1", "Class1_2");
}
+
+ /**
+ * Makes sure that the result of an arrange selection on one container respect the following rules:
+ * <UL>
+ * <LI>No scroll bar in the container (container resized)</LI>
+ * <LI>Container is not moved</LI>
+ * <LI>Container's content is correctly layouted</LI>
+ * <UL>
+ */
+ public void testArrangeSelectionResultOnOneContainerInAnotherContainer() {
+ openDiagram("diagramWithContainer");
+
+ IGraphicalEditPart editPart = getEditPart("p2_2");
+ Point locationOfP22BeforeLayout = editPart.getFigure().getBounds().getTopLeft();
+
+ // Launch an arrange selection
+ arrangeSelection(editPart);
+
+ // Assert that there is no scroll bar on p2_2
+ assertNoVisibleScrollBar((IDiagramContainerEditPart) editPart);
+
+ // Assert that the location of the container is the same before and after the layout
+ assertEquals("The location of the container should be the same before and after the layout.", locationOfP22BeforeLayout, editPart.getFigure().getBounds().getTopLeft());
+
+ // Assert content is layouted
+ assertAlignCentered(50, "Class2_2_1", "Class2_2_2");
+ }
+
/**
* Makes sure that the result of an arrange selection on one container respect the following rules:
* <UL>
@@ -806,6 +834,38 @@ public class SimpleELKLayoutTest extends SiriusDiagramTestCase {
}
/**
+ * Makes sure that the result of an arrange selection of some children of a container (contained in another
+ * 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_ContainedInAContainer() {
+ openDiagram("diagramWithContainer");
+
+ IGraphicalEditPart p22EditPart = getEditPart("p2_2");
+ Rectangle boundsOfP22BeforeLayout = p22EditPart.getFigure().getBounds().getCopy();
+ IGraphicalEditPart class222EditPart = getEditPart("Class2_2_2");
+ IGraphicalEditPart class221EditPart = getEditPart("Class2_2_1");
+ Point topLeftCornerBeforeLayout = getTopLeftCorner(class221EditPart, class222EditPart);
+
+ // Launch an arrange selection
+ arrangeSelection(class222EditPart, class221EditPart);
+
+ // 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(class221EditPart, class222EditPart));
+
+ // Assert content is layouted
+ assertAlignCentered(50, "Class2_2_1", "Class2_2_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.", boundsOfP22BeforeLayout, p22EditPart.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