public void TestImport() { using (FileStream fs = File.OpenRead("TestContent/purple_caves.png")) { TilePool pool = TilePool.Import("Test", _registry, fs, 16, 16); Assert.AreEqual(64, pool.Count); Assert.AreEqual(64, pool.Capacity); Assert.AreEqual("Test", pool.Name); Assert.AreEqual(16, pool.TileWidth); Assert.AreEqual(16, pool.TileHeight); } }
public void TestExport() { using (FileStream fs = File.OpenRead("TestContent/purple_caves.png")) { TilePool pool = TilePool.Import("Test", _registry, fs, 16, 16); pool.Export("TestOutput/purple_caves1.png"); } using (FileStream fs = File.OpenRead("TestOutput/purple_caves1.png")) { TilePool pool = TilePool.Import("Test", _registry, fs, 16, 16); Assert.AreEqual(64, pool.Count); Assert.AreEqual(64, pool.Capacity); } }
public void AddTileOverCapacity() { using (FileStream fs = File.OpenRead("TestContent/purple_caves.png")) { TilePool pool = TilePool.Import("Test", _registry, fs, 16, 16); Texture2D tex = new Texture2D(_service.GraphicsDevice, 16, 16); pool.TileAdded += (s, e) => { Assert.AreEqual(pool, e.Tile.Pool); Assert.AreEqual(tex.Width, e.Tile.Width); Assert.AreEqual(tex.Height, e.Tile.Height); }; int id = pool.AddTile(tex); Assert.AreEqual(65, _registry.TileCount); Assert.AreEqual(65, pool.Count); Assert.AreEqual(128, pool.Capacity); } }