Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/svg/GeneratedSVGFigureTest.java56
1 files changed, 55 insertions, 1 deletions
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/svg/GeneratedSVGFigureTest.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/svg/GeneratedSVGFigureTest.java
index 7d12b140b..b32ba36fe 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/svg/GeneratedSVGFigureTest.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/svg/GeneratedSVGFigureTest.java
@@ -11,8 +11,13 @@
*/
package org.eclipse.gmf.tests.lite.svg;
+import java.awt.geom.Rectangle2D;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
import org.eclipse.gmf.gmfgraph.FigureGallery;
import org.eclipse.gmf.gmfgraph.GMFGraphFactory;
+import org.eclipse.gmf.gmfgraph.SVGProperty;
import org.eclipse.gmf.runtime.lite.svg.SVGFigure;
import org.eclipse.gmf.tests.setup.figures.AbstractFigureGeneratorSetup;
import org.eclipse.gmf.tests.setup.figures.FigureGeneratorUtil;
@@ -55,11 +60,60 @@ public class GeneratedSVGFigureTest extends AbstractSVGFigureTest {
/**
* Check that SVGFigure generates.
*/
- public void testExistence() {
+ public void testBasicGeneration() {
org.eclipse.gmf.gmfgraph.SVGFigure f = GMFGraphFactory.eINSTANCE.createSVGFigure();
f.setName("Crate");
f.setDocumentURI(BOX_URI);
SVGFigure f2d = createDraw2DFigure(f);
assertEquals(f2d.getURI(), BOX_URI);
+ assertFalse(f2d.isSafeRendering());
+ assertNull(f2d.getAreaOfInterest());
+ }
+
+ /**
+ * Check that SVGFigure generates.
+ */
+ public void testAdvancedProperties() {
+ org.eclipse.gmf.gmfgraph.SVGFigure f = GMFGraphFactory.eINSTANCE.createSVGFigure();
+ f.setName("Crate");
+ f.setDocumentURI(BOX_URI);
+ f.setSafeRendering(true);
+ f.setAreaOfInterest(GMFGraphFactory.eINSTANCE.createRectangle2D());
+ f.getAreaOfInterest().setX(10);
+ f.getAreaOfInterest().setY(0.5);
+ f.getAreaOfInterest().setWidth(555);
+ f.getAreaOfInterest().setHeight(44.4);
+ SVGFigure f2d = createDraw2DFigure(f);
+ assertEquals(f2d.getURI(), BOX_URI);
+ assertTrue(f2d.isSafeRendering());
+ Rectangle2D aoi = f2d.getAreaOfInterest();
+ assertNotNull(aoi);
+ assertEquals(aoi.getX(), (double) 10);
+ assertEquals(aoi.getY(), (double) 0.5);
+ assertEquals(aoi.getWidth(), (double) 555);
+ assertEquals(aoi.getHeight(), (double) 44.4);
+ }
+
+ /**
+ * Check that string property generates and actually works.
+ */
+ public void testStringProperty() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ org.eclipse.gmf.gmfgraph.SVGFigure f = GMFGraphFactory.eINSTANCE.createSVGFigure();
+ f.setName("Crate");
+ f.setDocumentURI(BOX_URI);
+ SVGProperty p = GMFGraphFactory.eINSTANCE.createSVGProperty();
+ p.setQuery("//:rect");
+ p.setAttribute("width");
+ p.setGetter("getA");
+ p.setSetter("setA");
+ f.getProperties().add(p);
+ SVGFigure f2d = createDraw2DFigure(f);
+ Method getter = f2d.getClass().getMethod("getA");
+ Method setter = f2d.getClass().getMethod("setA", String.class);
+ String v = (String) getter.invoke(f2d);
+ assertEquals(v, "49");
+ setter.invoke(f2d, "23");
+ v = (String) getter.invoke(f2d);
+ assertEquals(v, "23");
}
}

Back to the top