public virtual void TestEoAppliedGroupClipPathRenderer() { AbstractBranchSvgNodeRenderer clipPathRenderer = new ClipPathSvgNodeRenderer(); clipPathRenderer.SetAttribute(SvgConstants.Attributes.ID, "randomString"); ISvgNodeRenderer clippedRenderer = new RectangleSvgNodeRenderer(); clippedRenderer.SetAttribute(SvgConstants.Attributes.WIDTH, "80"); clippedRenderer.SetAttribute(SvgConstants.Attributes.HEIGHT, "80"); clippedRenderer.SetAttribute(SvgConstants.Attributes.CLIP_RULE, SvgConstants.Values.FILL_RULE_EVEN_ODD); ISvgNodeRenderer clippedRenderer2 = new RectangleSvgNodeRenderer(); clippedRenderer2.SetAttribute(SvgConstants.Attributes.WIDTH, "80"); clippedRenderer2.SetAttribute(SvgConstants.Attributes.HEIGHT, "80"); clipPathRenderer.AddChild(clippedRenderer); clipPathRenderer.AddChild(clippedRenderer2); sdc.AddNamedObject("randomString", clipPathRenderer); AbstractBranchSvgNodeRenderer groupRenderer = new GroupSvgNodeRenderer(); groupRenderer.SetAttributesAndStyles(new Dictionary <String, String>()); ISvgNodeRenderer drawnRenderer = new CircleSvgNodeRenderer(); drawnRenderer.SetAttribute(SvgConstants.Attributes.R, "84"); drawnRenderer.SetAttribute(SvgConstants.Attributes.CLIP_PATH, "url(#randomString)"); groupRenderer.AddChild(drawnRenderer); groupRenderer.Draw(sdc); String expected = "0 0 0 rg\n" + "q\n" + "q\n" + "% rect\n" + "0 0 60 60 re\n" + "W*\n" + "n\n" + "% ellipse\n" + "63 0 m\n" + "63 34.79 34.79 63 0 63 c\n" + "-34.79 63 -63 34.79 -63 0 c\n" + "-63 -34.79 -34.79 -63 0 -63 c\n" + "34.79 -63 63 -34.79 63 0 c\n" + "f\n" + "Q\n" + "q\n" + "% rect\n" + "0 0 60 60 re\n" + "W\n" + "n\n" + "% ellipse\n" + "63 0 m\n" + "63 34.79 34.79 63 0 63 c\n" + "-34.79 63 -63 34.79 -63 0 c\n" + "-63 -34.79 -34.79 -63 0 -63 c\n" + "34.79 -63 63 -34.79 63 0 c\n" + "f\n" + "Q\n" + "Q\n"; NUnit.Framework.Assert.AreEqual(expected, iText.IO.Util.JavaUtil.GetStringForBytes(cv.GetContentStream().GetBytes ())); }
public override ISvgNodeRenderer CreateDeepCopy() { GroupSvgNodeRenderer copy = new GroupSvgNodeRenderer(); DeepCopyAttributesAndStyles(copy); DeepCopyChildren(copy); return(copy); }
public virtual void DeepCopyTest() { GroupSvgNodeRenderer expected = new GroupSvgNodeRenderer(); expected.SetAttribute(SvgConstants.Attributes.FILL, "blue"); expected.AddChild(new CircleSvgNodeRenderer()); ISvgNodeRenderer actual = expected.CreateDeepCopy(); NUnit.Framework.Assert.AreEqual(expected, actual); }