Ejemplo n.º 1
0
        public virtual void DottedLineWithSetWidthAndGapTest01()
        {
            DottedLine dottedLine = new DottedLine(10, 15);

            NUnit.Framework.Assert.AreEqual(ColorConstants.BLACK, dottedLine.GetColor());
            NUnit.Framework.Assert.AreEqual(10, dottedLine.GetLineWidth(), 0.0001);
            NUnit.Framework.Assert.AreEqual(15, dottedLine.GetGap(), 0.0001);
        }
Ejemplo n.º 2
0
        public virtual void DefaultDottedLineTest01()
        {
            DottedLine dottedLine = new DottedLine();

            NUnit.Framework.Assert.AreEqual(ColorConstants.BLACK, dottedLine.GetColor());
            NUnit.Framework.Assert.AreEqual(1, dottedLine.GetLineWidth(), 0.0001);
            NUnit.Framework.Assert.AreEqual(4, dottedLine.GetGap(), 0.0001);
        }
Ejemplo n.º 3
0
        public virtual void DottedLineDrawTest01()
        {
            String expectedContent = "q\n" + "15 w\n" + "0 0 0 RG\n" + "[0 5] 2.5 d\n" + "1 J\n" + "100 107.5 m\n" + "200 107.5 l\n"
                                     + "S\n" + "Q\n";
            PdfDocument tempDoc    = new PdfDocument(new PdfWriter(new MemoryStream()));
            PdfCanvas   canvas     = new PdfCanvas(tempDoc.AddNewPage());
            DottedLine  dottedLine = new DottedLine(15, 5);

            dottedLine.Draw(canvas, new Rectangle(100, 100, 100, 100));
            byte[] writtenContentBytes = canvas.GetContentStream().GetBytes();
            NUnit.Framework.Assert.AreEqual(expectedContent.GetBytes(), writtenContentBytes);
        }
Ejemplo n.º 4
0
        public virtual void DottedLineSettersTest01()
        {
            DottedLine dottedLine = new DottedLine(15);

            NUnit.Framework.Assert.AreEqual(ColorConstants.BLACK, dottedLine.GetColor());
            NUnit.Framework.Assert.AreEqual(15, dottedLine.GetLineWidth(), 0.0001);
            NUnit.Framework.Assert.AreEqual(4, dottedLine.GetGap(), 0.0001);
            dottedLine.SetColor(ColorConstants.RED);
            NUnit.Framework.Assert.AreEqual(ColorConstants.RED, dottedLine.GetColor());
            dottedLine.SetLineWidth(10);
            NUnit.Framework.Assert.AreEqual(10, dottedLine.GetLineWidth(), 0.0001);
            dottedLine.SetGap(5);
            NUnit.Framework.Assert.AreEqual(5, dottedLine.GetGap(), 0.0001);
        }