Example #1
0
        public void TestEqualOperator()
        {
            var s1 = new QPointF(3, 7);
            var s2 = new QPointF(3, 7);

            Assert.AreEqual(s1, s2);
        }
Example #2
0
        public void TestEmptyConstructor()
        {
            var s = new QPointF();

            Assert.AreEqual(0, s.X);
            Assert.AreEqual(0, s.Y);
        }
Example #3
0
        public void TestIntegerConstructor()
        {
            var s = new QPointF(5, 10);

            Assert.AreEqual(5, s.X);
            Assert.AreEqual(10, s.Y);
        }
Example #4
0
        public void TestManhattanLength()
        {
            var s1  = new QPointF(3, 7);
            var res = s1.ManhattanLength;

            Assert.AreEqual(10, res);
        }
 public void BeginMove(QPointF pos)
 {
     m_MoveAnimationTimeLine.Stop();
     m_MoveAnimation.SetPosAt(0, base.Pos());
     m_MoveAnimation.SetPosAt(1, pos);
     m_MoveAnimationTimeLine.Start();
 }
Example #6
0
        public unsafe void TestRy()
        {
            var s1 = new QPointF(3, 7);

            double *res = s1.Ry;

            Assert.AreEqual(7, *res);
        }
Example #7
0
        public void TestDotProduct()
        {
            var s1  = new QPointF(3, 7);
            var s2  = new QPointF(-1, 4);
            var dot = QPointF.DotProduct(s1, s2);

            Assert.AreEqual(25, dot);
        }
Example #8
0
        public void TestX()
        {
            var s1 = new QPointF(3, 7);

            var res = s1.X;

            Assert.AreEqual(3, res);
        }
Example #9
0
        public void TestY()
        {
            var s1 = new QPointF(3, 7);

            var res = s1.Y;

            Assert.AreEqual(7, res);
        }
Example #10
0
        public void TestDotProduct()
        {
            var s1 = new QPointF(3, 7);
            var s2 = new QPointF(-1, 4);
            var dot = QPointF.DotProduct(s1, s2);

            Assert.AreEqual(25, dot);
        }
Example #11
0
        public void TestDivOperator()
        {
            var s1 = new QPointF(3, 7);

            var res = s1 / 1.0;

            Assert.AreEqual(3, res.X);
            Assert.AreEqual(7, res.Y);
        }
Example #12
0
        public void TestSubQPointFOperator()
        {
            var s1 = new QPointF(3, 7);

            var res = -s1;

            Assert.AreEqual(-3, res.X);
            Assert.AreEqual(-7, res.Y);
        }
Example #13
0
        public void TestAddQPointFOperator()
        {
            var s1 = new QPointF(3, 7);

            var res = +s1;

            Assert.AreEqual(3, res.X);
            Assert.AreEqual(7, res.Y);
        }
Example #14
0
        public void TestMultIntRevOperator()
        {
            var s1 = new QPointF(3, 7);

            var res = 5 * s1;

            Assert.AreEqual(15, res.X);
            Assert.AreEqual(35, res.Y);
        }
Example #15
0
        public void TestMultDoubleOperator()
        {
            var s1 = new QPointF(3, 7);

            var res = s1 * 5.0;

            Assert.AreEqual(15, res.X);
            Assert.AreEqual(35, res.Y);
        }
Example #16
0
        public void TestDivEqualOperator()
        {
            var s1 = new QPointF(-3, 10);

            s1 /= 2.5;

            Assert.AreEqual(-1.2, s1.X);
            Assert.AreEqual(4, s1.Y);
        }
Example #17
0
        public void TestMultiEqualDoubleOperator()
        {
            var s1 = new QPointF(3, 7);

            s1 *= 5.0;

            Assert.AreEqual(15, s1.X);
            Assert.AreEqual(35, s1.Y);
        }
Example #18
0
        public void TestDivOperator()
        {
            var s1 = new QPointF(3, 7);

            var res = s1 / 1.0;

            Assert.AreEqual(3, res.X);
            Assert.AreEqual(7, res.Y);
        }
Example #19
0
        public void TestAddQPointFOperator()
        {
            var s1 = new QPointF(3, 7);

            var res = +s1;

            Assert.AreEqual(3, res.X);
            Assert.AreEqual(7, res.Y);
        }
Example #20
0
        public void TestDivEqualOperator()
        {
            var s1 = new QPointF(-3, 10);

            s1 /= 2.5;

            Assert.AreEqual(-1.2, s1.X);
            Assert.AreEqual(4, s1.Y);
        }
