Beispiel #1
0
        public void CreateAtlasTest()
        {
            string[] fileList = Directory.GetFiles(TestTools.InputTestFolder + "atlas/");
            var      list     = new List <TexImage>(fileList.Length);

            foreach (string filePath in fileList)
            {
                list.Add(texTool.Load(filePath));
            }

            var atlas = texTool.CreateAtlas(list);

            Assert.IsTrue(TestTools.ComputeSHA1(atlas.Data, atlas.DataSize).Equals(TestTools.GetInstance().Checksum["TextureTool_CreateAtlas"]));
            //Console.WriteLine("TextureTool_CreateAtlas." + TestTools.ComputeSHA1(atlas.Data, atlas.DataSize));

            atlas.Dispose();

            var another = texTool.Load(fileList[fileList.Length - 1]);

            texTool.Compress(another, PixelFormat.BC3_UNorm);
            list.Add(another);

            try
            {
                atlas = texTool.CreateAtlas(list);
                Assert.IsTrue(false);
            }
            catch (TextureToolsException)
            {
                Assert.IsTrue(true);
            }

            foreach (var image in list)
            {
                image.Dispose();
            }
        }