Exemplo n.º 1
0
        public void ModifyTileTextureData()
        {
            Texture2D tex1 = RandomTexture(16, 16);
            Texture2D tex2 = RandomTexture(16, 16);

            Assert.IsFalse(TexturesEqual(tex1, tex2));

            byte[] data = new byte[16 * 16 * 4];
            tex2.GetData(data);

            int id = _pool.AddTile(tex1);

            _eventsFired = EventFlags.None;

            _pool.TileModified += (s, e) =>
            {
                Assert.AreEqual(_pool, e.Tile.Pool);
                Assert.AreEqual(id, e.Tile.Uid);
                Assert.IsTrue(TexturesEqual(tex2, e.Tile.Pool.GetTileTexture(id)));
            };

            _pool.SetTileTextureData(id, data);

            Assert.AreEqual(EventFlags.Modified | EventFlags.TileModified, _eventsFired);
            Assert.AreEqual(1, _registry.TileCount);
            Assert.AreEqual(1, _pool.Count);
        }