Example #1
0
        public void SymbolOfUpperHalfCircleIntegrationTest()
        {
            Shape shape = new UpperHalfCircle(50, 64, 32);

            Symbol symbol1 = new Symbol("M18,64 A 32,32 0 0,1 82,64"); //absolute left to right
            Symbol symbol2 = new Symbol("M18,64 a 32,32 0 0,1 64,0");  //relative left to right
            Symbol symbol3 = new Symbol("M82,64 A 32,32 0 1,0 18,64"); //absolute right to left
            Symbol symbol4 = new Symbol("M82,64 a 32,32 0 1,0 -64,0"); //relative right to left
            Assert.True(symbol1.Contains(shape));
            Assert.True(symbol2.Contains(shape));
            Assert.True(symbol3.Contains(shape));
            Assert.True(symbol4.Contains(shape));
        }
Example #2
0
        public void ConstructorShouldSetCorrectValues()
        {
            int cx = 84;
            int cy = 64;
            int radius = 32;

            HalfCircle sut = new UpperHalfCircle(cx, cy, radius);

            Assert.Equal(cx, sut.CX);     //x of half circle's center is not correct");
            Assert.Equal(cy, sut.CY);     //y of half circle's center is not correct");
            Assert.Equal(radius, sut.Radius); //radius of half circle is not correct");
            Assert.Equal(cx - radius, sut.X);      //x of square of inscribed half circle is not correct");
            Assert.Equal(radius, sut.Y);      //y of square of inscribed half circle is not correct");
            Assert.Equal(radius * 2, sut.Width);  //width of square of inscribed half circle is not correct");
            Assert.Equal(radius, sut.Height); //height of square of inscribed half circle is not correct");
        }
Example #3
0
        public void ShouldBeCorrectShapeType()
        {
            UpperHalfCircle sut = new UpperHalfCircle(0, 0, 0);

            Assert.Equal(ShapeType.UpperHalfCircle, sut.ShapeType);
        }
Example #4
0
 protected Shape CreateShape(PathCommand c)
 {
     Shape shape = null;
     if (c.IsMoveToCommand())
     {
         //
     }
     else if (c.IsArcCommand())
     {
         if (c.IsCircular())
         {
             if (c.IsHorizontal())
             {
                 if (c.IsLower())
                 {
                     shape = new LowerHalfCircle((int)c.CenterX, (int)c.CenterY, (int)c.RadiusX);
                 }
                 else if (c.IsUpper())
                 {
                     shape = new UpperHalfCircle((int)c.CenterX, (int)c.CenterY, (int)c.RadiusX);
                 }
             }
             else
             if (c.IsVertical())
             {
                 if (c.IsLeft())
                 {
                     shape = new LeftHalfCircle((int)c.CenterX, (int)c.CenterY, (int)c.RadiusY);
                 }
                 else if (c.IsRight())
                 {
                     shape = new RightHalfCircle((int)c.CenterX, (int)c.CenterY, (int)c.RadiusY);
                 }
             }
         }
     }
     return shape;
 }