public virtual void TestAddMultipleOddArgsOperator()
        {
            PathSvgNodeRenderer path = new PathSvgNodeRenderer();
            String instructions      = "L 500 500 200 200 300";

            path.SetAttribute(SvgConstants.Attributes.D, instructions);
            NUnit.Framework.Assert.AreEqual(2, path.GetShapes().Count);
        }
        public virtual void TestMoveOddArgsOperator()
        {
            PathSvgNodeRenderer path = new PathSvgNodeRenderer();
            String instructions      = "M 500";

            path.SetAttribute(SvgConstants.Attributes.D, instructions);
            NUnit.Framework.Assert.IsTrue(path.GetShapes().IsEmpty());
        }
        public virtual void TestAddDoubleArgsOperator()
        {
            PathSvgNodeRenderer path = new PathSvgNodeRenderer();
            String instructions      = "M 500 500 S 200 100 100 200 300 300 400 400";

            path.SetAttribute(SvgConstants.Attributes.D, instructions);
            NUnit.Framework.Assert.AreEqual(3, path.GetShapes().Count);
            NUnit.Framework.Assert.IsTrue(((IList <IPathShape>)path.GetShapes())[2] is SmoothSCurveTo);
        }
        public virtual void TestAddMultipleOddArgsOperatorThenOtherStuff()
        {
            PathSvgNodeRenderer path = new PathSvgNodeRenderer();
            String instructions      = "M 500 500 200 200 300 z";

            path.SetAttribute(SvgConstants.Attributes.D, instructions);
            NUnit.Framework.Assert.AreEqual(3, path.GetShapes().Count);
            NUnit.Framework.Assert.IsTrue(((IList <IPathShape>)path.GetShapes())[2] is ClosePath);
        }
コード例 #5
0
        public virtual void PathParsingOperatorOnlySpacesTest()
        {
            PathSvgNodeRenderer path = new PathSvgNodeRenderer();

            path.SetAttribute(SvgConstants.Attributes.D, "  ");
            ICollection <String> ops = path.ParsePathOperations();

            NUnit.Framework.Assert.IsTrue(ops.IsEmpty());
        }
コード例 #6
0
        public virtual void PathParsingBadOperatorArgsNoExceptionTest()
        {
            PathSvgNodeRenderer path = new PathSvgNodeRenderer();

            path.SetAttribute(SvgConstants.Attributes.D, "m 200 l m");
            ICollection <String> ops = path.ParsePathOperations();

            NUnit.Framework.Assert.AreEqual(3, ops.Count);
        }
コード例 #7
0
        public virtual void PathParsingOperatorEndWithSpacesTest()
        {
            PathSvgNodeRenderer path = new PathSvgNodeRenderer();

            path.SetAttribute(SvgConstants.Attributes.D, "m 200 100 l 50 50  m 200 100 l 50 50  \t\n ");
            ICollection <String> ops = path.ParsePathOperations();

            NUnit.Framework.Assert.AreEqual(4, ops.Count);
        }
コード例 #8
0
        public virtual void DeepCopyTest()
        {
            PathSvgNodeRenderer expected = new PathSvgNodeRenderer();

            expected.SetAttribute(SvgConstants.Attributes.FILL, "blue");
            ISvgNodeRenderer actual = expected.CreateDeepCopy();

            NUnit.Framework.Assert.AreEqual(expected, actual);
        }
コード例 #9
0
 public virtual void PathParsingOperatorLaterBadOperatorTest()
 {
     NUnit.Framework.Assert.That(() => {
         PathSvgNodeRenderer path = new PathSvgNodeRenderer();
         path.SetAttribute(SvgConstants.Attributes.D, "m 200 100 l 50 50 x");
         path.ParsePathOperations();
     }
                                 , NUnit.Framework.Throws.InstanceOf <SvgProcessingException>())
     ;
 }
コード例 #10
0
        public virtual void PathParsingHandlesMinusTest()
        {
            PathSvgNodeRenderer path = new PathSvgNodeRenderer();

            path.SetAttribute(SvgConstants.Attributes.D, "m40-50");
            ICollection <String> ops = path.ParsePathOperations();

            NUnit.Framework.Assert.AreEqual(1, ops.Count);
            NUnit.Framework.Assert.IsTrue(ops.Contains("m 40 -50"));
        }
        public virtual void TestAbsoluteArcOperatorCoordinates()
        {
            PathSvgNodeRenderer path = new PathSvgNodeRenderer();
            String instructions      = "M 200,300 A 10 10 0 0 0 210 310";

            path.SetAttribute(SvgConstants.Attributes.D, instructions);
            IPathShape arc = ((IList <IPathShape>)path.GetShapes())[1];
            Point      end = arc.GetEndingPoint();

            NUnit.Framework.Assert.AreEqual(new Point(210, 310), end);
        }
 public virtual void TestClosePathNoPrecedingPathsOperator()
 {
     NUnit.Framework.Assert.That(() => {
         PathSvgNodeRenderer path = new PathSvgNodeRenderer();
         String instructions      = "z";
         path.SetAttribute(SvgConstants.Attributes.D, instructions);
         NUnit.Framework.Assert.IsTrue(path.GetShapes().IsEmpty());
     }
                                 , NUnit.Framework.Throws.InstanceOf <SvgProcessingException>())
     ;
 }
コード例 #13
0
 public virtual void PathParsingNoDOperatorTest()
 {
     NUnit.Framework.Assert.That(() => {
         // Path objects must have a d attribute
         PathSvgNodeRenderer path = new PathSvgNodeRenderer();
         path.SetAttribute(SvgConstants.Attributes.STROKE, "black");
         path.ParsePathOperations();
     }
                                 , NUnit.Framework.Throws.InstanceOf <SvgProcessingException>())
     ;
 }
 public virtual void SmoothCurveAsFirstShapeTest2()
 {
     NUnit.Framework.Assert.That(() => {
         String instructions      = "T 100,200";
         PathSvgNodeRenderer path = new PathSvgNodeRenderer();
         path.SetAttribute(SvgConstants.Attributes.D, instructions);
         path.GetShapes();
     }
                                 , NUnit.Framework.Throws.InstanceOf <SvgProcessingException>().With.Message.EqualTo(SvgExceptionMessageConstant.INVALID_SMOOTH_CURVE_USE))
     ;
 }
        public virtual void TestRelativeArcOperatorShapes()
        {
            PathSvgNodeRenderer path = new PathSvgNodeRenderer();
            String instructions      = "M 200,300 a 10 10 0 0 0 10 10";

            path.SetAttribute(SvgConstants.Attributes.D, instructions);
            IList <IPathShape> segments = (IList <IPathShape>)path.GetShapes();

            NUnit.Framework.Assert.AreEqual(2, segments.Count);
            NUnit.Framework.Assert.IsTrue(segments[0] is MoveTo);
            NUnit.Framework.Assert.IsTrue(segments[1] is EllipticalCurveTo);
        }
コード例 #16
0
        public virtual void PathParsingLoseCommasTest()
        {
            PathSvgNodeRenderer path = new PathSvgNodeRenderer();

            path.SetAttribute(SvgConstants.Attributes.D, "m200,100L50,50L200,100");
            ICollection <String> ops = path.ParsePathOperations();

            foreach (String op in ops)
            {
                NUnit.Framework.Assert.IsFalse(op.Contains(","));
            }
        }