示例#1
0
        public static void CorrectGammaTest(TexImage image, ITexLibrary library)
        {
            library.Execute(image, new GammaCorrectionRequest(1 / 2.2));

            //Console.WriteLine("CorrectGammaTest_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
            Assert.Equal(TestTools.GetInstance().Checksum["CorrectGammaTest_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
        }
示例#2
0
        public static void PreMultiplyAlphaTest(TexImage image, ITexLibrary library)
        {
            library.Execute(image, new PreMultiplyAlphaRequest());

            //Console.WriteLine("PreMultiplyAlphaTest_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
            Assert.Equal(TestTools.GetInstance().Checksum["PreMultiplyAlphaTest_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
        }
示例#3
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));
        }
示例#4
0
        public static void ExportMinMipMapTest(TexImage image, ITexLibrary library, int minMipMapSize)
        {
            String outputFile = library.GetType().Name + "_ExportTest_MinMipMapSize-" + minMipMapSize + "_" + image.Name;

            library.Execute(image, new ExportRequest(Module.PathToOutputImages + outputFile, minMipMapSize));

            TexImage image2 = new TexImage();

            library.Execute(image2, new LoadingRequest(Module.PathToOutputImages + outputFile, false));
            image2.CurrentLibrary = library;

            image.Update();
            image2.Update();

            Assert.True(image.Dimension == image2.Dimension);
            Assert.True(image2.SubImageArray[image2.SubImageArray.Length - 1].Width >= minMipMapSize);
            Assert.True(image2.SubImageArray[image2.SubImageArray.Length - 1].Height >= minMipMapSize);
            Assert.True(image.Width == image2.Width);
            Assert.True(image.Height == image2.Height);
            Assert.True(image.Depth == image2.Depth);
            Assert.True(image.ArraySize == image2.ArraySize);


            //Console.WriteLine("ExportMinMipMapTest_" + minMipMapSize + "_" + image.Name + "." + TestTools.ComputeSHA1(Module.PathToOutputImages + outputFile));
            Assert.Equal(TestTools.GetInstance().Checksum["ExportMinMipMapTest_" + minMipMapSize + "_" + image.Name], TestTools.ComputeSHA1(Module.PathToOutputImages + outputFile));
            File.Delete(Module.PathToOutputImages + outputFile);

            image2.Dispose();
        }
示例#5
0
        public static void FlipTest(TexImage image, ITexLibrary library, Orientation orientation)
        {
            library.Execute(image, new FlippingRequest(orientation));

            Assert.IsTrue(TestTools.ComputeSHA1(image.Data, image.DataSize).Equals(TestTools.GetInstance().Checksum["FlipTest_" + orientation + "_" + image.Name]));
            //Console.WriteLine("FlipTest_" + orientation + "_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
        }
示例#6
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));
 }
示例#7
0
 public static TexImage Load(ITexLibrary library, string file)
 {
     var image = new TexImage();
     library.Execute(image, new LoadingRequest(InputTestFolder + file, false));
     image.Name = file;
     image.CurrentLibrary = library;
     return image;
 }
示例#8
0
 public static void DecompressTest(TexImage image, ITexLibrary library)
 {
     Assert.IsTrue(image.Format.IsCompressed());
     library.Execute(image, new DecompressingRequest(false));
     Assert.IsTrue(image.Format == PixelFormat.R8G8B8A8_UNorm);
     Assert.IsTrue(TestTools.ComputeSHA1(image.Data, image.DataSize).Equals(TestTools.GetInstance().Checksum["DecompressTest_" + image.Name]));
     //Console.WriteLine("DecompressTest_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
 }
示例#9
0
        public static void SwitchChannelsTest(TexImage image, ITexLibrary library)
        {
            var isInRgbaOrder = image.Format.IsRGBAOrder();
            library.Execute(image, new SwitchingBRChannelsRequest());
            Assert.IsTrue(image.Format.IsRGBAOrder() != isInRgbaOrder);

            //Console.WriteLine("SwitchChannelsTest_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
            Assert.IsTrue(TestTools.ComputeSHA1(image.Data, image.DataSize).Equals(TestTools.GetInstance().Checksum["SwitchChannelsTest_" + image.Name]));
        }
示例#10
0
        public static TexImage Load(ITexLibrary library, string file)
        {
            var image = new TexImage();

            library.Execute(image, new LoadingRequest(InputTestFolder + file));
            image.Name           = file;
            image.CurrentLibrary = library;
            return(image);
        }
示例#11
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));
        }
示例#12
0
        private TexImage Load(ITexLibrary library, string filePath)
        {
            var image = new TexImage();

            library.Execute(image, new LoadingRequest(filePath, false));
            image.Name           = Path.GetFileName(filePath);
            image.CurrentLibrary = library;
            return(image);
        }
示例#13
0
        public static TexImage Load(ITexLibrary library, string file)
        {
            var image = new TexImage();

            library.Execute(image, new LoadingRequest(Module.PathToInputImages + file, false));
            image.Name           = file;
            image.CurrentLibrary = library;
            return(image);
        }
