public void GetInnerPoint() { window.TotalPixelSize = new Size(800, 600); ScreenSpace screen = new InvertedScreenSpace(window); Assert.AreEqual(screen.TopLeft, screen.GetInnerPoint(Point.Zero)); Assert.AreEqual(screen.BottomRight, screen.GetInnerPoint(Point.One)); }
public void ToPixelSpaceAndFromInvertedSpace() { window.TotalPixelSize = new Size(75, 100); var screen = new InvertedScreenSpace(window); Assert.AreEqual(Point.Zero, screen.ToPixelSpace(screen.TopLeft)); Assert.AreEqual(new Point(75, 100), screen.ToPixelSpace(screen.BottomRight)); Assert.AreEqual(Size.Zero, screen.ToPixelSpace(Size.Zero)); Assert.AreEqual(new Size(75, 100), screen.ToPixelSpace(Size.One)); }
public void NonSquareWindowWithInvertedSpace() { window.TotalPixelSize = new Size(100, 75); var screen = new InvertedScreenSpace(window); Assert.AreEqual(0.0f, screen.Left); Assert.AreEqual(1.0f, screen.Top); Assert.AreEqual(1.0f, screen.Right); Assert.AreEqual(0.0f, screen.Bottom); }
public void SquareWindowWithInvertedSpace() { window.TotalPixelSize = new Size(100, 100); var screen = new InvertedScreenSpace(window); Assert.AreEqual(Point.UnitY, screen.TopLeft); Assert.AreEqual(Point.UnitX, screen.BottomRight); Assert.AreEqual(new Rectangle(Point.UnitY, Size.One), screen.Viewport); Assert.AreEqual(Point.UnitX, screen.FromPixelSpace(new Point(100, 100))); Assert.AreEqual(new Rectangle(0.1f, 0.9f, 0.8f, 0.8f), screen.FromPixelSpace(new Rectangle(10, 10, 80, 80))); }