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.SVGPathSegCurvetoQuadraticSmooth;
8
import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto;
9
import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg;
10
import latexDraw.parsers.svg.parsers.SVGPathHandler;
11
import latexDraw.parsers.svg.parsers.SVGPathParser;
13
import org.junit.Test;
16
* This class contains tests for the SVGPathSegCurvetoQuadraticSmooth class.<br>
18
* This file is part of LaTeXDraw<br>
19
* Copyright (c) 2005-2008 Arnaud BLOUIN<br>
21
* LaTeXDraw is free software; you can redistribute it and/or modify
22
* it under the terms of the GNU General Public License as published by
23
* the Free Software Foundation; either version 2 of the License, or
24
* any later version.<br>
26
* LaTeXDraw is distributed without any warranty; without even the
27
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
28
* PURPOSE. See the GNU General Public License for more details.<br>
31
* @author Arnaud BLOUIN<br>
34
@SuppressWarnings("nls")
35
public class TestSVGPathSegCurvetoQuadraticSmooth extends TestCase implements SVGPathHandler
37
protected final SVGPathSegCurvetoQuadraticSmooth seg = new SVGPathSegCurvetoQuadraticSmooth(-5.23e-10, 6.5, false);
38
protected int cpt = 0;
41
public void testGetters()
43
assertEquals(seg.getX(), -5.23e-10);
44
assertEquals(seg.getY(), 6.5);
45
assertFalse(seg.isRelative());
46
assertEquals(seg.getType(), PathSeg.CURVETO_QUADRATIC_SMOOTH_ABS);
51
public void testToString()
53
SVGPathSegMoveto m = new SVGPathSegMoveto(0, 0, false);
54
SVGPathParser parser = new SVGPathParser(m.toString() + " " + seg.toString(), this);
56
try { parser.parse(); }
57
catch(ParseException e) { fail(); }
62
public void onPathSeg(SVGPathSeg pathSeg)
64
if((pathSeg instanceof SVGPathSegMoveto) && cpt==0)
70
assertTrue(pathSeg instanceof SVGPathSegCurvetoQuadraticSmooth);
72
SVGPathSegCurvetoQuadraticSmooth seg2 = (SVGPathSegCurvetoQuadraticSmooth)pathSeg;
74
assertEquals(seg.getX(), seg2.getX());
75
assertEquals(seg.getY(), seg2.getY());
76
assertEquals(seg.isRelative(), seg2.isRelative());