Пример #1
0
        public void TightBoundsForEnclosedPathIsNotZero()
        {
            const int Precision = 3;

            var rect = SKRect.Create(10, 20, 28.889f, 28.889f);

            var path = new SKPath();

            path.MoveTo(10, 20);
            path.CubicTo(10, 20, 30, 40, 30, 40);
            path.CubicTo(50, 60, 30, 40, 30, 40);

            var bounds = path.ComputeTightBounds();

            Assert.Equal(rect.Left, bounds.Left);
            Assert.Equal(rect.Top, bounds.Top);
            Assert.Equal(rect.Right, bounds.Right, Precision);
            Assert.Equal(rect.Bottom, bounds.Bottom, Precision);
        }
Пример #2
0
        public void TightBoundsForEnclosedPathIsNotZero()
        {
            var delta = 0.001f;

            var rect = SKRect.Create(10, 20, 28.889f, 28.889f);

            var path = new SKPath();

            path.MoveTo(10, 20);
            path.CubicTo(10, 20, 30, 40, 30, 40);
            path.CubicTo(50, 60, 30, 40, 30, 40);

            var bounds = path.ComputeTightBounds();

            Assert.AreEqual(rect.Left, bounds.Left, "Left");
            Assert.AreEqual(rect.Top, bounds.Top, "Top");
            Assert.AreEqual(rect.Right, bounds.Right, delta, "Right");
            Assert.AreEqual(rect.Bottom, bounds.Bottom, delta, "Bottom");
        }