Example #1
0
        public void TestBounds()
        {
            Quad quad = new Quad(10, 20);

            quad.X        = -10;
            quad.Y        = 10;
            quad.Rotation = MathUtil.PIHALF;
            Rectangle bounds = quad.Bounds;

            AssertAreEqualWithSmallError(-30, bounds.X, "wrong bounds.x: " + bounds.X);
            AssertAreEqualWithSmallError(10, bounds.Y, "wrong bounds.y: " + bounds.Y);
            AssertAreEqualWithSmallError(20, bounds.Width, "wrong bounds.width: " + bounds.Width);
            AssertAreEqualWithSmallError(10, bounds.Height, "wrong bounds.height: " + bounds.Height);

            bounds = quad.GetBounds(quad);
            AssertAreEqualWithSmallError(0, bounds.X, "wrong inner bounds.x: " + bounds.X);
            AssertAreEqualWithSmallError(0, bounds.Y, "wrong inner bounds.y: " + bounds.Y);
            AssertAreEqualWithSmallError(10, bounds.Width, "wrong inner bounds.width: " + bounds.Width);
            AssertAreEqualWithSmallError(20, bounds.Height, "wrong innter bounds.height: " + bounds.Height);
        }