public void ToQuadraticWithPortraitWindow()
		{
			window.ViewportPixelSize = new Size(75, 100);
			var screen = new QuadraticScreenSpace(window);
			Assert.AreEqual(new Vector2D(0.125f, 0), screen.TopLeft);
			Assert.AreEqual(new Vector2D(0.875f, 1), screen.BottomRight);
			Assert.AreEqual(new Rectangle(0.125f, 0, 0.75f, 1), screen.Viewport);
			Assert.AreEqual(new Vector2D(0.875f, 1f), screen.FromPixelSpace(new Vector2D(75, 100)));
			Assert.AreEqual(Vector2D.Half, screen.FromPixelSpace(new Vector2D(37.5f, 50)));
			Assert.IsTrue(screen.FromPixelSpace(new Size(10, 10)).IsNearlyEqual(new Size(0.1f, 0.1f)));
		}
 public void ToPixelInFullHdResolution()
 {
     window.ViewportPixelSize = new Size(1920, 1080);
     var screen = new QuadraticScreenSpace(window);
     Assert.AreEqual(new Vector2D(1680, 1500), screen.ToPixelSpace(new Vector2D(0.875f, 1f)));
     var somePoint = screen.FromPixelSpace(new Vector2D(324, 483));
     var somePointPlusOne = screen.FromPixelSpace(new Vector2D(325, 483));
     Assert.IsFalse(somePoint.X.IsNearlyEqual(somePointPlusOne.X),
         somePoint + " should not be nearly equal to " + somePointPlusOne);
     Assert.AreEqual(new Vector2D(324, 483), screen.ToPixelSpaceRounded(somePoint));
     Assert.AreEqual(new Vector2D(325, 483), screen.ToPixelSpaceRounded(somePointPlusOne));
 }
		public void IfCameraNotAdjustedItBehavesIdenticallyToQuadraticScreenSpace()
		{
			var q = new QuadraticScreenSpace(window);
			var c = new Camera2DScreenSpace(window);
			Assert.IsTrue(
				c.FromPixelSpace(new Vector2D(1, 2)).IsNearlyEqual(q.FromPixelSpace(new Vector2D(1, 2))));
			Assert.IsTrue(
				c.FromPixelSpace(new Size(-3, 4)).IsNearlyEqual(q.FromPixelSpace(new Size(-3, 4))));
			Assert.IsTrue(
				c.ToPixelSpace(new Vector2D(2, 6)).IsNearlyEqual(q.ToPixelSpace(new Vector2D(2, 6))));
			Assert.IsTrue(c.ToPixelSpace(new Size(-2, 0)).IsNearlyEqual(q.ToPixelSpace(new Size(-2, 0))));
		}
		public void ToQuadraticWithNonSquareWindow()
		{
			window.ViewportPixelSize = new Size(100, 75);
			var screen = new QuadraticScreenSpace(window);
			Assert.AreEqual(0, screen.Left);
			Assert.AreEqual(0.125f, screen.Top);
			Assert.AreEqual(1, screen.Right);
			Assert.AreEqual(0.875f, screen.Bottom);
			Assert.AreEqual(new Rectangle(0, 0.125f, 1, 0.75f), screen.Viewport);
			Assert.AreEqual(new Vector2D(1f, 0.875f), screen.FromPixelSpace(new Vector2D(100, 75)));
			Assert.AreEqual(Vector2D.Half, screen.FromPixelSpace(new Vector2D(50, 37.5f)));
			Assert.IsTrue(screen.FromPixelSpace(new Size(10, 10)).IsNearlyEqual(new Size(0.1f, 0.1f)));
		}
		public void ToQuadraticWithUnevenSize()
		{
			window.ViewportPixelSize = new Size(99, 199);
			var screen = new QuadraticScreenSpace(window);
			Assert.AreEqual(new Vector2D(0.2512563f, 0), screen.TopLeft);
			Assert.AreEqual(new Vector2D(0.7487437f, 1), screen.BottomRight);
			Assert.AreEqual(screen.BottomRight, screen.FromPixelSpace(new Vector2D(99, 199)));
		}