1
package junit.test.svg;
3
import java.text.ParseException;
5
import junit.framework.TestCase;
6
import latexDraw.parsers.svg.elements.path.SVGPathSeg;
7
import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto;
8
import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg;
9
import latexDraw.parsers.svg.parsers.SVGPathHandler;
10
import latexDraw.parsers.svg.parsers.SVGPathParser;
12
import org.junit.Test;
15
* This class contains tests for the SVGPathSegMoveto class.<br>
17
* This file is part of LaTeXDraw<br>
18
* Copyright (c) 2005-2008 Arnaud BLOUIN<br>
20
* LaTeXDraw is free software; you can redistribute it and/or modify
21
* it under the terms of the GNU General Public License as published by
22
* the Free Software Foundation; either version 2 of the License, or
23
* any later version.<br>
25
* LaTeXDraw is distributed without any warranty; without even the
26
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
27
* PURPOSE. See the GNU General Public License for more details.<br>
30
* @author Arnaud BLOUIN<br>
33
public class TestSVGPathSegMoveto extends TestCase implements SVGPathHandler
35
protected final SVGPathSegMoveto seg = new SVGPathSegMoveto(-1, -2, false);
38
public void testGetters()
40
assertEquals(seg.getX(), -1.);
41
assertEquals(seg.getY(), -2.);
42
assertFalse(seg.isRelative());
43
assertEquals(seg.getType(), PathSeg.MOVETO_ABS);
48
public void testToString()
50
SVGPathParser parser = new SVGPathParser(seg.toString(), this);
52
try { parser.parse(); }
53
catch(ParseException e) { fail(); }
58
public void onPathSeg(SVGPathSeg pathSeg)
60
assertTrue(pathSeg instanceof SVGPathSegMoveto);
62
SVGPathSegMoveto seg2 = (SVGPathSegMoveto)pathSeg;
64
assertEquals(seg.getX(), seg2.getX());
65
assertEquals(seg.getY(), seg2.getY());
66
assertEquals(seg.isRelative(), seg2.isRelative());