Пример #1
0
        public virtual void CalculateOutermostTransformation()
        {
            AffineTransform expected = new AffineTransform(1d, 0d, 0d, -1d, 0d, 600d);
            SvgDrawContext  context  = new SvgDrawContext(null, null);
            PdfDocument     document = new PdfDocument(new PdfWriter(new MemoryStream(), new WriterProperties().SetCompressionLevel
                                                                         (0)));

            document.AddNewPage();
            PdfFormXObject pdfForm = new PdfFormXObject(new Rectangle(0, 0, 600, 600));
            PdfCanvas      canvas  = new PdfCanvas(pdfForm, document);

            context.PushCanvas(canvas);
            SvgTagSvgNodeRenderer  renderer = new SvgTagSvgNodeRenderer();
            PdfRootSvgNodeRenderer root     = new PdfRootSvgNodeRenderer(renderer);

            context.AddViewPort(root.CalculateViewPort(context));
            AffineTransform actual = root.CalculateTransformation(context);

            NUnit.Framework.Assert.AreEqual(expected, actual);
        }