PolylineSvgNodeRenderer extends AbstractSvgNodeRenderer implements IMarkerCapable { protected List<Point> getPoints() { return this.points; }  @Override ISvgNodeRenderer createDeepCopy(); @Override void drawMarker(SvgDrawContext context, final MarkerVertexType markerVertexType); @Override double getAutoOrientAngle(MarkerSvgNodeRenderer marker, boolean reverse);  }
@Test public void polyLineEmptyPointsListTest() throws IOException, InterruptedException { String filename = "polyLineEmptyPointsListTest.pdf"; PdfDocument doc = new PdfDocument(new PdfWriter(destinationFolder + filename)); doc.addNewPage(); ISvgNodeRenderer root = new PolylineSvgNodeRenderer(); Map<String, String> polyLineAttributes = new HashMap<>(); root.setAttributesAndStyles(polyLineAttributes); SvgDrawContext context = new SvgDrawContext(null, null); PdfCanvas cv = new PdfCanvas(doc, 1); context.pushCanvas(cv); root.draw(context); doc.close(); int numPoints = ((PolylineSvgNodeRenderer) root).getPoints().size(); Assert.assertEquals(numPoints, 0); Assert.assertNull(new CompareTool().compareVisually(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder, "diff_")); }
@Test public void polyPointCheckerTest() { PdfDocument doc = new PdfDocument(new PdfWriter(new ByteArrayOutputStream())); doc.addNewPage(); ISvgNodeRenderer root = new PolylineSvgNodeRenderer(); Map<String, String> polyLineAttributes = new HashMap<>(); polyLineAttributes.put(SvgConstants.Attributes.POINTS, "0,0 100,100 200,200 300,300"); root.setAttributesAndStyles(polyLineAttributes); SvgDrawContext context = new SvgDrawContext(null, null); PdfCanvas cv = new PdfCanvas(doc, 1); context.pushCanvas(cv); root.draw(context); List<Point> expectedPoints = new ArrayList<>(); expectedPoints.add(new Point(0, 0)); expectedPoints.add(new Point(75, 75)); expectedPoints.add(new Point(150, 150)); expectedPoints.add(new Point(225, 225)); List<Point> attributePoints = ((PolylineSvgNodeRenderer) root).getPoints(); Assert.assertEquals(expectedPoints.size(), attributePoints.size()); for (int x = 0; x < attributePoints.size(); x++) { Assert.assertEquals(expectedPoints.get(x), attributePoints.get(x)); } }