diff options
author | Camille Letavernier | 2014-05-19 15:45:53 +0000 |
---|---|---|
committer | Camille Letavernier | 2014-05-19 15:45:53 +0000 |
commit | 254079d9b9962b5977e058fdd6353c29c1e197e6 (patch) | |
tree | 65f65d12022222d7e317517db4aee970a91dda74 /tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests | |
parent | a2d8828f0bd0d9ddbf7280ad3d7db8331d5dfe93 (diff) | |
download | org.eclipse.papyrus-254079d9b9962b5977e058fdd6353c29c1e197e6.tar.gz org.eclipse.papyrus-254079d9b9962b5977e058fdd6353c29c1e197e6.tar.xz org.eclipse.papyrus-254079d9b9962b5977e058fdd6353c29c1e197e6.zip |
430023: [Papyrus Tests] Papyrus shall propose different levels of
testing, to allow test-driven development
https://bugs.eclipse.org/bugs/show_bug.cgi?id=430023
- Add constants for default configurations
- Add @ExpensiveTests for exclusion from Lightweight test job
- Include some existing CSS Tests to the build
Diffstat (limited to 'tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests')
3 files changed, 40 insertions, 13 deletions
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/AllTests.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/AllTests.java index 185aab5136d..21483517fbc 100644 --- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/AllTests.java +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/AllTests.java @@ -17,7 +17,7 @@ import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class)
-@SuiteClasses({ CSSClassProviderTest.class, CSSStylesheetTest.class, CSSCompartmentsTests.class
+@SuiteClasses({ CSSClassProviderTest.class, CSSStylesheetTest.class, CSSCompartmentsTests.class, CSSSupportTest.class
})
public class AllTests {
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java index 3e456f0d573..c219df2b038 100644 --- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java @@ -9,7 +9,7 @@ * Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 422257
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.tests.tests;
@@ -74,7 +74,7 @@ public class CSSCompartmentsTests extends AbstractPapyrusTest { @Rule
public final HouseKeeper houseKeeper = new HouseKeeper();
-
+
private CSSDiagram diagram;
@Before
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSSupportTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSSupportTest.java index 5fa3990d46d..1a230e6a0c2 100644 --- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSSupportTest.java +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSSupportTest.java @@ -1,6 +1,6 @@ /*****************************************************************************
* Copyright (c) 2012, 2014 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
@@ -9,36 +9,44 @@ * Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 422257
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.tests.tests;
+import java.util.List;
+
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.helper.CSSHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagram;
+import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.tests.Activator;
import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
+import org.eclipse.papyrus.junit.utils.tests.AbstractPapyrusTest;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
/**
* Test the installation of CSS Support on a standard ResourceSet
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
-public class CSSSupportTest {
+public class CSSSupportTest extends AbstractPapyrusTest {
@Rule
public final HouseKeeper houseKeeper = new HouseKeeper();
-
+
/**
* Installs the CSS support on a resource set and check the results
- *
+ *
* @throws Exception
*/
@Test
@@ -65,10 +73,12 @@ public class CSSSupportTest { /**
* Tests a standard resource set (without CSS support) and check the results.
- *
+ *
* @throws Exception
*/
@Test
+ @SuppressWarnings("unchecked")
+ //GMF Notation model
public void testWithoutCSSSupport() throws Exception {
//Standard resource set (Without CSS Support installed)
ResourceSet resourceSetWithoutCSSSupport = houseKeeper.createResourceSet();
@@ -77,7 +87,24 @@ public class CSSSupportTest { Diagram diagram = (Diagram)EMFHelper.loadEMFModel(resourceSetWithoutCSSSupport, uri);
- //The diagram should be a standard GMF Diagram (i.e. not a CSSDiagram)
- Assert.assertFalse(diagram instanceof CSSDiagram);
+ //The diagram should be a CSSDiagram, even if the CSS Support is not installed (The NotationFactory is a Singleton)
+ Assert.assertTrue(diagram instanceof CSSDiagram);
+
+ Assert.assertFalse(CSSHelper.isCSSSupported(resourceSetWithoutCSSSupport));
+
+ for(View childNode : (List<View>)diagram.getChildren()) {
+ if(childNode instanceof Shape) {
+ Shape child = (Shape)childNode;
+ for(EStructuralFeature feature : child.eClass().getEAllStructuralFeatures()) {
+ if(NotationPackage.eINSTANCE.getStyle().isSuperTypeOf(feature.getEContainingClass())) {
+ //For non-CSS models, this method should always return true (i.e. the value is never computed)
+ Assert.assertTrue(ForceValueHelper.isSet(child, feature, null));
+ System.out.println("Test");
+ }
+ }
+ }
+ }
+
+ resourceSetWithoutCSSSupport.getResources().remove(diagram.eResource());
}
}
|