Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2018-08-13 14:16:36 +0000
committerLaurent Redor2018-12-06 17:23:37 +0000
commit571e009c9f0f9c7c11437e5957d9de7360a21b87 (patch)
tree2c023edd12fde1d3a7d2ee64b5f350ec79904e30
parenta1b5c1bd0a51b70fba3c5d7afe63a4cdf4a25ec3 (diff)
downloadorg.eclipse.sirius-571e009c9f0f9c7c11437e5957d9de7360a21b87.tar.gz
org.eclipse.sirius-571e009c9f0f9c7c11437e5957d9de7360a21b87.tar.xz
org.eclipse.sirius-571e009c9f0f9c7c11437e5957d9de7360a21b87.zip
[542480] Use SWTBot's native DnD support
The goal of this commit is to make several tests more reliable, according to several OS, by using a new SWTBot's native DnD support. Bug: 542480 Change-Id: Ia56f32c7476fb84a441f5d60007f614cdde0e98b Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/DragNDropTest.java66
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/RefreshAfterViewCreationTest.java15
2 files changed, 10 insertions, 71 deletions
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/DragNDropTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/DragNDropTest.java
index 97753b6bf9..c1750d7a23 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/DragNDropTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/DragNDropTest.java
@@ -25,7 +25,6 @@ import org.eclipse.sirius.diagram.DDiagram;
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.DNodeContainerEditPart;
-import org.eclipse.sirius.tests.support.api.TestsUtil;
import org.eclipse.sirius.tests.swtbot.sequence.condition.CheckNumberOfDescendants;
import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase;
import org.eclipse.sirius.tests.swtbot.support.api.business.UIDiagramRepresentation.ZoomLevel;
@@ -34,7 +33,6 @@ import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource;
import org.eclipse.sirius.tests.swtbot.support.api.condition.DiagramWithChildrensCondition;
import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor;
import org.eclipse.sirius.tests.swtbot.support.utils.SWTBotUtils;
-import org.eclipse.sirius.tests.swtbot.support.utils.dnd.DndUtil;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
import org.eclipse.swtbot.swt.finder.SWTBot;
@@ -261,10 +259,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
*/
@Test
public void test_DnDPackageFromMC2ContainerBlank2() throws Exception {
- if (TestsUtil.shouldSkipUnreliableTests()) {
- return;
- }
-
test_DnDPackageFromMC2DiagramBlank2();
try {
@@ -272,8 +266,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
SWTBot errorLogBot = bot.viewByPartName("Error Log").bot();
int rowCount = errorLogBot.tree().rowCount();
- DndUtil util = new DndUtil(bot.getDisplay());
-
// Get the location of P1
SWTBotGefEditPart p1Bot = editor.getEditPart(CONTAINER_TO_DRAG_P1).parent();
Point p1Location = editor.getBounds(p1Bot).getLocation();
@@ -281,7 +273,7 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
// DnD P2(EPackage) from the Model Content view to P1
semanticResourceNode = localSession.getSemanticResourceNode(ecoreEcoreResource);
final SWTBotTreeItem ecoreTreeItem1 = semanticResourceNode.expandNode(ROOTPACKAGE_NAME).getNode(CONTAINER_TO_DRAG_P2);
- util.dragAndDrop(ecoreTreeItem1, editor.getCanvas(), new org.eclipse.swt.graphics.Point(p1Location.x + 25, p1Location.y + 25));
+ ecoreTreeItem1.dragAndDrop(editor.getCanvas(), new org.eclipse.swt.graphics.Point(p1Location.x + 25, p1Location.y + 25));
bot.waitUntil(new DiagramWithChildrensCondition(editor, 1));
assertEquals("An error message was generated !", rowCount, errorLogBot.tree().rowCount());
@@ -300,10 +292,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
*/
@Test
public void test_DnDPackageFromMC2ContainerBlank2_zoom200() throws Exception {
- if (TestsUtil.shouldSkipUnreliableTests()) {
- return;
- }
-
test_DnDPackageFromMC2DiagramBlank2();
try {
@@ -315,8 +303,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
SWTBot errorLogBot = bot.viewByPartName("Error Log").bot();
int rowCount = errorLogBot.tree().rowCount();
- DndUtil util = new DndUtil(bot.getDisplay());
-
// Get the location of P1
SWTBotGefEditPart p1Bot = editor.getEditPart(CONTAINER_TO_DRAG_P1).parent();
@@ -325,7 +311,7 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
// DnD P2(EPackage) from the Model Content view to P1
final SWTBotTreeItem ecoreTreeItem1 = semanticResourceNode.expandNode(ROOTPACKAGE_NAME).getNode(CONTAINER_TO_DRAG_P2);
- util.dragAndDrop(ecoreTreeItem1, editor.getCanvas(), targetLocation);
+ ecoreTreeItem1.dragAndDrop(editor.getCanvas(), new org.eclipse.swt.graphics.Point(targetLocation.x, targetLocation.y));
bot.waitUntil(new DiagramWithChildrensCondition(editor, 1));
bot.waitUntil(new CheckNumberOfDescendants(p1Bot, AbstractDiagramNodeEditPart.class, 1));
@@ -356,10 +342,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
*/
@Test
public void test_DnDNodeFromContainer2DiagramBlank2() throws Exception {
- if (TestsUtil.shouldSkipUnreliableTests()) {
- return;
- }
-
test_DnDPackageFromMC2ContainerBlank2();
List<SWTBotGefEditPart> allEditParts = editor.mainEditPart().children();
@@ -407,10 +389,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
*/
@Test
public void test_DnDContainerFromDiagram2ContainerBlank2() throws Exception {
- if (TestsUtil.shouldSkipUnreliableTests()) {
- return;
- }
-
test_DnDNodeFromContainer2DiagramBlank2();
try {
@@ -444,10 +422,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
*/
@Test
public void test_DnDContainerFromContainer2ContainerBlank2() throws Exception {
- if (TestsUtil.shouldSkipUnreliableTests()) {
- return;
- }
-
test_DnDContainerFromDiagram2ContainerBlank2();
try {
@@ -455,15 +429,13 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
SWTBot errorLogBot = bot.viewByPartName("Error Log").bot();
int rowCount = errorLogBot.tree().rowCount();
- DndUtil util = new DndUtil(bot.getDisplay());
-
// Get the location of P1
SWTBotGefEditPart p1Bot = editor.getEditPart(CONTAINER_TO_DRAG_P1).parent();
Point targetLocation = editor.getBounds(p1Bot).getLeft().getTranslated(-200, 0);
// DnD P2.1(EPackage) from the Model Content view to the diagram
final SWTBotTreeItem ecoreTreeItem = semanticResourceNode.expandNode(ROOTPACKAGE_NAME).expandNode(CONTAINER_TO_DRAG_P1).expandNode(CONTAINER_TO_DRAG_P2).getNode(CONTAINER_TO_DRAG_P3);
- util.dragAndDrop(ecoreTreeItem, editor.getCanvas(), new org.eclipse.swt.graphics.Point(targetLocation.x, targetLocation.y));
+ ecoreTreeItem.dragAndDrop(editor.getCanvas(), new org.eclipse.swt.graphics.Point(targetLocation.x, targetLocation.y));
bot.waitUntil(new DiagramWithChildrensCondition(editor, 2));
assertEquals("An error message was generated !", rowCount, errorLogBot.tree().rowCount());
@@ -499,10 +471,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
*/
@Test
public void test_DnDContainerFromContainer2ContainerBlank2_zoom200() throws Exception {
- if (TestsUtil.shouldSkipUnreliableTests()) {
- return;
- }
-
test_DnDContainerFromDiagram2ContainerBlank2();
try {
@@ -513,8 +481,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
SWTBot errorLogBot = bot.viewByPartName("Error Log").bot();
int rowCount = errorLogBot.tree().rowCount();
- DndUtil util = new DndUtil(bot.getDisplay());
-
editor.reveal(CONTAINER_TO_DRAG_P1);
// Get the location of P1
@@ -524,7 +490,7 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
// DnD P2.1(EPackage) from the Model Content view to the diagram
semanticResourceNode = localSession.getSemanticResourceNode(ecoreEcoreResource);
final SWTBotTreeItem ecoreTreeItem = semanticResourceNode.expandNode(ROOTPACKAGE_NAME).expandNode(CONTAINER_TO_DRAG_P1).expandNode(CONTAINER_TO_DRAG_P2).getNode(CONTAINER_TO_DRAG_P3);
- util.dragAndDrop(ecoreTreeItem, editor.getCanvas(), targetLocation);
+ ecoreTreeItem.dragAndDrop(editor.getCanvas(), new org.eclipse.swt.graphics.Point(targetLocation.x, targetLocation.y));
bot.waitUntil(new CheckNumberOfDescendants(p1Bot, AbstractDiagramNodeEditPart.class, 1));
bot.waitUntil(new DiagramWithChildrensCondition(editor, 2));
@@ -622,8 +588,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
SWTBot errorLogBot = bot.viewByPartName("Error Log").bot();
int rowCount = errorLogBot.tree().rowCount();
- DndUtil util = new DndUtil(bot.getDisplay());
-
// Get the location of P1
SWTBotGefEditPart p1Bot = editor.getEditPart(CONTAINER_TO_DRAG_P1).parent();
Point p1Location = editor.getBounds(p1Bot).getLocation();
@@ -633,7 +597,7 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
// generated
semanticResourceNode = localSession.getSemanticResourceNode(ecoreEcoreResource);
final SWTBotTreeItem ecoreTreeItem = semanticResourceNode.expandNode(ROOTPACKAGE_NAME).expandNode(CONTAINER_TO_DRAG_P1).getNode(CLASS_TO_DRAG_C1);
- util.dragAndDrop(ecoreTreeItem, editor.getCanvas(), new org.eclipse.swt.graphics.Point(p1Location.x + 25, p1Location.y + 25));
+ ecoreTreeItem.dragAndDrop(editor.getCanvas(), new org.eclipse.swt.graphics.Point(p1Location.x + 25, p1Location.y + 25));
// Asserts that C1 was not created as child of P1 and no error
// message was generated
@@ -685,10 +649,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
*/
@Test
public void test_DnDClassFromMC2ContainerBlank5() throws Exception {
- if (TestsUtil.shouldSkipUnreliableTests()) {
- return;
- }
-
test_DnDPackageFromMC2DiagramBlank5();
try {
@@ -696,8 +656,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
SWTBot errorLogBot = bot.viewByPartName("Error Log").bot();
int rowCount = errorLogBot.tree().rowCount();
- DndUtil util = new DndUtil(bot.getDisplay());
-
// Get the location of P1
SWTBotGefEditPart p1Bot = editor.getEditPart(CONTAINER_TO_DRAG_P1).parent();
Point p1Location = editor.getBounds(p1Bot).getLocation();
@@ -705,7 +663,7 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
// DnD P2(EPackage) from the Model Content view to P1
semanticResourceNode = localSession.getSemanticResourceNode(ecoreEcoreResource);
final SWTBotTreeItem ecoreTreeItem = semanticResourceNode.expandNode(ROOTPACKAGE_NAME).expandNode(CONTAINER_TO_DRAG_P1).getNode(CLASS_TO_DRAG_C1);
- util.dragAndDrop(ecoreTreeItem, editor.getCanvas(), new org.eclipse.swt.graphics.Point(p1Location.x + 25, p1Location.y + 25));
+ ecoreTreeItem.dragAndDrop(editor.getCanvas(), new org.eclipse.swt.graphics.Point(p1Location.x + 25, p1Location.y + 25));
bot.waitUntil(new DiagramWithChildrensCondition(editor, 1));
assertEquals("An error message was generated !", rowCount, errorLogBot.tree().rowCount());
@@ -724,10 +682,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
*/
@Test
public void test_DnDClassFromContainer2ContainerBlank5() throws Exception {
- if (TestsUtil.shouldSkipUnreliableTests()) {
- return;
- }
-
test_DnDClassFromMC2ContainerBlank5();
try {
@@ -735,8 +689,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
SWTBot errorLogBot = bot.viewByPartName("Error Log").bot();
int rowCount = errorLogBot.tree().rowCount();
- DndUtil util = new DndUtil(bot.getDisplay());
-
// Get the location of P1
SWTBotGefEditPart p1Bot = editor.getEditPart(CONTAINER_TO_DRAG_P1).parent();
Point targetLocation = editor.getBounds(p1Bot).getLeft().getTranslated(-200, 0);
@@ -744,7 +696,7 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
// DnD P2(EPackage) from the Model Content view to the diagram
semanticResourceNode = localSession.getSemanticResourceNode(ecoreEcoreResource);
final SWTBotTreeItem ecoreTreeItem = semanticResourceNode.expandNode(ROOTPACKAGE_NAME).getNode(CONTAINER_TO_DRAG_P2);
- util.dragAndDrop(ecoreTreeItem, editor.getCanvas(), new org.eclipse.swt.graphics.Point(targetLocation.x, targetLocation.y));
+ ecoreTreeItem.dragAndDrop(editor.getCanvas(), new org.eclipse.swt.graphics.Point(targetLocation.x, targetLocation.y));
bot.waitUntil(new DiagramWithChildrensCondition(editor, 2));
assertEquals("An error message was generated !", rowCount, errorLogBot.tree().rowCount());
@@ -852,8 +804,6 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
SWTBot errorLogBot = bot.viewByPartName("Error Log").bot();
int rowCount = errorLogBot.tree().rowCount();
- DndUtil util = new DndUtil(bot.getDisplay());
-
// Get the location of P1
SWTBotGefEditPart p1Bot = editor.getEditPart(CONTAINER_TO_DRAG_P1).parent();
Point p1Location = editor.getBounds(p1Bot).getLocation();
@@ -861,7 +811,7 @@ public class DragNDropTest extends AbstractSiriusSwtBotGefTestCase {
// DnD P2(EPackage) from the Model Content view to P1
semanticResourceNode = localSession.getSemanticResourceNode(ecoreEcoreResource);
final SWTBotTreeItem ecoreTreeItem = semanticResourceNode.expandNode(ROOTPACKAGE_NAME).getNode(CONTAINER_TO_DRAG_P2);
- util.dragAndDrop(ecoreTreeItem, editor.getCanvas(), new org.eclipse.swt.graphics.Point(p1Location.x + 25, p1Location.y + 25));
+ ecoreTreeItem.dragAndDrop(editor.getCanvas(), new org.eclipse.swt.graphics.Point(p1Location.x + 25, p1Location.y + 25));
// Asserts that P2 was not created as child of P1 and no error
// message was generated
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/RefreshAfterViewCreationTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/RefreshAfterViewCreationTest.java
index 024abde9aa..ae45754565 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/RefreshAfterViewCreationTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/RefreshAfterViewCreationTest.java
@@ -22,7 +22,6 @@ import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramBorderNodeEdit
import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramContainerEditPart;
import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramListEditPart;
import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramNodeEditPart;
-import org.eclipse.sirius.tests.support.api.TestsUtil;
import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase;
import org.eclipse.sirius.tests.swtbot.support.api.business.UILocalSession;
import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource;
@@ -920,10 +919,6 @@ public class RefreshAfterViewCreationTest extends AbstractSiriusSwtBotGefTestCas
*/
@Test
public void testNodeCreationInContainerPositionStabilityUsingDragAndDropFromTreeview() throws Exception {
- if (TestsUtil.shouldSkipUnreliableTests()) {
- return;
- }
-
Assume.assumeFalse("Drag and drop from View does not work with Xvnc", DndUtil.isUsingXvnc());
final SWTBotSiriusDiagramEditor editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME_NODE_IN_CONTAINER,
REPRESENTATION_NAME_NODE_IN_CONTAINER, DDiagram.class, true, true);
@@ -946,8 +941,7 @@ public class RefreshAfterViewCreationTest extends AbstractSiriusSwtBotGefTestCas
SWTBotTreeItem nodeToDrag = localSession.getSemanticResourceNode(modelUIResource).expand().expandNode("root").expandNode("usecaseNodes").expandNode("p1").getNode("C2 -> C1");
nodeToDrag.select();
- DndUtil util = new DndUtil(bot.getDisplay());
- util.dragAndDrop(nodeToDrag, editor.getCanvas(), new org.eclipse.swt.graphics.Point(SOMEWHERE_IN_DIAGRAM.x + 10, SOMEWHERE_IN_DIAGRAM.y + 10));
+ nodeToDrag.dragAndDrop(editor.getCanvas(), new org.eclipse.swt.graphics.Point(SOMEWHERE_IN_DIAGRAM.x + 10, SOMEWHERE_IN_DIAGRAM.y + 10));
// Wait that dropped element appears in diagram
SWTBotUtils.waitAllUiEvents();
@@ -1100,10 +1094,6 @@ public class RefreshAfterViewCreationTest extends AbstractSiriusSwtBotGefTestCas
*/
@Test
public void testContainerCreationInContainerPositionStabilityUsingDragAndDropTool() throws Exception {
- if (TestsUtil.shouldSkipUnreliableTests()) {
- return;
- }
-
Assume.assumeFalse("Drag and drop from View does not work with Xvnc", DndUtil.isUsingXvnc());
editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME_CONTAINER_IN_CONTAINER, REPRESENTATION_NAME_CONTAINER_IN_CONTAINER,
DDiagram.class, true, true);
@@ -1126,8 +1116,7 @@ public class RefreshAfterViewCreationTest extends AbstractSiriusSwtBotGefTestCas
SWTBotTreeItem nodeToDrag = localSession.getSemanticResourceNode(modelUIResource).expand().expandNode("root").expandNode("usecaseNodes").expandNode("p1").getNode("C2 -> C1");
nodeToDrag.select();
- DndUtil util = new DndUtil(bot.getDisplay());
- util.dragAndDrop(nodeToDrag, editor.getCanvas(), new org.eclipse.swt.graphics.Point(SOMEWHERE_IN_DIAGRAM.x + 10, SOMEWHERE_IN_DIAGRAM.y + 10));
+ nodeToDrag.dragAndDrop(editor.getCanvas(), new org.eclipse.swt.graphics.Point(SOMEWHERE_IN_DIAGRAM.x + 10, SOMEWHERE_IN_DIAGRAM.y + 10));
// Wait that dropped element appears in diagram
SWTBotUtils.waitAllUiEvents();

Back to the top