示例#14
0
        /// <summary>
        /// The purpose of this test is to show that after calling the StartLibrary method on a TexImage,
        /// this image will contain in its LibraryData list the ITextureLibraryData instance corresponding
        /// to the actual state of the TexImage.
        /// An instance of ITextureLibraryData is creating at the load of the TexImage by the library so we
        /// must delete it first for the sake of this test.
        /// </summary>
        public static void StartLibraryTest(TexImage image, ITexLibrary library)
        {
            image.LibraryData.Remove(library); // deleting the LibraryData instance

            Assert.IsFalse(image.LibraryData.ContainsKey(library));

            library.StartLibrary(image);

            Assert.IsTrue(image.LibraryData.ContainsKey(library));
        }
示例#15
0
        public static void DecompressTest(TexImage image, ITexLibrary library)
        {
            Assert.IsTrue(Tools.IsCompressed(image.Format));
            int dataSize = image.DataSize;

            library.Execute(image, new DecompressingRequest());
            Assert.IsTrue(image.Format == SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm);
            Assert.IsTrue(TestTools.ComputeSHA1(image.Data, image.DataSize).Equals(TestTools.GetInstance().Checksum["DecompressTest_" + image.Name]));
            //Console.WriteLine("DecompressTest_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
        }
示例#16
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));
        }
示例#17
0
        /// <summary>
        /// The purpose of this test is to show that after calling the StartLibrary method on a TexImage,
        /// this image will contain in its LibraryData list the ITextureLibraryData instance corresponding
        /// to the actual state of the TexImage.
        /// An instance of ITextureLibraryData is creating at the load of the TexImage by the library so we
        /// must delete it first for the sake of this test.
        /// </summary>
        public static void StartLibraryTest(TexImage image, ITexLibrary library)
        {
            image.LibraryData.Remove(library); // deleting the LibraryData instance

            Assert.False(image.LibraryData.ContainsKey(library));

            library.StartLibrary(image);

            Assert.True(image.LibraryData.ContainsKey(library));
        }
示例#18
0
        public static void ExportTest(TexImage image, ITexLibrary library, string file)
        {
            String outputFile = library.GetType().Name + "_ExportTest_" + file;

            library.Execute(image, new ExportRequest(Module.PathToOutputImages + outputFile, 0));

            //Console.WriteLine("ExportTest_" + file + "." + TestTools.ComputeSHA1(Module.PathToOutputImages + outputFile));
            Assert.Equal(TestTools.GetInstance().Checksum["ExportTest_" + file], TestTools.ComputeSHA1(Module.PathToOutputImages + outputFile));
            File.Delete(Module.PathToOutputImages + outputFile);
        }
示例#19
0
        public static void ExportTest(TexImage image, ITexLibrary library, string file)
        {
            String outputFile = library.GetType().Name + "_ExportTest_" + file;

            library.Execute(image, new ExportRequest(TestTools.TempFolder + outputFile, 0));

            //Console.WriteLine("ExportTest_" + file + "." + TestTools.ComputeSHA1(TestTools.TempFolder + outputFile));
            Assert.IsTrue(TestTools.ComputeSHA1(TestTools.TempFolder + outputFile).Equals(TestTools.GetInstance().Checksum["ExportTest_" + file]));
            File.Delete(TestTools.TempFolder + outputFile);
        }
示例#20
0
        public static void GenerateNormalMapTest(TexImage image, ITexLibrary library)
        {
            library.Execute(image, new DecompressingRequest(false));
            var request = new NormalMapGenerationRequest(1);

            library.Execute(image, request);

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

            request.NormalMap.Dispose();
        }
示例#21
0
 public static void GenerateMipMapTest(TexImage image, ITexLibrary library, Filter.MipMapGeneration filter)
 {
     Assert.True(image.MipmapCount == 1);
     if (image.Format.IsCompressed())
     {
         library.Execute(image, new DecompressingRequest(false));
     }
     library.Execute(image, new MipMapsGenerationRequest(filter));
     Assert.True(image.MipmapCount > 1);
     Assert.Equal(TestTools.GetInstance().Checksum["GenerateMipMapTest_" + filter + "_" + image.Name], TestTools.ComputeSHA1(image.Data, image.DataSize));
     //Console.WriteLine("GenerateMipMapTest_" + filter + "_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
 }
示例#22
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));
        }
示例#23
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.IsTrue(image.Width == width);
            Assert.IsTrue(image.Height == height);
            Assert.IsTrue(image.MipmapCount == 1);

            image.Update();

            Assert.IsTrue(TestTools.ComputeSHA1(image.Data, image.DataSize).Equals(TestTools.GetInstance().Checksum["FixedRescaleTest_" + filter + "_" + image.Name]));
            //Console.WriteLine("FixedRescaleTest_" + filter + "_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
        }
示例#24
0
 private TexImage Load(ITexLibrary library, string filePath)
 {
     var image = new TexImage();
     library.Execute(image, new LoadingRequest(filePath, false));
     image.Name = Path.GetFileName(filePath);
     image.CurrentLibrary = library;
     return image;
 }
