summaryrefslogtreecommitdiff
path: root/Plugins/MonoGame.Extended/tests/MonoGame.Extended.Tests/Primitives/EllipseFTest.cs
blob: 4a4ecdf9ef102881b7cdf2b06844a6b8dc594940 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Microsoft.Xna.Framework;
using Xunit;

namespace MonoGame.Extended.Tests.Primitives
{

    public class EllipseFTest
    {
        [Theory]
        [InlineData(-1, -1, false)]
        [InlineData(110, 300, true)]
        [InlineData(200, 300, true)]
        [InlineData(290, 300, true)]
        [InlineData(400, 400, false)]
        public void ContainsPoint_Circle(int x, int y, bool expected)
        {
            var ellipse = new EllipseF(new Vector2(200.0f, 300.0f), 100.0f, 100.0f);

            Assert.Equal(expected, ellipse.Contains(x, y));
        }

        [Theory]
        [InlineData(299, 400, false)]
        [InlineData(501, 400, false)]
        [InlineData(400, 199, false)]
        [InlineData(400, 601, false)]
        [InlineData(301, 400, true)]
        [InlineData(499, 400, true)]
        [InlineData(400, 201, true)]
        [InlineData(400, 599, true)]
        public void ContainsPoint_NonCircle(int x, int y, bool expected)
        {
            var ellipse = new EllipseF(new Vector2(400.0f, 400.0f), 100.0f, 200.0f);

            Assert.Equal(expected, ellipse.Contains(x, y));
        }
    }
}