Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoratischenko2015-10-27 18:43:26 +0000
committerGerrit Code Review @ Eclipse.org2015-11-18 16:07:27 +0000
commite94966c15cb3959b8770c7800fad129ad8a8dab5 (patch)
treef90b0ee47de3b86862457f17e55ac72ce45d47f7 /tests
parentdba579d7d98e8549daf2cb2b8d7b889c09a6c679 (diff)
downloadorg.eclipse.papyrus-e94966c15cb3959b8770c7800fad129ad8a8dab5.tar.gz
org.eclipse.papyrus-e94966c15cb3959b8770c7800fad129ad8a8dab5.tar.xz
org.eclipse.papyrus-e94966c15cb3959b8770c7800fad129ad8a8dab5.zip
Bug 450921 - Additional graphics no longer available
- fix abstract sysml view provider - add test Change-Id: Ic0117dc53a821b0d147891d74a2fd0e54cd4d173 Signed-off-by: atischenko <tischenko@montages.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/providers/TestViewProvider_450921.java62
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/suites/AllProviderTests.java25
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/suites/AllTests.java3
3 files changed, 89 insertions, 1 deletions
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/providers/TestViewProvider_450921.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/providers/TestViewProvider_450921.java
new file mode 100644
index 00000000000..0576be45daa
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/providers/TestViewProvider_450921.java
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.sysml.diagram.blockdefinition.tests.providers;
+
+import org.junit.Assert;
+
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.CustomViewProvider;
+import org.eclipse.papyrus.sysml.diagram.blockdefinition.tests.AbstractTest;
+import org.eclipse.papyrus.sysml.diagram.blockdefinition.tests.utils.EditorUtils;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Proposed fix for #450921 allows null semantic adapters to be passed to papyrus ViewProvider's.
+ * (Before the patch, all null semantic adapters were filtered by the CreateViewCommand).
+ * This test verifies that the sysml view providers do not fail facing now allowed null adapters.
+ */
+public class TestViewProvider_450921 extends AbstractTest {
+
+ protected CustomViewProvider provider;
+
+ protected View diagram;
+
+ @Before
+ public void setUp() throws Exception {
+ provider = new CustomViewProvider();
+ diagram = EditorUtils.getDiagramView();
+ }
+
+ @Test
+ public void testNullSemanticAdapter() throws Exception {
+ IOperation o = new CreateNodeViewOperation(null, diagram, SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_CLASSIFIER_ID, -1, false, EditorUtils.getDiagramEditPart().getDiagramPreferencesHint());
+ Assert.assertTrue("Provider should provide node while semantic adapter null", provider.provides(o));
+ }
+
+ @Test
+ public void testNullSemanticAdapterAndEmptyHint() throws Exception {
+ IOperation o = new CreateNodeViewOperation(null, diagram, "", -1, false, EditorUtils.getDiagramEditPart().getDiagramPreferencesHint());
+ Assert.assertFalse("Provider should not provide undefined element", provider.provides(o));
+ }
+
+ @Test
+ public void testNullSemanticAdapterAndDabHint() throws Exception {
+ IOperation o = new CreateNodeViewOperation(null, diagram, "Bad hint", -1, false, EditorUtils.getDiagramEditPart().getDiagramPreferencesHint());
+ Assert.assertFalse("Provider should not provide undefined element", provider.provides(o));
+ }
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/suites/AllProviderTests.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/suites/AllProviderTests.java
new file mode 100644
index 00000000000..8876e13eb64
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/suites/AllProviderTests.java
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.sysml.diagram.blockdefinition.tests.suites;
+
+import org.eclipse.papyrus.sysml.diagram.blockdefinition.tests.providers.TestViewProvider_450921;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({ TestViewProvider_450921.class })
+public class AllProviderTests {
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/suites/AllTests.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/suites/AllTests.java
index 851baad77e1..15322eced0d 100644
--- a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/suites/AllTests.java
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/suites/AllTests.java
@@ -33,7 +33,8 @@ import org.junit.runners.Suite.SuiteClasses;
AllDnDLinkTests.class,
AllDeletionTests.class,
AllUtilsTests.class,
- AllCanonicalTests.class
+ AllCanonicalTests.class,
+ AllProviderTests.class
})
public class AllTests {

Back to the top