示例#1
0
        public static void SwitchChannelsTest(TexImage image, ITexLibrary library)
        {
            var isInRgbaOrder = image.Format.IsRGBAOrder();

            library.Execute(image, new SwitchingBRChannelsRequest());
            Assert.True(image.Format.IsRGBAOrder() != isInRgbaOrder);

            //Console.WriteLine("SwitchChannelsTest_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
            Assert.Equal(TestTools.GetInstance().Checksum["SwitchChannelsTest_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
        }
示例#2
0
        public void ExtractAllTest(string file1, string file2)
        {
            var list = new List <TexImage>();

            for (int i = 0; i < 5; ++i)
            {
                list.Add(texTool.Load(Module.PathToInputImages + file1));
                //Console.WriteLine("ArrayTexLibrary_ExtractAll_" + Path.GetFileName(file1) + "." + TestTools.ComputeSHA1(temp.Data, temp.DataSize));

                list.Add(texTool.Load(Module.PathToInputImages + file2));
                //Console.WriteLine("ArrayTexLibrary_ExtractAll_" + Path.GetFileName(file2) + "." + TestTools.ComputeSHA1(temp.Data, temp.DataSize));
            }

            var array = texTool.CreateTextureArray(list);

            var extracted = texTool.ExtractAll(array);

            Assert.True(list.Count == extracted.Count);

            for (int i = 0; i < array.ArraySize; ++i)
            {
                Assert.Equal(TestTools.GetInstance().Checksum["ExtractAll_" + list[i].Name], TestTools.ComputeSHA1(extracted[i].Data, extracted[i].DataSize));
                extracted[i].Dispose();
            }

            array.Dispose();

            foreach (var image in list)
            {
                image.Dispose();
            }
        }
示例#3
0
        public void RemoveTest(string arrayFile, int indice)
        {
            var array = texTool.Load(Module.PathToInputImages + arrayFile);

            texTool.Remove(array, indice);

            //Console.WriteLine("TextureTool_Remove_" + indice + "_" + arrayFile + "." + TestTools.ComputeSHA1(array.Data, array.DataSize));
            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_Remove_" + indice + "_" + arrayFile], TestTools.ComputeSHA1(array.Data, array.DataSize));

            try
            {
                texTool.Remove(array, array.ArraySize);
                Assert.True(false);
            }
            catch (TextureToolsException)
            {
                Assert.True(true);
            }

            array.Dispose();
        }
示例#4
0
        public void UpdateAtlasTest(string atlasFile, string textureName)
        {
            var atlas         = texTool.LoadAtlas(TexAtlas.TexLayout.Import(Module.PathToInputImages + Path.GetFileNameWithoutExtension(atlasFile) + TexAtlas.TexLayout.Extension), Module.PathToInputImages + atlasFile);
            var updateTexture = texTool.Load(Module.PathToInputImages + textureName);

            texTool.Update(atlas, updateTexture);

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_UpdateAtlas_" + atlasFile + "_" + Path.GetFileName(textureName)], TestTools.ComputeSHA1(atlas.Data, atlas.DataSize));
            //Console.WriteLine("TextureTool_UpdateAtlas_" + atlasFile + "_" + Path.GetFileName(textureName) + "." + TestTools.ComputeSHA1(atlas.Data, atlas.DataSize));

            atlas.Dispose();
            updateTexture.Dispose();
        }
示例#5
0
        public void CreateCubeTest(string file1, string file2)
        {
            var list = new List <TexImage>();

            for (int i = 0; i < 3; ++i)
            {
                list.Add(texTool.Load(Module.PathToInputImages + file1));
                list.Add(texTool.Load(Module.PathToInputImages + file2));
            }

            var array = texTool.CreateTextureCube(list);

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_CreateCube_" + Path.GetFileName(file1) + "_" + Path.GetFileName(file2)], TestTools.ComputeSHA1(array.Data, array.DataSize));
            //Console.WriteLine("TextureTool_CreateCube_" + Path.GetFileName(file1) + "_" + Path.GetFileName(file2) + "." + TestTools.ComputeSHA1(array.Data, array.DataSize));

            array.Dispose();

            foreach (var image in list)
            {
                image.Dispose();
            }
        }
示例#6
0
        public void SaveTest(string input, string extension, PixelFormat compressionFormat, int minimumMipmapSize)
        {
            TexImage image = texTool.Load(Module.PathToInputImages + input);

            string output = Path.GetFileNameWithoutExtension(input) + extension;

            if (compressionFormat == PixelFormat.None)
            {
                texTool.Save(image, Module.PathToOutputImages + output, minimumMipmapSize);
            }
            else
            {
                texTool.Save(image, Module.PathToOutputImages + output, compressionFormat, minimumMipmapSize);
            }

            Assert.True(File.Exists(Module.PathToOutputImages + output));
            var loaded = texTool.Load(Module.PathToOutputImages + output);

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_Save_" + compressionFormat + "_" + minimumMipmapSize + "_" + loaded.Name], TestTools.ComputeSHA1(loaded.Data, loaded.DataSize));
            //Console.WriteLine("TextureTool_Save_" + compressionFormat + "_" + minimumMipmapSize + "_" + loaded.Name + "." + TestTools.ComputeSHA1(loaded.Data, loaded.DataSize));

            File.Delete(Module.PathToOutputImages + output);

            loaded.Dispose();
            image.Dispose();
        }
示例#7
0
        public void ExtractAtlasTest(string atlasFile, string textureName)
        {
            var atlas     = texTool.LoadAtlas(Module.PathToInputImages + atlasFile);
            var extracted = texTool.Extract(atlas, textureName, 16);

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_ExtractAtlas_" + atlasFile + "_" + textureName], TestTools.ComputeSHA1(extracted.Data, extracted.DataSize));
            //Console.WriteLine("TextureTool_ExtractAtlas_" + atlasFile + "_" + textureName + "." + TestTools.ComputeSHA1(extracted.Data, extracted.DataSize));

            extracted.Dispose();
            atlas.Dispose();
        }
示例#8
0
        public void UpdateTest(string atlasFile, string textureNameToUpdate, string newTexture)
        {
            TexAtlas atlas = new TexAtlas(TexAtlas.TexLayout.Import(Module.PathToInputImages + Path.GetFileNameWithoutExtension(atlasFile) + TexAtlas.TexLayout.Extension), TestTools.Load(fiLib, atlasFile));

            var updateTexture = TestTools.Load(fiLib, newTexture);

            library.Execute(atlas, new AtlasUpdateRequest(updateTexture, textureNameToUpdate));
            library.EndLibrary(atlas);

            //Console.WriteLine("AtlasTexLibrary_Update_" + textureNameToUpdate + "_" + atlasFile + "." + TestTools.ComputeSHA1(atlas.Data, atlas.DataSize));
            Assert.Equal(TestTools.GetInstance().Checksum["AtlasTexLibrary_Update_" + textureNameToUpdate + "_" + atlasFile], TestTools.ComputeSHA1(atlas.Data, atlas.DataSize));

            updateTexture.Dispose();
            atlas.Dispose();
        }
示例#9
0
        public void CreateAtlasTest(string directory, bool generateMipMaps, bool forceSquaredAtlas)
        {
            string path = Module.PathToInputImages + directory;

            string[] fileList = Directory.GetFiles(path);
            var      list     = new List <TexImage>(fileList.Length);

            foreach (string filePath in fileList)
            {
                var temp = Load(fiLib, filePath);
                list.Add(temp);
                if (generateMipMaps)
                {
                    fiLib.EndLibrary(temp);
                    dxtLib.StartLibrary(temp);
                    dxtLib.Execute(temp, new MipMapsGenerationRequest(Filter.MipMapGeneration.Cubic));
                    temp.CurrentLibrary = dxtLib;
                }
            }

            var atlas = new TexAtlas();

            library.Execute(atlas, new AtlasCreationRequest(list, forceSquaredAtlas));

            //Console.WriteLine("AtlasTexLibrary_CreateAtlas_" + generateMipMaps + "_" + forceSquaredAtlas + "." + TestTools.ComputeSHA1(atlas.Data, atlas.DataSize));
            Assert.Equal(TestTools.GetInstance().Checksum["AtlasTexLibrary_CreateAtlas_" + generateMipMaps + "_" + forceSquaredAtlas], TestTools.ComputeSHA1(atlas.Data, atlas.DataSize));

            if (forceSquaredAtlas)
            {
                Assert.True(atlas.Width == atlas.Height);
            }

            atlas.Dispose();

            foreach (var image in list)
            {
                image.Dispose();
            }
        }
示例#10
0
        public void ExportArrayTest(string fileName, string extension, int minMipMapSize)
        {
            DxtTexLib lib   = new DxtTexLib();
            TexImage  image = new TexImage();

            lib.Execute(image, new LoadingRequest(Module.PathToInputImages + fileName + extension, false));
            lib.EndLibrary(image);
            library.StartLibrary(image);

            library.Execute(image, new ExportRequest(Module.PathToOutputImages + "FITexLibTest_ExportArrayTest_" + fileName + ".png", minMipMapSize));

            int ct = 0;

            for (int i = 0; i < image.ArraySize; ++i)
            {
                for (int j = 0; j < image.MipmapCount; ++j)
                {
                    if (image.SubImageArray[ct].Height < minMipMapSize || image.SubImageArray[ct].Width < minMipMapSize)
                    {
                        break;
                    }
                    string file = Module.PathToOutputImages + "FITexLibTest_ExportArrayTest_" + fileName + "-ind_" + i + "-mip_" + j + ".png";
                    Assert.True(File.Exists(file));

                    //Console.WriteLine("FITexLibTest_ExportArrayTest_" + minMipMapSize + "_" + fileName + "-ind_" + i + "-mip_" + j + ".png" + "." + TestTools.ComputeSHA1(file));
                    Assert.Equal(TestTools.GetInstance().Checksum["FITexLibTest_ExportArrayTest_" + minMipMapSize + "_" + fileName + "-ind_" + i + "-mip_" + j + ".png"], TestTools.ComputeSHA1(file));
                    File.Delete(file);
                    ++ct;
                }
            }

            image.Dispose();
        }
示例#11
0
        public void ExtractAllTest(string directory)
        {
            string path = Module.PathToInputImages + directory;

            string[] fileList = Directory.GetFiles(path);
            var      list     = new List <TexImage>(fileList.Length);

            foreach (string filePath in fileList)
            {
                var temp = Load(fiLib, filePath);
                list.Add(temp);
                //Console.WriteLine("ExtractAll_" + Path.GetFileName(filePath) + "." + TestTools.ComputeSHA1(temp.Data, temp.DataSize));
            }

            var atlas = new TexAtlas();

            library.Execute(atlas, new AtlasCreationRequest(list));

            var request = new AtlasExtractionRequest(0);

            library.Execute(atlas, request);
            library.EndLibrary(atlas);

            Assert.True(list.Count == request.Textures.Count);

            foreach (var image in request.Textures)
            {
                Assert.Equal(TestTools.GetInstance().Checksum["ExtractAll_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
                image.Dispose();
            }

            atlas.Dispose();

            foreach (var image in list)
            {
                image.Dispose();
            }
        }
示例#12
0
        public static void CompressTest(TexImage image, ITexLibrary library, PixelFormat format)
        {
            Assert.True(!image.Format.IsCompressed());
            library.Execute(image, new CompressingRequest(format));

            Assert.True(image.Format == format);
            Assert.Equal(TestTools.GetInstance().Checksum["CompressTest_" + format + "_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
            //Console.WriteLine("CompressTest_" + format + "_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
        }
示例#13
0
 public static void DecompressTest(TexImage image, ITexLibrary library)
 {
     Assert.True(image.Format.IsCompressed());
     library.Execute(image, new DecompressingRequest(false));
     Assert.True(image.Format == PixelFormat.R8G8B8A8_UNorm);
     Assert.Equal(TestTools.GetInstance().Checksum["DecompressTest_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
     //Console.WriteLine("DecompressTest_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
 }
示例#14
0
        public static void FlipTest(TexImage image, ITexLibrary library, Orientation orientation)
        {
            library.Execute(image, new FlippingRequest(orientation));

            Assert.Equal(TestTools.GetInstance().Checksum["FlipTest_" + orientation + "_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
            //Console.WriteLine("FlipTest_" + orientation + "_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
        }
示例#15
0
        public void ResizeTest(string file)
        {
            TexImage image  = texTool.Load(Module.PathToInputImages + file);
            int      width  = image.Width;
            int      height = image.Height;

            Assert.True(image.MipmapCount > 1);

            texTool.Resize(image, width / 2, height / 2, Filter.Rescaling.Bicubic);
            Assert.True(image.Width == width / 2);
            Assert.True(image.Height == height / 2);
            Assert.True(image.MipmapCount == 1);

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_Rescale_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
            //Console.WriteLine("TextureTool_Rescale_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));

            image.Dispose();
        }
示例#16
0
        public void ExtractTest(string atlasFile, string extractedName)
        {
            TexAtlas atlas = new TexAtlas(TexAtlas.TexLayout.Import(Module.PathToInputImages + Path.GetFileNameWithoutExtension(atlasFile) + TexAtlas.TexLayout.Extension), TestTools.Load(dxtLib, atlasFile));

            var request = new AtlasExtractionRequest(extractedName, 16);

            library.Execute(atlas, request);
            atlas.CurrentLibrary = library;

            var extracted = request.Texture;

            string nameWOExtension = Path.GetFileNameWithoutExtension(extractedName);

            //Console.WriteLine("AtlasTexLibrary_Extract_" + nameWOExtension + ".dds." + TestTools.ComputeSHA1(extracted.Data, extracted.DataSize));
            Assert.Equal(TestTools.GetInstance().Checksum["AtlasTexLibrary_Extract_" + nameWOExtension + ".dds"], TestTools.ComputeSHA1(extracted.Data, extracted.DataSize));

            extracted.Dispose();

            atlas.Dispose();
        }
示例#17
0
        public void SwitchChannelTest(string file)
        {
            var image         = texTool.Load(Module.PathToInputImages + file);
            var isInBgraOrder = image.Format.IsBGRAOrder();

            texTool.SwitchChannel(image);
            image.Update();

            Assert.True(isInBgraOrder != image.Format.IsBGRAOrder());

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_SwitchChannel_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
            //Console.WriteLine("TextureTool_SwitchChannel_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));

            image.Dispose();
        }
示例#18
0
        public void FlipTest(string file, Orientation orientation)
        {
            TexImage image = texTool.Load(Module.PathToInputImages + file);

            texTool.Flip(image, orientation);
            image.Update();

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_Flip_" + orientation + "_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
            //Console.WriteLine("TextureTool_Flip_" + orientation + "_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));

            image.Dispose();
        }
示例#19
0
        public void CreateAtlasTest()
        {
            string[] fileList = Directory.GetFiles(Module.PathToInputImages + "atlas/");
            var      list     = new List <TexImage>(fileList.Length);

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

            var atlas = texTool.CreateAtlas(list);

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_CreateAtlas"], TestTools.ComputeSHA1(atlas.Data, atlas.DataSize));
            //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.True(false);
            }
            catch (TextureToolsException)
            {
                Assert.True(true);
            }

            foreach (var image in list)
            {
                image.Dispose();
            }
        }
示例#20
0
        public void PreMultiplyAlphaTest(string file)
        {
            TexImage image = texTool.Load(Module.PathToInputImages + file);

            texTool.PreMultiplyAlpha(image);

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_PreMultiplyAlpha_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
            //Console.WriteLine("TextureTool_PreMultiplyAlpha_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));

            image.Dispose();
        }
示例#21
0
        public void ExtractAllAtlasTest(string atlasFile)
        {
            string[] fileList = Directory.GetFiles(Module.PathToInputImages + "atlas/");
            var      list     = new List <TexImage>(fileList.Length);

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

            var atlas = texTool.CreateAtlas(list);

            var extracted = texTool.ExtractAll(atlas);

            Assert.True(extracted.Count == list.Count);

            foreach (var image in extracted)
            {
                Assert.Equal(TestTools.GetInstance().Checksum["ExtractAll_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
                image.Dispose();
            }

            atlas.Dispose();

            foreach (var image in list)
            {
                image.Dispose();
            }
        }
示例#22
0
        public void CompressTest(string filename, PixelFormat format)
        {
            TexImage image = texTool.Load(Module.PathToInputImages + filename);

            texTool.Compress(image, format);
            Assert.True(image.Format == format);

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_Compress_" + format + "_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
            //Console.WriteLine("TextureTool_Compress_" + format + "_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));

            image.Dispose();
        }
示例#23
0
        public void DecompressTest()
        {
            TexImage img;
            int      mipmapCount, arraySize, width, height, depth, subImageArrayLenght;

            // ------------------- Test with BC3 image -------------------
            img = texTool.Load(Module.PathToInputImages + "TextureArray_WMipMaps_BC3.dds");
            Assert.True(img.Format == PixelFormat.BC3_UNorm);
            mipmapCount         = img.MipmapCount;
            arraySize           = img.ArraySize;
            width               = img.Width;
            height              = img.Height;
            depth               = img.Depth;
            subImageArrayLenght = img.SubImageArray.Length;

            texTool.Decompress(img, false);
            Assert.True(img.Format == PixelFormat.R8G8B8A8_UNorm);
            Assert.True(mipmapCount == img.MipmapCount);
            Assert.True(arraySize == img.ArraySize);
            Assert.True(width == img.Width);
            Assert.True(height == img.Height);
            Assert.True(depth == img.Depth);
            Assert.True(subImageArrayLenght == img.SubImageArray.Length);

            Assert.Equal(TestTools.GetInstance().Checksum["DecompressTest_TextureArray_WMipMaps_BC3.dds"], TestTools.ComputeSHA1(img.Data, img.DataSize));
            img.Dispose();

            // ------------------- Test with uncompress image -------------------
            img = texTool.Load(Module.PathToInputImages + "stones.png");
            texTool.Decompress(img, false);
            Assert.True(img.Format == PixelFormat.B8G8R8A8_UNorm); //FITexLibrary loads image in BGRA order...
            img.Dispose();
        }
示例#24
0
        public void GenerateMipMapTest(string file, Filter.MipMapGeneration filter)
        {
            TexImage image = texTool.Load(Module.PathToInputImages + file);

            texTool.GenerateMipMaps(image, filter);
            Assert.True(image.MipmapCount > 1);

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_GenerateMipMap_" + filter + "_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
            //Console.WriteLine("TextureTool_GenerateMipMap_" + filter + "_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));

            image.Dispose();
        }
示例#25
0
        public void ExtractTest(string arrayFile, int indice)
        {
            TexImage array = texTool.Load(Module.PathToInputImages + arrayFile);

            var extracted = texTool.Extract(array, indice);

            //Console.WriteLine("TextureTool_Extract_" + indice + "_" + arrayFile + "." + TestTools.ComputeSHA1(extracted.Data, extracted.DataSize));
            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_Extract_" + indice + "_" + arrayFile], TestTools.ComputeSHA1(extracted.Data, extracted.DataSize));

            extracted.Dispose();
            array.Dispose();
        }
示例#26
0
        public void CorrectGammaTest(string file)
        {
            TexImage image = texTool.Load(Module.PathToInputImages + file);

            texTool.CorrectGamma(image, 1 / 2.2);
            image.Update();

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_CorrectGamma_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
            //Console.WriteLine("TextureTool_CorrectGamma_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));

            image.Dispose();
        }
示例#27
0
        public void InsertTest(string arrayFile, string newTexture, int indice)
        {
            var array   = texTool.Load(Module.PathToInputImages + arrayFile);
            var texture = texTool.Load(Module.PathToInputImages + newTexture);

            texTool.Compress(texture, PixelFormat.BC3_UNorm);

            texTool.Insert(array, texture, indice);

            //Console.WriteLine("TextureTool_Insert_" + indice + "_" + Path.GetFileName(newTexture) + "_" + arrayFile + "." + TestTools.ComputeSHA1(array.Data, array.DataSize));
            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_Insert_" + indice + "_" + Path.GetFileName(newTexture) + "_" + arrayFile], TestTools.ComputeSHA1(array.Data, array.DataSize));

            try
            {
                texTool.Insert(array, texture, array.ArraySize + 1);
                Assert.True(false);
            }
            catch (TextureToolsException)
            {
                Assert.True(true);
            }

            array.Dispose();
            texture.Dispose();
        }
示例#28
0
        public void GenerateNormalMapTest(string file)
        {
            TexImage image  = texTool.Load(Module.PathToInputImages + file);
            var      normal = texTool.GenerateNormalMap(image, 0.5f);

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_GenerateNormalMap_" + image.Name], TestTools.ComputeSHA1(normal.Data, normal.DataSize));
            //Console.WriteLine("TextureTool_GenerateNormalMap_" + image.Name + "." + TestTools.ComputeSHA1(normal.Data, normal.DataSize));

            normal.Dispose();
            image.Dispose();
        }
示例#29
0
        public void UpdateArrayTest(string arrayFile, string textureName, int indice)
        {
            var array         = texTool.Load(Module.PathToInputImages + arrayFile);
            var updateTexture = texTool.Load(Module.PathToInputImages + textureName);

            texTool.Update(array, updateTexture, indice);

            Assert.Equal(TestTools.GetInstance().Checksum["TextureTool_UpdateArray_" + arrayFile + "_" + indice + "_" + Path.GetFileName(textureName)], TestTools.ComputeSHA1(array.Data, array.DataSize));
            //Console.WriteLine("TextureTool_UpdateArray_" + arrayFile + "_" + indice + "_" + Path.GetFileName(textureName) + "." + TestTools.ComputeSHA1(array.Data, array.DataSize));

            array.Dispose();
            updateTexture.Dispose();

            try
            {
                texTool.Update(array, updateTexture, array.ArraySize);
                Assert.True(false);
            }
            catch (TextureToolsException)
            {
                Assert.True(true);
            }
        }
示例#30
0
        public static void FixedRescaleTest(TexImage image, ITexLibrary library, Filter.Rescaling filter)
        {
            var request = new FixedRescalingRequest(256, 256, filter);
            int width   = request.ComputeWidth(image);
            int height  = request.ComputeHeight(image);

            library.Execute(image, request);
            Assert.True(image.Width == width);
            Assert.True(image.Height == height);
            Assert.True(image.MipmapCount == 1);

            image.Update();

            Assert.Equal(TestTools.GetInstance().Checksum["FixedRescaleTest_" + filter + "_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
            //Console.WriteLine("FixedRescaleTest_" + filter + "_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
        }