// XAAL toolkit // Copyright (C) 2009 Ville Karavirta // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . package tests.xaal.parser.modules; import java.io.IOException; import java.io.StringReader; import java.util.Iterator; import junit.framework.TestCase; import org.xml.sax.SAXException; import xaal.objects.Defs; import xaal.objects.Initial; import xaal.objects.Xaal; import xaal.objects.graphical.Arc; import xaal.objects.graphical.Circle; import xaal.objects.graphical.CircleSegment; import xaal.objects.graphical.ColorConverter; import xaal.objects.graphical.Coordinate; import xaal.objects.graphical.Ellipse; import xaal.objects.graphical.Font; import xaal.objects.graphical.GraphicalPrimitive; import xaal.objects.graphical.Line; import xaal.objects.graphical.Point; import xaal.objects.graphical.Rectangle; import xaal.objects.graphical.ShapeDefinition; import xaal.objects.graphical.Square; import xaal.objects.graphical.Style; import xaal.objects.graphical.Text; import xaal.objects.graphical.Triangle; import xaal.parser.ParserModule; import xaal.parser.ParserModuleException; import xaal.parser.XmlParser; import xaal.parser.modules.XaalDSParserModule; import xaal.parser.modules.XaalGPParserModule; import xaal.parser.modules.XaalMainParserModule; /** * @author vkaravir * */ public class XaalGPParserModuleTest extends TestCase { private static final double DELTA = 0.00000001; private XmlParser xp; /** * @param name */ public XaalGPParserModuleTest(String name) { super(name); } /* (non-Javadoc) * @see junit.framework.TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); } /* (non-Javadoc) * @see junit.framework.TestCase#tearDown() */ protected void tearDown() throws Exception { super.tearDown(); } private void initializeXP() throws ParserModuleException { xp = new XmlParser(); xp.registerParserModule(XaalDSParserModule.class.getName()); xp.registerParserModule(XaalGPParserModule.class.getName()); xp.registerParserModule(XaalMainParserModule.class.getName()); } private Initial commonTests() { Object o = ParserModule.getProperty(XaalMainParserModule.XAAL_ROOT_OBJECT); assertEquals("XAAL_ROOT_OBJECT is null", true, o != null); assertEquals("XAAL_ROOT_OBJECT not instance of " + Xaal.class.getName(), true, o instanceof Xaal); Xaal x = (Xaal) o; assertEquals("Xaal.getInitial() returned null", true, x.getInitial() != null); return x.getInitial(); } /** * Test method for {@link xaal.parser.modules.XaalGPParserModule#startElementCircle(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)}. * @throws ParserModuleException * @throws SAXException * @throws IOException */ public void testElementCircle() throws ParserModuleException, IOException, SAXException { initializeXP(); xp.parse(new StringReader(""+ "