Пример #1
0
        public void TestClear()
        {
            EllipseCanvas canvas       = new EllipseCanvas();
            int           ellipseCount = 10;

            for (int i = 0; i < ellipseCount; ++i)
            {
                canvas.AddEllipse(CreateEllipse(new Point(100 * i, 50 * i), 20 * i, 30 * i, "item"));
            }

            canvas.Clear();
            Assert.IsTrue(canvas.IsEmpty());
        }
Пример #2
0
        public void TestAddEllipseMultiple()
        {
            EllipseCanvas canvas       = new EllipseCanvas();
            int           ellipseCount = 10;
            EllipseInfo   newbee;

            for (int i = 0; i < ellipseCount; ++i)
            {
                newbee = CreateEllipse(new Point(100 * i, 50 * i), 20 * i, 30 * i, "item");
                canvas.AddEllipse(newbee);
                Assert.IsTrue(canvas.Ellipses.Contains(newbee));
            }

            Assert.AreEqual(ellipseCount, canvas.Ellipses.Count);
        }
Пример #3
0
        public void TestAddEllipse()
        {
            EllipseCanvas canvas  = new EllipseCanvas();
            Point         pos     = new Point(20, 20);
            double        height  = 10;
            double        width   = 40;
            string        name    = "name";
            EllipseInfo   ellipse = CreateEllipse(pos, width, height, name);

            canvas.AddEllipse(ellipse);
            EllipseInfo addedEllipse = canvas.Ellipses[0];

            Assert.AreEqual(ellipse.Name, addedEllipse.Name);
            Assert.AreEqual(ellipse.Height, addedEllipse.Height);
            Assert.AreEqual(ellipse.Width, addedEllipse.Width);
            Assert.AreEqual(ellipse.TopLeft, addedEllipse.TopLeft);
            Assert.AreEqual(1, canvas.Ellipses.Count);
        }
Пример #4
0
        public void TestRemoveEllipse()
        {
            EllipseCanvas canvas       = new EllipseCanvas();
            int           ellipseCount = 10;

            for (int i = 0; i < ellipseCount; ++i)
            {
                canvas.AddEllipse(CreateEllipse(new Point(100 * i, 50 * i), 20 * i, 30 * i, "item"));
            }

            Point       pos     = new Point(20, 20);
            double      height  = 10;
            double      width   = 40;
            string      name    = "name";
            EllipseInfo ellipse = CreateEllipse(pos, width, height, name);

            canvas.AddEllipse(ellipse);
            canvas.RemoveEllipse(ellipse);

            Assert.AreEqual(ellipseCount, canvas.Ellipses.Count);
            Assert.IsFalse(canvas.Ellipses.Contains(ellipse));
        }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EllipseListChangedEventArgs"/> class
 /// </summary>
 /// <param name="ellipse">Shape ellipse</param>
 /// <param name="canvas">Canvas drawing area</param>
 public EllipseListChangedEventArgs(EllipseInfo ellipse, EllipseCanvas canvas)
 {
     this.Ellipse = ellipse;
     this.Canvas  = canvas;
 }