Search in sources :

Example 21 with SVGPathSegMoveto

use of net.sf.latexdraw.parsers.svg.path.SVGPathSegMoveto in project latexdraw by arnobl.

the class TestSVGPathSegLinetoVertical method testToString.

@Test
public void testToString() throws ParseException {
    SVGPathSegMoveto m = new SVGPathSegMoveto(0d, 0d, false);
    SVGPathParser parser = new SVGPathParser(m.toString() + " " + seg.toString(), pathSeg -> {
        if (pathSeg instanceof SVGPathSegMoveto && cpt == 0) {
            cpt++;
            return;
        }
        assertTrue(pathSeg instanceof SVGPathSegLinetoVertical);
        SVGPathSegLinetoVertical seg2 = (SVGPathSegLinetoVertical) pathSeg;
        assertEquals(seg.getY(), seg2.getY(), 0.0001);
        assertEquals(seg.isRelative(), seg2.isRelative());
    });
    parser.parse();
}
Also used : SVGPathParser(net.sf.latexdraw.parsers.svg.parsers.SVGPathParser) SVGPathSegMoveto(net.sf.latexdraw.parsers.svg.path.SVGPathSegMoveto) SVGPathSegLinetoVertical(net.sf.latexdraw.parsers.svg.path.SVGPathSegLinetoVertical) Test(org.junit.Test)

Example 22 with SVGPathSegMoveto

use of net.sf.latexdraw.parsers.svg.path.SVGPathSegMoveto in project latexdraw by arnobl.

the class TestSVGPathSegMoveto method testToString.

@Test
public void testToString() throws ParseException {
    SVGPathParser parser = new SVGPathParser(seg.toString(), pathSeg -> {
        assertTrue(pathSeg instanceof SVGPathSegMoveto);
        SVGPathSegMoveto seg2 = (SVGPathSegMoveto) pathSeg;
        assertEquals(seg.getX(), seg2.getX(), 0.0001);
        assertEquals(seg.getY(), seg2.getY(), 0.0001);
        assertEquals(seg.isRelative(), seg2.isRelative());
    });
    parser.parse();
}
Also used : SVGPathParser(net.sf.latexdraw.parsers.svg.parsers.SVGPathParser) SVGPathSegMoveto(net.sf.latexdraw.parsers.svg.path.SVGPathSegMoveto) Test(org.junit.Test)

Aggregations

SVGPathSegMoveto (net.sf.latexdraw.parsers.svg.path.SVGPathSegMoveto)22 SVGPathParser (net.sf.latexdraw.parsers.svg.parsers.SVGPathParser)9 Test (org.junit.Test)9 SVGPathSegLineto (net.sf.latexdraw.parsers.svg.path.SVGPathSegLineto)7 SVGPathSegList (net.sf.latexdraw.parsers.svg.path.SVGPathSegList)7 IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)6 SVGPathSegClosePath (net.sf.latexdraw.parsers.svg.path.SVGPathSegClosePath)5 SVGPathSegCurvetoCubic (net.sf.latexdraw.parsers.svg.path.SVGPathSegCurvetoCubic)4 SVGPathSegArc (net.sf.latexdraw.parsers.svg.path.SVGPathSegArc)3 SVGPathElement (net.sf.latexdraw.parsers.svg.SVGPathElement)2 SVGPathSegCurvetoCubicSmooth (net.sf.latexdraw.parsers.svg.path.SVGPathSegCurvetoCubicSmooth)2 Point2D (java.awt.geom.Point2D)1 ArrayList (java.util.ArrayList)1 ArcStyle (net.sf.latexdraw.models.interfaces.shape.ArcStyle)1 IBezierCurve (net.sf.latexdraw.models.interfaces.shape.IBezierCurve)1 SVGDefsElement (net.sf.latexdraw.parsers.svg.SVGDefsElement)1 SVGElement (net.sf.latexdraw.parsers.svg.SVGElement)1 SVGGElement (net.sf.latexdraw.parsers.svg.SVGGElement)1 CtrlPointsSeg (net.sf.latexdraw.parsers.svg.path.CtrlPointsSeg)1 SVGPathSegCurvetoQuadratic (net.sf.latexdraw.parsers.svg.path.SVGPathSegCurvetoQuadratic)1