示例#25
0
 public static void GenerateMipMapTest(TexImage image, ITexLibrary library, Filter.MipMapGeneration filter)
 {
     Assert.IsTrue(image.MipmapCount == 1);
     if (image.Format.IsCompressed()) library.Execute(image, new DecompressingRequest(false));
     library.Execute(image, new MipMapsGenerationRequest(filter));
     Assert.IsTrue(image.MipmapCount > 1);
     Assert.IsTrue(TestTools.ComputeSHA1(image.Data, image.DataSize).Equals(TestTools.GetInstance().Checksum["GenerateMipMapTest_" + filter + "_" + image.Name]));
     //Console.WriteLine("GenerateMipMapTest_" + filter + "_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
 }
示例#26
0
        public static void GenerateNormalMapTest(TexImage image, ITexLibrary library)
        {
            library.Execute(image, new DecompressingRequest(false));
            var request = new NormalMapGenerationRequest(1);
            library.Execute(image, request);

            Assert.IsTrue(TestTools.ComputeSHA1(request.NormalMap.Data, request.NormalMap.DataSize).Equals(TestTools.GetInstance().Checksum["GenerateNormalMapTest_" + image.Name]));
            //Console.WriteLine("GenerateNormalMapTest_" + image.Name + "." + TestTools.ComputeSHA1(request.NormalMap.Data, request.NormalMap.DataSize));

            request.NormalMap.Dispose();
        }
示例#27
0
        public static void ExportTest(TexImage image, ITexLibrary library, string file)
        {
            String outputFile = library.GetType().Name + "_ExportTest_" + file;
            library.Execute(image, new ExportRequest(Module.PathToOutputImages + outputFile, 0));

            //Console.WriteLine("ExportTest_" + file + "." + TestTools.ComputeSHA1(Module.PathToOutputImages + outputFile));
            Assert.IsTrue(TestTools.ComputeSHA1(Module.PathToOutputImages + outputFile).Equals(TestTools.GetInstance().Checksum["ExportTest_" + file]));
            File.Delete(Module.PathToOutputImages + outputFile);
        }
示例#28
0
        public static void PreMultiplyAlphaTest(TexImage image, ITexLibrary library)
        {
            library.Execute(image, new PreMultiplyAlphaRequest());

            //Console.WriteLine("PreMultiplyAlphaTest_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
            Assert.IsTrue(TestTools.ComputeSHA1(image.Data, image.DataSize).Equals(TestTools.GetInstance().Checksum["PreMultiplyAlphaTest_" + image.Name]));
        }
示例#29
0
        public static void CorrectGammaTest(TexImage image, ITexLibrary library)
        {
            library.Execute(image, new GammaCorrectionRequest(1 / 2.2));

            //Console.WriteLine("CorrectGammaTest_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
            Assert.IsTrue(TestTools.ComputeSHA1(image.Data, image.DataSize).Equals(TestTools.GetInstance().Checksum["CorrectGammaTest_" + image.Name]));
        }
示例#30
0
        public static void ExportMinMipMapTest(TexImage image, ITexLibrary library, int minMipMapSize)
        {
            String outputFile = library.GetType().Name + "_ExportTest_MinMipMapSize-" + minMipMapSize + "_" + image.Name;
            library.Execute(image, new ExportRequest(Module.PathToOutputImages + outputFile, minMipMapSize));

            TexImage image2 = new TexImage();
            library.Execute(image2, new LoadingRequest(Module.PathToOutputImages + outputFile, false));
            image2.CurrentLibrary = library;

            image.Update();
            image2.Update();

            Assert.IsTrue(image.Dimension == image2.Dimension);
            Assert.IsTrue(image2.SubImageArray[image2.SubImageArray.Length - 1].Width >= minMipMapSize);
            Assert.IsTrue(image2.SubImageArray[image2.SubImageArray.Length - 1].Height >= minMipMapSize);
            Assert.IsTrue(image.Width == image2.Width);
            Assert.IsTrue(image.Height == image2.Height);
            Assert.IsTrue(image.Depth == image2.Depth);
            Assert.IsTrue(image.ArraySize == image2.ArraySize);


            //Console.WriteLine("ExportMinMipMapTest_" + minMipMapSize + "_" + image.Name + "." + TestTools.ComputeSHA1(Module.PathToOutputImages + outputFile));
            Assert.IsTrue(TestTools.ComputeSHA1(Module.PathToOutputImages + outputFile).Equals(TestTools.GetInstance().Checksum["ExportMinMipMapTest_" + minMipMapSize + "_" + image.Name]));
            File.Delete(Module.PathToOutputImages + outputFile);

            image2.Dispose();
        }
示例#31
0
        public static void CompressTest(TexImage image, ITexLibrary library, PixelFormat format)
        {
            Assert.IsTrue(!image.Format.IsCompressed());
            library.Execute(image, new CompressingRequest(format));

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