示例#1
0
        public void EqualsVectorDrawingTest5()
        {
            VectorDrawing target = new VectorDrawing()
            {
                Vectors = new ColoredTriangle[] { new ColoredTriangle()
                                                  {
                                                      Brush = Brushes.Black, Vertices = new Point[] { new Point(0, 0), new Point(1, 1), new Point(0, 1) }
                                                  } }
            };
            VectorDrawing other = new VectorDrawing()
            {
                Vectors = new ColoredTriangle[] { new ColoredTriangle()
                                                  {
                                                      Brush = Brushes.Black, Vertices = new Point[] { new Point(0, 0), new Point(1, 1), new Point(0, 1) }
                                                  }, new ColoredTriangle()
                                                  {
                                                      Brush = Brushes.Black, Vertices = new Point[] { new Point(0, 0), new Point(1, 1), new Point(0, 1) }
                                                  }, new ColoredTriangle()
                                                  {
                                                      Brush = Brushes.Black, Vertices = new Point[] { new Point(0, 0), new Point(1, 1), new Point(0, 1) }
                                                  } }
            };
            bool expected = false;
            bool actual;

            actual = target.Equals(other);
            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void DistanceTest2()
        {
            var color         = Color.Orange;
            var vectorDrawing = new VectorDrawing()
            {
                Vectors = new ColoredTriangle[]
                {
                    new ColoredTriangle()
                    {
                        Brush    = new SolidBrush(color),
                        Vertices = new Point[]
                        {
                            new Point(-1, -1),
                            new Point(2, -1),
                            new Point(-1, 2)
                        }
                    }
                }
            };

            using (var bitmap = new Bitmap(1, 1))
            {
                VectorDrawingGenetics target = VectorDrawingGenetics.Instance;
                long expected = color.R + color.G + color.B;
                var  actual   = target.CalculateFitness(vectorDrawing, bitmap);
                Assert.AreEqual(expected, actual);
            }
        }
示例#3
0
        public void DistanceTest3()
        {
            var vectorDrawing = new VectorDrawing()
            {
                Vectors = new ColoredTriangle[]
                {
                    new ColoredTriangle()
                    {
                        Brush    = Brushes.Black,
                        Vertices = new Point[]
                        {
                            new Point(-1, -1),
                            new Point(2, -1),
                            new Point(-1, 2)
                        }
                    }
                }
            };

            using (var bitmap = new Bitmap(1, 1))
            {
                using (var graphics = Graphics.FromImage(bitmap))
                {
                    GraphicsExtensions.RasterizeVectorDrawing(graphics, vectorDrawing);
                }
                VectorDrawingGenetics target = VectorDrawingGenetics.Instance;
                long expected = 0;
                var  actual   = target.CalculateFitness(vectorDrawing, bitmap);
                Assert.AreEqual(expected, actual);
            }
        }
示例#4
0
        public void GetHashCodeTest()
        {
            VectorDrawing target   = new VectorDrawing();
            int           expected = 0;
            int           actual;

            actual = target.GetHashCode();
            Assert.AreEqual(expected, actual);
        }
示例#5
0
        public void DistanceTest1()
        {
            VectorDrawingGenetics target        = VectorDrawingGenetics.Instance;
            VectorDrawing         vectorDrawing = null;
            long expected = 0;
            var  actual   = target.CalculateFitness(vectorDrawing, null);

            Assert.AreEqual(expected, actual);
        }
示例#6
0
        public void EqualsTest()
        {
            VectorDrawing target   = new VectorDrawing();
            object        obj      = null;
            bool          expected = false;
            bool          actual;

            actual = target.Equals(obj);
            Assert.AreEqual(expected, actual);
        }
示例#7
0
        public void VectorsTest()
        {
            VectorDrawing target = new VectorDrawing();

            ColoredTriangle[] expected = null;
            target.Vectors = expected;
            var actual = target.Vectors;

            Assert.AreEqual(expected, actual);
        }
示例#8
0
 public void VectorDrawingConstructorTest()
 {
     VectorDrawing target = new VectorDrawing();
 }