예제 #1
0
        public void OverlayGrid_GetPenTest()
        {
            OverlayGridStyle target   = new OverlayGridStyle();
            PDFSolidPen      expected = null;

            PDFSolidPen actual;

            actual = (PDFSolidPen)target.GetPen();
            Assert.IsNull(actual);

            target.ShowGrid  = true;
            expected         = new PDFSolidPen(OverlayGridStyle.DefaultGridColor, OverlayGridStyle.DefaultGridPenWidth);
            expected.Opacity = OverlayGridStyle.DefaultGridOpacity;
            actual           = (PDFSolidPen)target.GetPen();
            Assert.IsNotNull(actual);

            Assert.AreEqual(expected.Color, actual.Color);
            Assert.AreEqual(expected.Width, actual.Width);
            Assert.AreEqual(expected.Opacity, actual.Opacity);

            target.GridColor   = PDFColors.Purple;
            target.GridOpacity = 0.3;

            expected         = new PDFSolidPen(PDFColors.Purple, OverlayGridStyle.DefaultGridPenWidth);
            expected.Opacity = 0.3;

            actual = (PDFSolidPen)target.GetPen();
            Assert.AreEqual(expected.Color, actual.Color);
            Assert.AreEqual(expected.Width, actual.Width);
            Assert.AreEqual(expected.Opacity, actual.Opacity);
        }
예제 #2
0
 private void AssertPensAreEqual(PDFPen expected, PDFPen actual)
 {
     Assert.IsNotNull(expected);
     Assert.IsNotNull(actual);
     if (expected is PDFNoPen)
     {
         Assert.IsInstanceOfType(actual, typeof(PDFNoPen));
     }
     else
     {
         if (expected is PDFDashPen)
         {
             Assert.IsInstanceOfType(actual, typeof(PDFSolidPen));
             PDFDashPen expdash = (PDFDashPen)expected;
             PDFDashPen actdash = (PDFDashPen)actual;
             Assert.AreEqual(expdash.Dash, actdash.Dash);
         }
         if (expected is PDFSolidPen)
         {
             Assert.IsInstanceOfType(actual, typeof(PDFSolidPen));
             PDFSolidPen expSolid = (PDFSolidPen)expected;
             PDFSolidPen actSolid = (PDFSolidPen)actual;
             Assert.AreEqual(expSolid.Color, actSolid.Color);
         }
         Assert.AreEqual(expected.LineStyle, actual.LineStyle);
         Assert.AreEqual(expected.Width, actual.Width);
         Assert.AreEqual(expected.MitreLimit, actual.MitreLimit);
         Assert.AreEqual(expected.LineCaps, actual.LineCaps);
         Assert.AreEqual(expected.LineJoin, actual.LineJoin);
         Assert.AreEqual(expected.Opacity, actual.Opacity);
     }
 }
        public void PDFSolidPenConstructor_Test1()
        {
            PDFSolidPen target = new PDFSolidPen();

            Assert.IsNotNull(target);
            Assert.IsNull(target.Color);
            Assert.AreEqual(target.Width, PDFUnit.Zero);
        }
        public void Color_Test()
        {
            PDFSolidPen target   = new PDFSolidPen(); // TODO: Initialize to an appropriate value
            PDFColor    expected = PDFColors.Aqua;
            PDFColor    actual;

            target.Color = expected;
            actual       = target.Color;
            Assert.AreEqual(expected, actual);
        }
        public void PDFSolidPenConstructor_Test()
        {
            PDFColor    color  = PDFColors.Aqua; // TODO: Initialize to an appropriate value
            PDFUnit     width  = 1;
            PDFSolidPen target = new PDFSolidPen(color, width);

            Assert.IsNotNull(target);
            Assert.AreEqual(color, target.Color);
            Assert.AreEqual(width, target.Width);
        }
        public void LineStyle_Test()
        {
            PDFSolidPen target   = new PDFSolidPen(); // TODO: Initialize to an appropriate value
            LineType    expected = LineType.Solid;
            LineType    actual;

            actual = target.LineStyle;

            Assert.AreEqual(expected, actual);
        }
예제 #7
0
        public void Create_Test()
        {
            PDFColor    color    = PDFColors.Aqua;
            PDFUnit     width    = 1;
            PDFSolidPen expected = new PDFSolidPen();

            expected.Color = color;
            expected.Width = width;

            PDFPen actual;

            actual = PDFPen.Create(color, width);
            Assert.IsInstanceOfType(actual, typeof(PDFSolidPen));
            PDFSolidPen solid = (PDFSolidPen)actual;

            Assert.AreEqual(expected.Width, solid.Width);
            Assert.AreEqual(expected.Color, solid.Color);
        }
예제 #8
0
        public void Stroke_CreatePenTest()
        {
            StrokeStyle target = new StrokeStyle();

            //No values

            PDFPen expected = null;
            PDFPen actual   = target.CreatePen();

            Assert.IsNull(actual);

            //Zero width

            target.Width = PDFUnit.Empty;
            actual       = target.CreatePen();
            Assert.IsNull(actual);

            //Solid pen

            expected     = new PDFSolidPen(PDFColors.Purple, 10);
            target.Color = PDFColors.Purple;
            target.Width = 10;
            actual       = target.CreatePen();
            AssertPensAreEqual(expected, actual);

            //Mitres

            target.Mitre        = 20;
            expected.MitreLimit = 20;
            actual = target.CreatePen();
            AssertPensAreEqual(expected, actual);

            //Line Caps

            target.LineCap    = LineCaps.Projecting;
            expected.LineCaps = LineCaps.Projecting;
            actual            = target.CreatePen();
            AssertPensAreEqual(expected, actual);

            //Line Join

            target.LineJoin   = LineJoin.Bevel;
            expected.LineJoin = LineJoin.Bevel;
            actual            = target.CreatePen();
            AssertPensAreEqual(expected, actual);

            // Opacity

            target.Opacity   = 0.4;
            expected.Opacity = 0.4;
            actual           = target.CreatePen();
            AssertPensAreEqual(expected, actual);

            // Dash

            PDFDash dash = new PDFDash(new int[] { 4, 5, 6 }, 10);

            expected = new PDFDashPen(dash);
            ((PDFSolidPen)expected).Color = PDFColors.Lime;
            expected.Width = 8;

            target       = new StrokeStyle();
            target.Dash  = dash;
            target.Width = 8;
            target.Color = PDFColors.Lime;
            actual       = target.CreatePen();
            AssertPensAreEqual(expected, actual);
        }