Ejemplo n.º 1
0
        public void center_to_bounds_with_starting_offset()
        {
            var actor = new Actor("Rodney Rectangle", null);

            actor.transform.Position = new Vector2(300, 300);
            var boundingRect = new BoundingRect(actor, new Point(32, 64));

            boundingRect.SetOffset(new Vector2(20, 20));
            var startingCenter  = boundingRect.Rect.Center;
            var startingTopLeft = new Point(boundingRect.Rect.Top, boundingRect.Rect.Left);

            boundingRect.CenterToBounds();

            boundingRect.Rect.Center.Should().BeEquivalentTo(startingCenter); // Center should not have moved
            new Point(boundingRect.Rect.Top, boundingRect.Rect.Left).Should().BeEquivalentTo(startingTopLeft);
        }