2020-07-31 17:14:25 +02:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
using MLEM.Textures;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using Tests.Stub;
|
|
|
|
|
|
|
|
namespace Tests {
|
|
|
|
public class TestDataTextureAtlas {
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Test() {
|
|
|
|
var content = new StubContent(new Dictionary<string, object> {
|
2020-07-31 17:25:56 +02:00
|
|
|
{"Texture", new Texture2D(new StubGraphics(), 1, 1)}
|
2020-07-31 17:14:25 +02:00
|
|
|
});
|
2020-07-31 17:25:56 +02:00
|
|
|
var atlas = content.LoadTextureAtlas("Texture");
|
2020-07-31 17:14:25 +02:00
|
|
|
Assert.AreEqual(atlas.Regions.Count(), 5);
|
|
|
|
|
|
|
|
var table = atlas["LongTableUp"];
|
|
|
|
Assert.AreEqual(table.Area, new Rectangle(0, 32, 64, 48));
|
|
|
|
Assert.AreEqual(table.PivotPixels, new Vector2(16, 48 - 32));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|