use of net.sf.latexdraw.parsers.svg.path.SVGPathSegLinetoVertical in project latexdraw by arnobl.
the class SVGPathParser method parseVerticalLineto.
/**
* Parses an SVGPath vertical lineto.
* @param isRelative True if segment is relative.
* @throws ParseException If a problem occurs.
*/
protected void parseVerticalLineto(final boolean isRelative) throws ParseException {
nextChar();
skipWSP();
do {
final double v = parseNumber(false);
skipWSPComma();
handler.onPathSeg(new SVGPathSegLinetoVertical(v, isRelative));
} while (!isEOC() && isNumber(false));
}
use of net.sf.latexdraw.parsers.svg.path.SVGPathSegLinetoVertical in project latexdraw by arnobl.
the class TestSVGPathSegLinetoVertical method setUp.
@Before
public void setUp() {
seg = new SVGPathSegLinetoVertical(-1d, false);
cpt = 0;
}
use of net.sf.latexdraw.parsers.svg.path.SVGPathSegLinetoVertical 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();
}
Aggregations