public void TestHashCodeOnDifferingInstances() { using ( Texture2D testTexture1 = new Texture2D( this.mockedGraphicsDeviceService.GraphicsDevice, 128, 256 ) ) { using ( Texture2D testTexture2 = new Texture2D( this.mockedGraphicsDeviceService.GraphicsDevice, 256, 128 ) ) { TextureRegion2D region1 = TextureRegion2D.FromTexels( testTexture1, new Point(16, 32), new Point(48, 64) ); TextureRegion2D region2 = TextureRegion2D.FromTexels( testTexture1, new Point(80, 96), new Point(112, 128) ); Assert.AreNotEqual(region1.GetHashCode(), region2.GetHashCode()); } } }
public void TestToString() { using ( Texture2D testTexture = new Texture2D( this.mockedGraphicsDeviceService.GraphicsDevice, 128, 128 ) ) { TextureRegion2D region = TextureRegion2D.FromTexels( testTexture, new Point(16, 32), new Point(48, 64) ); Assert.IsNotNull(region.ToString()); } }
public void TestEqualsOnNull() { using ( Texture2D testTexture = new Texture2D( this.mockedGraphicsDeviceService.GraphicsDevice, 128, 128 ) ) { TextureRegion2D region = TextureRegion2D.FromTexels( testTexture, new Point(16, 32), new Point(48, 64) ); Assert.IsFalse(region.Equals(null)); } }
public void TestInequalityOnEquivalentInstances() { using ( Texture2D testTexture = new Texture2D( this.mockedGraphicsDeviceService.GraphicsDevice, 128, 128 ) ) { TextureRegion2D region1 = TextureRegion2D.FromTexels( testTexture, new Point(16, 32), new Point(48, 64) ); TextureRegion2D region2 = TextureRegion2D.FromTexels( testTexture, new Point(16, 32), new Point(48, 64) ); Assert.IsFalse(region1 != region2); } }
public void TestEqualsWithDifferingInstances() { using ( Texture2D testTexture = new Texture2D( this.mockedGraphicsDeviceService.GraphicsDevice, 128, 128 ) ) { TextureRegion2D region1 = TextureRegion2D.FromTexels( testTexture, new Point(16, 32), new Point(48, 64) ); TextureRegion2D region2 = TextureRegion2D.FromTexels( testTexture, new Point(80, 96), new Point(112, 128) ); Assert.IsFalse(region1.Equals(region2)); } }
public void TestHashCodeOnEquivalentInstances() { using ( Texture2D testTexture = new Texture2D( this.mockedGraphicsDeviceService.GraphicsDevice, 128, 128 ) ) { TextureRegion2D region1 = TextureRegion2D.FromTexels( testTexture, new Point(16, 32), new Point(48, 64) ); TextureRegion2D region2 = TextureRegion2D.FromTexels( testTexture, new Point(16, 32), new Point(48, 64) ); Assert.AreEqual(region1.GetHashCode(), region2.GetHashCode()); } }
public void TestFromTexelPoints() { using ( Texture2D testTexture = new Texture2D( this.mockedGraphicsDeviceService.GraphicsDevice, 128, 256 ) ) { TextureRegion2D region = TextureRegion2D.FromTexels( testTexture, new Point(16, 32), new Point(96, 112) ); Vector2 min = new Vector2(16.0f / 128.0f, 32.0f / 256.0f); Vector2 max = new Vector2(96.0f / 128.0f, 112.0f / 256.0f); Assert.AreSame(testTexture, region.Texture); Assert.AreEqual(min, region.Min); Assert.AreEqual(max, region.Max); } }