Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpguilet2016-10-12 13:58:33 +0000
committerLaurent Redor2016-10-18 13:33:43 +0000
commitd7b9bc29b1f3bfba6c6a05ad7ad7579b372e8428 (patch)
tree0937246e1f4fde9a41103a01be1ef97a4b15dd2e
parent778e68a2b3616a73592ab00e6591fe5d587976d8 (diff)
downloadorg.eclipse.sirius-d7b9bc29b1f3bfba6c6a05ad7ad7579b372e8428.tar.gz
org.eclipse.sirius-d7b9bc29b1f3bfba6c6a05ad7ad7579b372e8428.tar.xz
org.eclipse.sirius-d7b9bc29b1f3bfba6c6a05ad7ad7579b372e8428.zip
[465952] Add tests corresponding to the fix
-Add tests on container drop properties verifying that property widgets extending AbstractEditorDialogWithListPropertySection show elements with their qualified label. -Updated tests checking labels result with the label provider used by property widget instead of verifying that the right qualified label is shown. Bug: 465952 Change-Id: I47c49e2930eb3d5d9d61ab2a95d3f490050d0d86 Signed-off-by: pguilet <pierre.guilet@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/ContainerDropPropertySectionsTests.java120
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CustomizationPropertySectionsTests.java36
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java2
3 files changed, 136 insertions, 22 deletions
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/ContainerDropPropertySectionsTests.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/ContainerDropPropertySectionsTests.java
new file mode 100644
index 0000000000..afeecefef7
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/ContainerDropPropertySectionsTests.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Obeo.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.tests.swtbot.editor.vsm;
+
+import org.eclipse.sirius.tests.swtbot.Activator;
+import org.eclipse.sirius.ui.tools.api.views.modelexplorerview.IModelExplorerView;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+
+/**
+ * A SWTBot test for VSM editor container drop property sections.
+ *
+ * See eclipse bug 465952.
+ *
+ * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a>
+ *
+ */
+public class ContainerDropPropertySectionsTests extends AbstractContentAssistTest {
+
+ private static final String PATH = "/data/unit/dragAndDrop/tc-1041/";
+
+ private static final String MODELER_RESOURCE_NAME = "tc1041.odesign";
+
+ private static final String GROUP_NAME = "Ticket #1041";
+
+ private static final String VIEWPOINT_NAME = "Test case for ticket #1041";
+
+ private static final String DIAGRAM_DESCRIPTION_NAME1 = "TC1041 representation 2 Blank";
+
+ private static final String DIAGRAM_DESCRIPTION_NAME2 = "TC1041 representation 3";
+
+ private static final String DIAGRAM_DESCRIPTION_NAME3 = "TC1041 representation 1";
+
+ private static final String FIRST_REPRESENTATION_CONTAINER_NAME = "Container EPackage R1";
+
+ private static final String DEFAULT_LAYER_NAME = "Default";
+
+ private static final String QUALIFIED_NAME_SEPARATOR = " > ";
+
+ private static final String MODEL = "tc1041.ecore";
+
+ private static final String SESSION_FILE = "tc1041.aird";
+
+ private SWTBotEditor odesignEditorBot;
+
+ private SWTBotTreeItem viewpointItemBot;
+
+ private SWTBotView propertiesBot;
+
+ @Override
+ protected void onSetUpBeforeClosingWelcomePage() throws Exception {
+ copyFileToTestProject(Activator.PLUGIN_ID, PATH, MODEL, SESSION_FILE, MODELER_RESOURCE_NAME);
+ }
+
+ @Override
+ protected void onSetUpAfterOpeningDesignerPerspective() throws Exception {
+ super.onSetUpAfterOpeningDesignerPerspective();
+
+ SWTBotView projectExplorer = bot.viewById(IModelExplorerView.ID);
+ projectExplorer.setFocus();
+ SWTBot projectExplorerBot = projectExplorer.bot();
+ projectExplorerBot.tree().expandNode(getProjectName()).expandNode(MODELER_RESOURCE_NAME).doubleClick();
+
+ odesignEditorBot = bot.activeEditor();
+ odesignEditorBot.setFocus();
+ viewpointItemBot = odesignEditorBot.bot().tree().expandNode("platform:/resource/" + getProjectName() + "/" + MODELER_RESOURCE_NAME, true);
+ viewpointItemBot.setFocus();
+ }
+
+ /**
+ * Test Containers sections. The items in the section must have their label
+ * qualified.
+ */
+ public void testContainersReferences() {
+ SWTBotTreeItem layerNode = viewpointItemBot.getNode(0).getNode(0).getNode(0).getNode(DEFAULT_LAYER_NAME);
+ SWTBotTreeItem containerDropNode = layerNode.getNode(1).getNode(1);
+ containerDropNode.select();
+
+ propertiesBot = bot.viewByTitle("Properties");
+ propertiesBot.setFocus();
+
+ SWTBotButton appliedOnButton = propertiesBot.bot().button(0);
+ appliedOnButton.click();
+ SWTBotShell appliedOnSelectorShell = bot.activeShell();
+ SWTBot appliedOnSelectorShellBot = appliedOnSelectorShell.bot();
+ SWTBotTable table1 = appliedOnSelectorShellBot.table(0);
+ assertEquals("The left containers selection table does not contains all elements it should.", 13, table1.rowCount());
+ SWTBotTable table2 = appliedOnSelectorShellBot.table(1);
+ assertEquals("The right containers selection table does not contains all elements it should.", 2, table2.rowCount());
+ assertEquals(GROUP_NAME + QUALIFIED_NAME_SEPARATOR + VIEWPOINT_NAME + QUALIFIED_NAME_SEPARATOR + DIAGRAM_DESCRIPTION_NAME1, table1.getTableItem(1).getText());
+ assertEquals(GROUP_NAME + QUALIFIED_NAME_SEPARATOR + VIEWPOINT_NAME + QUALIFIED_NAME_SEPARATOR + DIAGRAM_DESCRIPTION_NAME2, table1.getTableItem(4).getText());
+ assertEquals(GROUP_NAME + QUALIFIED_NAME_SEPARATOR + VIEWPOINT_NAME + QUALIFIED_NAME_SEPARATOR + DIAGRAM_DESCRIPTION_NAME3, table2.getTableItem(0).getText());
+ assertEquals(GROUP_NAME + QUALIFIED_NAME_SEPARATOR + VIEWPOINT_NAME + QUALIFIED_NAME_SEPARATOR + DIAGRAM_DESCRIPTION_NAME3 + QUALIFIED_NAME_SEPARATOR + DEFAULT_LAYER_NAME
+ + QUALIFIED_NAME_SEPARATOR + FIRST_REPRESENTATION_CONTAINER_NAME, table2.getTableItem(1).getText());
+ appliedOnSelectorShell.close();
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ odesignEditorBot.close();
+ odesignEditorBot = null;
+ propertiesBot = null;
+ viewpointItemBot = null;
+ super.tearDown();
+ }
+}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CustomizationPropertySectionsTests.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CustomizationPropertySectionsTests.java
index 4499c9b3d7..05a203e2ac 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CustomizationPropertySectionsTests.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CustomizationPropertySectionsTests.java
@@ -21,9 +21,6 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.sirius.diagram.description.AdditionalLayer;
import org.eclipse.sirius.diagram.description.DiagramDescription;
import org.eclipse.sirius.diagram.description.style.StylePackage;
@@ -32,7 +29,6 @@ import org.eclipse.sirius.tests.support.api.EclipseTestsSupportHelper;
import org.eclipse.sirius.tests.support.api.TestsUtil;
import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusHelper;
import org.eclipse.sirius.tests.swtbot.support.utils.SWTBotUtils;
-import org.eclipse.sirius.ui.business.api.dialect.HierarchyLabelProvider;
import org.eclipse.sirius.ui.tools.api.views.modelexplorerview.IModelExplorerView;
import org.eclipse.sirius.viewpoint.description.Customization;
import org.eclipse.sirius.viewpoint.description.EAttributeCustomization;
@@ -162,11 +158,9 @@ public class CustomizationPropertySectionsTests extends AbstractContentAssistTes
assertEquals("The left list of available elements should be of 3, for the begin/center/end edge style description", 3, table1.rowCount());
SWTBotTable table2 = appliedOnSelectorShellBot.table(1);
assertEquals("The right list of selected elements should be of 3", 3, table2.rowCount());
- AdapterFactoryLabelProvider wrappedProvider = new AdapterFactoryLabelProvider(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE));
- ILabelProvider labelProvider = new HierarchyLabelProvider(wrappedProvider);
- assertEquals(labelProvider.getText(eAttributeCustomization.getAppliedOn().get(0)), table2.getTableItem(0).getText());
- assertEquals(labelProvider.getText(eAttributeCustomization.getAppliedOn().get(1)), table2.getTableItem(1).getText());
- assertEquals(labelProvider.getText(eAttributeCustomization.getAppliedOn().get(2)), table2.getTableItem(2).getText());
+ assertEquals("StyleCustomizations > StyleCustomizations > DiagramDescription > Default > EPackageMapping > Gradient white to light_gray", table2.getTableItem(0).getText());
+ assertEquals("StyleCustomizations > StyleCustomizations > DiagramDescription > Default > EClassMapping > EAttributeMapping > Gauge", table2.getTableItem(1).getText());
+ assertEquals("StyleCustomizations > StyleCustomizations > DiagramDescription > Default > EClassMapping > Gradient white to light_gray", table2.getTableItem(2).getText());
appliedOnSelectorShell.close();
// Test that without attributeName we have 5 style description elements
@@ -179,11 +173,10 @@ public class CustomizationPropertySectionsTests extends AbstractContentAssistTes
assertEquals("The left list of available elements should be of 5, i.e. all available style description elements", 5, appliedOnSelectorShell.bot().table(0).rowCount());
table2 = appliedOnSelectorShellBot.table(1);
assertEquals("The right list of selected elements should be of 3", 3, table2.rowCount());
- assertEquals(labelProvider.getText(eAttributeCustomization.getAppliedOn().get(0)), table2.getTableItem(0).getText());
- assertEquals(labelProvider.getText(eAttributeCustomization.getAppliedOn().get(1)), table2.getTableItem(1).getText());
- assertEquals(labelProvider.getText(eAttributeCustomization.getAppliedOn().get(2)), table2.getTableItem(2).getText());
+ assertEquals("StyleCustomizations > StyleCustomizations > DiagramDescription > Default > EPackageMapping > Gradient white to light_gray", table2.getTableItem(0).getText());
+ assertEquals("StyleCustomizations > StyleCustomizations > DiagramDescription > Default > EClassMapping > EAttributeMapping > Gauge", table2.getTableItem(1).getText());
+ assertEquals("StyleCustomizations > StyleCustomizations > DiagramDescription > Default > EClassMapping > Gradient white to light_gray", table2.getTableItem(2).getText());
appliedOnSelectorShell.close();
- labelProvider.dispose();
}
/**
@@ -232,11 +225,10 @@ public class CustomizationPropertySectionsTests extends AbstractContentAssistTes
assertEquals("The left list of available elements should be empty because we have already selected elements selectionnable", 0, appliedOnSelectorShellBot.table(0).rowCount());
SWTBotTable table2 = appliedOnSelectorShellBot.table(1);
assertEquals("The right list of selected elements should be of 3", 3, table2.rowCount());
- AdapterFactoryLabelProvider wrappedProvider = new AdapterFactoryLabelProvider(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE));
- ILabelProvider labelProvider = new HierarchyLabelProvider(wrappedProvider);
- assertEquals(labelProvider.getText(eReferenceCustomization.getAppliedOn().get(0)), table2.getTableItem(0).getText());
- assertEquals(labelProvider.getText(eReferenceCustomization.getAppliedOn().get(1)), table2.getTableItem(1).getText());
- assertEquals(labelProvider.getText(eReferenceCustomization.getAppliedOn().get(2)), table2.getTableItem(2).getText());
+ assertEquals("StyleCustomizations > StyleCustomizations > DiagramDescription > Default > EClassMapping > Gradient white to light_gray", table2.getTableItem(0).getText());
+ assertEquals("StyleCustomizations > StyleCustomizations > DiagramDescription > Default > EPackageMapping > Gradient white to light_gray", table2.getTableItem(1).getText());
+ assertEquals("StyleCustomizations > StyleCustomizations > DiagramDescription > Default > EClassMapping > EAttributeMapping > Gauge > Gauge Section black to green",
+ table2.getTableItem(2).getText());
appliedOnSelectorShell.close();
// Test that without attributeName we have 5 style description elements
@@ -249,11 +241,11 @@ public class CustomizationPropertySectionsTests extends AbstractContentAssistTes
assertEquals("The left list of available elements should be of 5, i.e. all available style description elements", 5, appliedOnSelectorShellBot.table(0).rowCount());
table2 = appliedOnSelectorShellBot.table(1);
assertEquals("The right list of selected elements should be of 3", 3, table2.rowCount());
- assertEquals(labelProvider.getText(eReferenceCustomization.getAppliedOn().get(0)), table2.getTableItem(0).getText());
- assertEquals(labelProvider.getText(eReferenceCustomization.getAppliedOn().get(1)), table2.getTableItem(1).getText());
- assertEquals(labelProvider.getText(eReferenceCustomization.getAppliedOn().get(2)), table2.getTableItem(2).getText());
+ assertEquals("StyleCustomizations > StyleCustomizations > DiagramDescription > Default > EClassMapping > Gradient white to light_gray", table2.getTableItem(0).getText());
+ assertEquals("StyleCustomizations > StyleCustomizations > DiagramDescription > Default > EPackageMapping > Gradient white to light_gray", table2.getTableItem(1).getText());
+ assertEquals("StyleCustomizations > StyleCustomizations > DiagramDescription > Default > EClassMapping > EAttributeMapping > Gauge > Gauge Section black to green",
+ table2.getTableItem(2).getText());
appliedOnSelectorShell.close();
- labelProvider.dispose();
}
/**
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
index 3a403f6871..8cf7d34f82 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
@@ -26,6 +26,7 @@ import org.eclipse.sirius.tests.swtbot.crossTable.CrossTableIntersectionExpressi
import org.eclipse.sirius.tests.swtbot.crossTable.CrossTableIntersectionTest;
import org.eclipse.sirius.tests.swtbot.editor.vsm.BorderSizeComputationExpressionTest;
import org.eclipse.sirius.tests.swtbot.editor.vsm.CompletionProposalInVSMTest;
+import org.eclipse.sirius.tests.swtbot.editor.vsm.ContainerDropPropertySectionsTests;
import org.eclipse.sirius.tests.swtbot.editor.vsm.ContentAssistTest;
import org.eclipse.sirius.tests.swtbot.editor.vsm.CreateMandatoryElementsTest;
import org.eclipse.sirius.tests.swtbot.editor.vsm.CustomizationPropertySectionsTests;
@@ -284,6 +285,7 @@ public class AllTestSuite extends TestCase {
suite.addTestSuite(EdgeMappingTestCase.class);
suite.addTestSuite(InvalidMetamodelRessourceTest.class);
suite.addTestSuite(ExtensionActivationOrderTest.class);
+ suite.addTestSuite(ContainerDropPropertySectionsTests.class);
}
/**

Back to the top