Example #21
0
        void DrawShapes(QPainter painter)
        {
            painter.SetRenderHint(QPainter.RenderHint.Antialiasing);
            painter.Pen   = new QPen(new QBrush(new QColor("Gray")), 1);
            painter.Brush = new QColor("Gray");

            var path = new QPainterPath();

            path.MoveTo(5, 5);
            path.CubicTo(40, 5, 50, 50, 99, 99);
            path.CubicTo(5, 99, 50, 50, 5, 5);
            painter.DrawPath(path);

            painter.DrawPie(130, 20, 90, 60, 30 * 16, 120 * 16);
            painter.DrawChord(240, 30, 90, 60, 0, 16 * 180);
            var rectangle = new QRect(new QPoint(20, 120), new QSize(80, 50));

            painter.DrawRoundedRect(rect: rectangle, xRadius: 10, yRadius: 10);

            // to be implemented
            //var points = new List<QPoint>();
            //points.Add ( new QPoint ( 130, 140 ) );
            //points.Add ( new QPoint ( 180, 170 ) );
            //points.Add ( new QPoint ( 180, 140 ) );
            //points.Add ( new QPoint ( 220, 110 ) );
            //points.Add ( new QPoint ( 140, 100 ) );

            //// http://doc.qt.io/qt-5/qpolygon.html#QPolygon-2 , we should be able to pase point list
            //var polygon = new QPolygon(points);
            //painter.DrawPolygon ( polygon );

            // this is workaround for DrawPolygon
            unsafe
            {
                var polygon = new QPolygon();
                var points  = new int[] { 130, 140, 180, 170, 180, 140, 220, 110, 140, 100 };
                fixed(int *point = points)
                {
                    polygon.SetPoints(points.Length / 2, ref *point);
                }

                painter.DrawPolygon(polygon);
            }

            painter.DrawRect(250, 110, 60, 60);

            var baseline  = new QPointF(20, 250);
            var font      = new QFont("Georgia", 55);
            var forntPath = new QPainterPath();

            forntPath.AddText(baseline, font, "Q");
            painter.DrawPath(forntPath);

            painter.DrawEllipse(140, 200, 60, 60);
            painter.DrawEllipse(240, 200, 90, 60);
        }
Example #22
0
        public void TestAddEqualOperator()
        {
            var s1 = new QPointF(3, 7);
            var s2 = new QPointF(-1, 4);

            s1 += s2;

            Assert.AreEqual(2, s1.X);
            Assert.AreEqual(11, s1.Y);
        }
Example #23
0
        public void TestAddQPointFsOperator()
        {
            var s1 = new QPointF(3, 7);
            var s2 = new QPointF(-1, 4);

            var res = s1 + s2;

            Assert.AreEqual(2, res.X);
            Assert.AreEqual(11, res.Y);
        }
Example #24
0
        public void TestAddEqualOperator()
        {
            var s1 = new QPointF(3, 7);
            var s2 = new QPointF(-1, 4);

            s1 += s2;

            Assert.AreEqual(2, s1.X);
            Assert.AreEqual(11, s1.Y);
        }
Example #25
0
        public void TestAddQPointFsOperator()
        {
            var s1 = new QPointF(3, 7);
            var s2 = new QPointF(-1, 4);

            var res = s1 + s2;

            Assert.AreEqual(2, res.X);
            Assert.AreEqual(11, res.Y);
        }
Example #26
0
        public void TestSubQPointFsOperator()
        {
            var s1 = new QPointF(3, 7);
            var s2 = new QPointF(-1, 4);

            var res = s1 - s2;

            Assert.AreEqual(4, res.X);
            Assert.AreEqual(3, res.Y);
        }
Example #27
0
        public void TestSubEqualOperator()
        {
            var s1 = new QPointF(3, 7);
            var s2 = new QPointF(-1, 4);

            s1 -= s2;

            Assert.AreEqual(4, s1.X);
            Assert.AreEqual(3, s1.Y);
        }
Example #28
0
        public void TestPointSizeConstructor()
        {
            var p1 = new QPointF(50, 100);
            var p2 = new QSizeF(200, 150);

            var s = new QRectF(p1, p2);

            Assert.AreEqual(50, s.Left);
            Assert.AreEqual(100, s.Top);
            Assert.AreEqual(200, s.Width);
            Assert.AreEqual(150, s.Height);
        }
Example #29
0
        public void TestSetPoints()
        {
            var s  = new QLineF();
            var p1 = new QPointF(5.0, 5.0);
            var p2 = new QPointF(10.0, 10.0);

            s.SetPoints(p1, p2);

            Assert.AreEqual(5.0, s.P1.X);
            Assert.AreEqual(5.0, s.P1.Y);

            Assert.AreEqual(10.0, s.P2.X);
            Assert.AreEqual(10.0, s.P2.Y);
        }
