mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-22 02:09:31 +00:00
40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using Microsoft.Xna.Framework.Graphics;
|
|
using MonoGame.Extended.Graphics;
|
|
using NUnit.Framework;
|
|
|
|
namespace MonoGame.Extended.Tests.Graphics
|
|
{
|
|
[TestFixture]
|
|
public class Texture2DTests
|
|
{
|
|
[Test]
|
|
public void TextureRegion2D_FromTexture_Test()
|
|
{
|
|
var graphicsDevice = TestHelper.CreateGraphicsDevice();
|
|
var texture = new Texture2D(graphicsDevice, 100, 200);
|
|
var textureRegion = new TextureRegion2D(texture);
|
|
|
|
Assert.AreSame(texture, textureRegion.Texture);
|
|
Assert.AreEqual(0, textureRegion.X);
|
|
Assert.AreEqual(0, textureRegion.Y);
|
|
Assert.AreEqual(100, textureRegion.Width);
|
|
Assert.AreEqual(200, textureRegion.Height);
|
|
Assert.IsNull(textureRegion.Tag);
|
|
}
|
|
|
|
[Test]
|
|
public void TextureRegion2D_Specified_Test()
|
|
{
|
|
var graphicsDevice = TestHelper.CreateGraphicsDevice();
|
|
var texture = new Texture2D(graphicsDevice, 100, 200);
|
|
var textureRegion = new TextureRegion2D(texture, 10, 20, 30, 40);
|
|
|
|
Assert.AreSame(texture, textureRegion.Texture);
|
|
Assert.AreEqual(10, textureRegion.X);
|
|
Assert.AreEqual(20, textureRegion.Y);
|
|
Assert.AreEqual(30, textureRegion.Width);
|
|
Assert.AreEqual(40, textureRegion.Height);
|
|
Assert.IsNull(textureRegion.Tag);
|
|
}
|
|
}
|
|
} |