Example #1
0
        public void SaveTest(string input, string extension, Paradox.Graphics.PixelFormat compressionFormat, int minimumMipmapSize)
        {
            TexImage image = texTool.Load(TestTools.InputTestFolder + input);

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

            if (compressionFormat == Paradox.Graphics.PixelFormat.None)
            {
                texTool.Save(image, TestTools.TempFolder + output, minimumMipmapSize);
            }
            else
            {
                texTool.Save(image, TestTools.TempFolder + output, compressionFormat, minimumMipmapSize);
            }

            Assert.IsTrue(File.Exists(TestTools.TempFolder + output));
            var loaded = texTool.Load(TestTools.TempFolder + output);

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

            File.Delete(TestTools.TempFolder + output);

            loaded.Dispose();
            image.Dispose();
        }
Example #2
0
        public void CompressTest(string file, Paradox.Graphics.PixelFormat format)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.CompressTest(image, library, format);

            image.Dispose();
        }
Example #3
0
        public void CompressTest(string filename, Paradox.Graphics.PixelFormat format)
        {
            TexImage image = texTool.Load(TestTools.InputTestFolder + filename);

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

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

            image.Dispose();
        }
Example #4
0
        public void ProcessingTest(string source, string extension, Filter.Rescaling rescaleFiler, Paradox.Graphics.PixelFormat format)
        {
            var image = texTool.Load(TestTools.InputTestFolder + source);

            texTool.CorrectGamma(image, 2.2);

            texTool.Rescale(image, 0.5f, 0.5f, rescaleFiler);

            texTool.GenerateMipMaps(image, Filter.MipMapGeneration.Box);

            var normalMap = texTool.GenerateNormalMap(image, 4);

            texTool.CorrectGamma(normalMap, 1 / 2.2);

            string output = "TextureTool_ProcessingTest_NormalMap" + rescaleFiler + "_" + format + "_" + source + extension;

            texTool.Save(normalMap, TestTools.TempFolder + output, format, normalMap.Width / 2);
            normalMap.Dispose();

            Assert.IsTrue(TestTools.ComputeSHA1(TestTools.TempFolder + output).Equals(TestTools.GetInstance().Checksum[output]));
            //Console.WriteLine(output + "." + TestTools.ComputeSHA1(TestTools.TempFolder + output));
            File.Delete(TestTools.TempFolder + output);

            texTool.Flip(image, Orientation.Horizontal);

            texTool.CorrectGamma(image, 1 / 2.2);

            output = "TextureTool_ProcessingTest_" + rescaleFiler + "_" + format + "_" + source + extension;
            texTool.Save(image, TestTools.TempFolder + output, format, 4);
            image.Dispose();

            Assert.IsTrue(TestTools.ComputeSHA1(TestTools.TempFolder + output).Equals(TestTools.GetInstance().Checksum[output]));
            //Console.WriteLine(output + "." + TestTools.ComputeSHA1(TestTools.TempFolder + output));
            File.Delete(TestTools.TempFolder + output);

            image.Dispose();
        }