Example #30
0
        public void TestContainsWithQPointF()
        {
            var s = new QRectF();

            s.X      = 50;
            s.Y      = 150;
            s.Width  = 500;
            s.Height = 600;

            var p = new QPointF(275, 375);
            var n = s.Contains(p);

            Assert.IsTrue(n);
        }
Example #31
0
        public void TestMultiEqualIntOperator()
        {
            var s1 = new QPointF(3, 7);

            s1 *= 5;

            Assert.AreEqual(15, s1.X);
            Assert.AreEqual(35, s1.Y);
        }
Example #32
0
        public void TestPointSizeConstructor()
        {
            var p1 = new QPointF(50, 100);
            var p2 = new QSizeF(200, 150);

            var s = new QRectF(p1, p2);

            Assert.AreEqual(50, s.Left);
            Assert.AreEqual(100, s.Top);
            Assert.AreEqual(200, s.Width);
            Assert.AreEqual(150, s.Height);
        }
Example #33
0
        public void TestContainsWithQPointF()
        {
            var s = new QRectF();
            s.X = 50;
            s.Y = 150;
            s.Width = 500;
            s.Height = 600;

            var p = new QPointF(275, 375);
            var n = s.Contains(p);

            Assert.IsTrue(n);
        }
Example #34
0
        public void TestIntegerConstructor()
        {
            var s = new QPointF(5, 10);

            Assert.AreEqual(5, s.X);
            Assert.AreEqual(10, s.Y);
        }
Example #35
0
        public void TestSetPoints()
        {
            using (var s = new QLineF())
            {
                var p1 = new QPointF(5.0, 5.0);
                var p2 = new QPointF(10.0, 10.0);
                s.SetPoints(p1, p2);

                Assert.AreEqual(5.0, s.P1.X);
                Assert.AreEqual(5.0, s.P1.Y);

                Assert.AreEqual(10.0, s.P2.X);
                Assert.AreEqual(10.0, s.P2.Y);
            }
        }
Example #36
0
        public void TestX()
        {
            var s1 = new QPointF(3, 7);

            var res = s1.X;

            Assert.AreEqual(3, res);
        }
Example #37
0
        public void TestY()
        {
            var s1 = new QPointF(3, 7);

            var res = s1.Y;

            Assert.AreEqual(7, res);
        }
Example #38
0
        public void TestSubQPointFOperator()
        {
            var s1 = new QPointF(3, 7);

            var res = -s1;

            Assert.AreEqual(-3, res.X);
            Assert.AreEqual(-7, res.Y);
        }
Example #39
0
        public void TestSubQPointFsOperator()
        {
            var s1 = new QPointF(3, 7);
            var s2 = new QPointF(-1, 4);

            var res = s1 - s2;

            Assert.AreEqual(4, res.X);
            Assert.AreEqual(3, res.Y);
        }
Example #40
0
        public unsafe void TestRy()
        {
            var s1 = new QPointF(3, 7);

            double* res = s1.Ry;

            Assert.AreEqual(7, *res);
        }
Example #41
0
        public void TestSubEqualOperator()
        {
            var s1 = new QPointF(3, 7);
            var s2 = new QPointF(-1, 4);

            s1 -= s2;

            Assert.AreEqual(4, s1.X);
            Assert.AreEqual(3, s1.Y);
        }
Example #42
0
        public void TestIsNull()
        {
            var s = new QPointF();

            Assert.IsTrue(s.IsNull);
        }
Example #43
0
        public void TestNotEqualOperator()
        {
            var s1 = new QPointF(3, 7);
            var s2 = new QPointF(-1, 4);

            Assert.AreNotEqual(s1, s2);
        }
Example #44
0
        public void TestManhattanLength()
        {
            var s1 = new QPointF(3, 7);
            var res = s1.ManhattanLength;

            Assert.AreEqual(10, res);
        }
Example #45
0
        public void TestEmptyConstructor()
        {
            var s = new QPointF();

            Assert.AreEqual(0, s.X);
            Assert.AreEqual(0, s.Y);
        }
Example #46
0
        public void TestMultFloatOperator()
        {
            var s1 = new QPointF(3, 7);

            var res = s1 * 5.0f;

            Assert.AreEqual(15, res.X);
            Assert.AreEqual(35, res.Y);
        }
Example #47
0
        public void TestMultIntRevOperator()
        {
            var s1 = new QPointF(3, 7);

            var res = 5 * s1;

            Assert.AreEqual(15, res.X);
            Assert.AreEqual(35, res.Y);
        }
Example #48
0
        public void TestIsNull()
        {
            var s = new QPointF();

            Assert.IsTrue(s.IsNull);
        }