Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-10-31 19:27:28 +0000
committeratikhomirov2006-10-31 19:27:28 +0000
commit8f229622fb4540856ad733b3d663d27763e23357 (patch)
tree713ada31dd39baf57f1dfbbbe944ae8ab3539ba2
parent7a28eaf42602b4711d2f1e511ca94297e170f2fc (diff)
downloadorg.eclipse.gmf-tooling-8f229622fb4540856ad733b3d663d27763e23357.tar.gz
org.eclipse.gmf-tooling-8f229622fb4540856ad733b3d663d27763e23357.tar.xz
org.eclipse.gmf-tooling-8f229622fb4540856ad733b3d663d27763e23357.zip
better structure shared performTests use
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTest.java9
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTestBase.java6
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureLayoutTest.java33
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/LabelSupportTest.java10
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/LayoutAwareCheck.java2
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/ShapePropertiesTest.java32
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/StandalonePluginConverterTest.java14
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/figures/FigureCheck.java1
8 files changed, 45 insertions, 62 deletions
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTest.java
index 70f84fce7..9c4304121 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTest.java
@@ -56,15 +56,18 @@ public class FigureCodegenTest extends FigureCodegenTestBase {
}
public void testGenCustomFigure() {
- performTests(getSessionSetup().getCustomFigure());
+ final Figure f = getSessionSetup().getCustomFigure();
+ performTests(f, new GenericFigureCheck(f));
}
public void testGenSimpleShape() {
- performTests(getSessionSetup().getSimpleShape());
+ final Figure f = getSessionSetup().getSimpleShape();
+ performTests(f, new GenericFigureCheck(f));
}
public void testGenComplexShape() {
- performTests(getSessionSetup().getComplexShape());
+ final Figure f = getSessionSetup().getComplexShape();
+ performTests(f, new GenericFigureCheck(f));
}
public void testGenCustomFigureWithAttributes(){
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTestBase.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTestBase.java
index 27fd0233a..e275d3752 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTestBase.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTestBase.java
@@ -13,13 +13,11 @@ package org.eclipse.gmf.tests.gen;
import junit.framework.TestCase;
-import org.eclipse.draw2d.IFigure;
import org.eclipse.gmf.gmfgraph.Figure;
import org.eclipse.gmf.tests.NeedsSetup;
import org.eclipse.gmf.tests.setup.figures.AbstractFigureGeneratorSetup;
import org.eclipse.gmf.tests.setup.figures.FigureCheck;
import org.eclipse.gmf.tests.setup.figures.FigureGeneratorUtil;
-import org.eclipse.gmf.tests.setup.figures.GenericFigureCheck;
/**
* @author artem
@@ -36,10 +34,6 @@ public class FigureCodegenTestBase extends TestCase implements NeedsSetup {
mySessionSetup = sessionSetup;
}
- protected void performTests(Figure f) {
- performTests(f, new GenericFigureCheck(f));
- }
-
protected void performTests(Figure f, FigureCheck check) {
FigureGeneratorUtil.generateAndParse(f);
Class figureClass = mySessionSetup.getFigureClass(f);
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureLayoutTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureLayoutTest.java
index df25a3cc9..5b1ca457d 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureLayoutTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureLayoutTest.java
@@ -31,7 +31,7 @@ public class FigureLayoutTest extends FigureCodegenTestBase {
//XXX: This test now fails due to absence of the GridLayout.
//However, some less restictive checks done for grid layout in the performGridLayputTests() method
//If this test passes, it is safe to replace performGridLayputTests() with perfromTests() in the whole class.
- performTests(getSessionSetup().getParent4());
+ doPerformTests(getSessionSetup().getParent4());
}
public void testConcreteShapeLayoutAllProperties(){
@@ -43,7 +43,7 @@ public class FigureLayoutTest extends FigureCodegenTestBase {
}
public void testDeepChildrenLayout(){
- performTests(getSessionSetup().getParent());
+ doPerformTests(getSessionSetup().getParent());
}
public void testLayoutDefaults(){
@@ -55,15 +55,15 @@ public class FigureLayoutTest extends FigureCodegenTestBase {
}
public void testMissedLayoutPresentLayoutData(){
- performTests(getSessionSetup().getParent1());
+ doPerformTests(getSessionSetup().getParent1());
}
public void testBorderLayout(){
- performTests(getSessionSetup().getParent2());
+ doPerformTests(getSessionSetup().getParent2());
}
public void testBorderLayoutDataCenter(){
- performTests(getSessionSetup().getParent3());
+ doPerformTests(getSessionSetup().getParent3());
}
public void testCustomLayout(){
@@ -72,43 +72,34 @@ public class FigureLayoutTest extends FigureCodegenTestBase {
}
public void testStackLayout(){
- performTests(getSessionSetup().getGroup());
+ doPerformTests(getSessionSetup().getGroup());
}
public void testFlowLayout(){
- performTests(getSessionSetup().getGroup1());
+ doPerformTests(getSessionSetup().getGroup1());
}
public void testToolbarLayoutUnusedAndIncorrectValues(){
- performTests(getSessionSetup().getGroup2());
+ doPerformTests(getSessionSetup().getGroup2());
}
public void testToolbarLayout(){
- performTests(getSessionSetup().getGroup3());
+ doPerformTests(getSessionSetup().getGroup3());
}
public void testXYLayout(){
- Figure group = getSessionSetup().getGroup4();
-// [AS]: Removed because child figures will be "checked" in any case and
-// it does not makes sence to generate code for these figures separately
-// in this test.
-// Figure left = (Figure) group.getChildren().get(0);
-// Figure right = (Figure) group.getChildren().get(1);
-
- performTests(group);
-// performTests(right);
-// performTests(left);
+ doPerformTests(getSessionSetup().getGroup4());
}
public void testXYLayoutForCustomFigure(){
- performTests(getSessionSetup().getGroup5());
+ doPerformTests(getSessionSetup().getGroup5());
}
private void performGridLayoutTests(Figure figure){
FigureGeneratorUtil.generateAndParse(figure);
}
- protected void performTests(Figure f) {
+ protected void doPerformTests(Figure f) {
super.performTests(f, new LayoutAwareCheck(f));
}
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/LabelSupportTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/LabelSupportTest.java
index 4270313e0..35ffb312d 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/LabelSupportTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/LabelSupportTest.java
@@ -35,22 +35,22 @@ public class LabelSupportTest extends FigureCodegenTestBase {
}
public void testCustomFugureWithLabel(){
- performTests(getSessionSetup().getCustom());
+ doPerformTests(getSessionSetup().getCustom());
}
public void testRectangleWithLabel(){
- performTests(getSessionSetup().getSimple());
+ doPerformTests(getSessionSetup().getSimple());
}
public void testLabeledContainer(){
- performTests(getSessionSetup().getLabeledContainer());
+ doPerformTests(getSessionSetup().getLabeledContainer());
}
public void testDeepLabelGraphdefOnly(){
- performTests(getSessionSetup().getRoot());
+ doPerformTests(getSessionSetup().getRoot());
}
- protected void performTests(Figure figure) {
+ protected void doPerformTests(Figure figure) {
performTests(figure, new GenericFigureCheck(figure).chain(new LabelAccessorCheck(getSessionSetup().getLabelName())));
}
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/LayoutAwareCheck.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/LayoutAwareCheck.java
index 1e61d3e29..eb88728b3 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/LayoutAwareCheck.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/LayoutAwareCheck.java
@@ -61,7 +61,7 @@ public class LayoutAwareCheck extends GenericFigureCheck {
}
LayoutManager layouter = d2dFigure.getParent().getLayoutManager();
if (layouter == null){
- //ok -- say there are no GMF layout for parent
+ //ok -- there is no GMF layout for parent
return;
}
Object constraint = layouter.getConstraint(d2dFigure);
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/ShapePropertiesTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/ShapePropertiesTest.java
index af25f015e..ca1a6caeb 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/ShapePropertiesTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/ShapePropertiesTest.java
@@ -14,6 +14,8 @@ package org.eclipse.gmf.tests.gen;
import junit.framework.Assert;
+import org.eclipse.gmf.gmfgraph.Figure;
+import org.eclipse.gmf.tests.setup.figures.GenericFigureCheck;
import org.eclipse.gmf.tests.setup.figures.ShapePropertiesSetup;
public class ShapePropertiesTest extends FigureCodegenTestBase {
@@ -31,51 +33,55 @@ public class ShapePropertiesTest extends FigureCodegenTestBase {
}
public void testShapeLineStyle() {
- performTests(getSessionSetup().getContainer());
+ doPerformTests(getSessionSetup().getContainer());
}
public void testShapeLineWidth() {
- performTests(getSessionSetup().getShape());
+ doPerformTests(getSessionSetup().getShape());
}
public void testShapeFont(){
- performTests(getSessionSetup().getShape1());
+ doPerformTests(getSessionSetup().getShape1());
}
public void testShapeInsets() {
- performTests(getSessionSetup().getWithInsets());
+ doPerformTests(getSessionSetup().getWithInsets());
}
public void testLineBorder() {
- performTests(getSessionSetup().getContainer1());
+ doPerformTests(getSessionSetup().getContainer1());
}
public void testCompoundBorder(){
- performTests(getSessionSetup().getTester());
+ doPerformTests(getSessionSetup().getTester());
}
public void testMarginBorder(){
- performTests(getSessionSetup().getMarginTester());
+ doPerformTests(getSessionSetup().getMarginTester());
}
public void testCustomBorder(){
- performTests(getSessionSetup().getCustomBorderTester());
+ doPerformTests(getSessionSetup().getCustomBorderTester());
}
public void testConstantColors(){
- performTests(getSessionSetup().getRainbow());
+ doPerformTests(getSessionSetup().getRainbow());
}
public void testMaxAndMinSize(){
- performTests(getSessionSetup().getWithMinAndMaxSize());
+ doPerformTests(getSessionSetup().getWithMinAndMaxSize());
}
public void testDefaultFontName(){
- performTests(getSessionSetup().getRoot());
+ doPerformTests(getSessionSetup().getRoot());
}
public void testScalablePolygon(){
- performTests(getSessionSetup().getScalablePolygon());
- performTests(getSessionSetup().getInnerScalablePolygonTester());
+ doPerformTests(getSessionSetup().getScalablePolygon());
+ doPerformTests(getSessionSetup().getInnerScalablePolygonTester());
+ }
+
+ protected void doPerformTests(Figure f) {
+ super.performTests(f, new GenericFigureCheck(f));
}
}
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/StandalonePluginConverterTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/StandalonePluginConverterTest.java
index c1f55e52d..a164f3b2e 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/StandalonePluginConverterTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/StandalonePluginConverterTest.java
@@ -66,12 +66,7 @@ public class StandalonePluginConverterTest extends TestCase {
Rectangle layeredPaneItself = GMFGraphFactory.eINSTANCE.createRectangle();
layeredPaneItself.setName(LayeredPane.class.getSimpleName());
- Figure[] originals = new Figure[] {
- usesLayeredPane,
- layeredPaneItself,
- };
-
- gallery.getFigures().addAll(Arrays.asList(originals));
+ gallery.getFigures().addAll(Arrays.asList(usesLayeredPane, layeredPaneItself));
final StandaloneGenerator.Config config = FigureGeneratorUtil.createStandaloneGeneratorConfig(CUSTOM_FIGURES_PACKAGE, false);
GeneratedClassData[] genResults = FigureGeneratorUtil.generateAndCompile(gallery, config);
@@ -144,12 +139,7 @@ public class StandalonePluginConverterTest extends TestCase {
LabeledContainer labeledContainer = GMFGraphFactory.eINSTANCE.createLabeledContainer();
labeledContainer.setName("GraphLabeledContainer");
- gallery.getFigures().addAll(Arrays.asList(new Figure[] {
- label,
- connection,
- rectangle,
- labeledContainer,
- }));
+ gallery.getFigures().addAll(Arrays.asList(label, connection, rectangle, labeledContainer));
Node node = GMFGraphFactory.eINSTANCE.createNode();
node.setName("DiagramNode");
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/figures/FigureCheck.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/figures/FigureCheck.java
index 61ce89d59..57107107b 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/figures/FigureCheck.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/figures/FigureCheck.java
@@ -14,7 +14,6 @@ package org.eclipse.gmf.tests.setup.figures;
import junit.framework.Assert;
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
public abstract class FigureCheck extends Assert {

Back to the top