Ejemplo n.º 1
0
        public void DecompressTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.DecompressTest(image, library);

            image.Dispose();
        }
Ejemplo n.º 2
0
        public void PreMultiplyAlphaTest(String file)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.PreMultiplyAlphaTest(image, library);

            image.Dispose();
        }
Ejemplo n.º 3
0
        public void GenerateMipMapTest(string file, Filter.MipMapGeneration filter)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.GenerateMipMapTest(image, library, filter);

            image.Dispose();
        }
Ejemplo n.º 4
0
        public void CompressTest(string file, Stride.Graphics.PixelFormat format)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.CompressTest(image, library, format);

            image.Dispose();
        }
Ejemplo n.º 5
0
        public void FlipTest(String file, Orientation orientation)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.FlipTest(image, library, orientation);

            image.Dispose();
        }
Ejemplo n.º 6
0
        public void FactorRescaleTest(string file, Filter.Rescaling filter)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.FactorRescaleTest(image, library, filter);

            image.Dispose();
        }
Ejemplo n.º 7
0
        public void ExportMinMipMapTest(String file, int minMipMapSize)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.ExportMinMipMapTest(image, library, minMipMapSize);

            image.Dispose();
        }
Ejemplo n.º 8
0
        public void SwitchChannelsTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.SwitchChannelsTest(image, library);

            image.Dispose();
        }
Ejemplo n.º 9
0
        public void ExportTest(String file)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.ExportTest(image, library, file);

            image.Dispose();
        }
Ejemplo n.º 10
0
        public void EndLibraryTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            library.EndLibrary(image);

            image.Dispose();
        }
Ejemplo n.º 11
0
        public void GenerateNormalMapTest(string file, string outFile)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.GenerateNormalMapTest(image, library);

            image.Dispose();
        }
Ejemplo n.º 12
0
        public void CorrectGammaTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.CorrectGammaTest(image, library);

            image.Dispose();
        }
Ejemplo n.º 13
0
        public void StartLibraryTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.StartLibraryTest(image, library);

            image.Dispose();
        }
Ejemplo n.º 14
0
        public void CanHandleRequestTest()
        {
            TexImage image = TestTools.Load(library, "Texture3D_WMipMaps_ATC_RGBA_Explicit.sd");

            Assert.False(library.CanHandleRequest(image, new DecompressingRequest(false)));
            Assert.False(library.CanHandleRequest(image, new LoadingRequest(new TexImage(), false)));
            Assert.True(library.CanHandleRequest(image, new LoadingRequest("TextureArray_WMipMaps_BC3.dds", false)));
            Assert.True(library.CanHandleRequest(image, new ExportRequest("TextureArray_WMipMaps_BC3.sd", 0)));
            Assert.True(library.CanHandleRequest(image, new ExportToStrideRequest()));
            image.Dispose();
        }
Ejemplo n.º 15
0
 public void CanHandleRequestTest()
 {
     TexImage image = TestTools.Load(dxtLib, "array_WMipMaps.dds");
     Assert.False(library.CanHandleRequest(image, new DecompressingRequest(false)));
     Assert.True(library.CanHandleRequest(image, new ArrayCreationRequest(new List<TexImage>())));
     Assert.True(library.CanHandleRequest(image, new ArrayExtractionRequest(0)));
     Assert.True(library.CanHandleRequest(image, new ArrayUpdateRequest(new TexImage(), 0)));
     Assert.True(library.CanHandleRequest(image, new ArrayElementRemovalRequest(0)));
     Assert.True(library.CanHandleRequest(image, new ArrayInsertionRequest(new TexImage(), 0)));
     Assert.True(library.CanHandleRequest(image, new CubeCreationRequest(new List<TexImage>())));
     image.Dispose();
 }
Ejemplo n.º 16
0
        public void CanHandleRequestTest()
        {
            TexImage image = TestTools.Load(library, "stones.png");

            Assert.False(library.CanHandleRequest(image, new DecompressingRequest(false)));
            Assert.True(library.CanHandleRequest(image, new FixedRescalingRequest(0, 0, Filter.Rescaling.Bilinear)));
            Assert.True(library.CanHandleRequest(image, new SwitchingBRChannelsRequest()));
            Assert.True(library.CanHandleRequest(image, new FlippingRequest(Orientation.Vertical)));
            Assert.True(library.CanHandleRequest(image, new LoadingRequest("TextureArray_WMipMaps_BC3.png", false)));
            Assert.True(library.CanHandleRequest(image, new ExportRequest("TextureArray_WMipMaps_BC3.png", 0)));
            Assert.True(library.CanHandleRequest(image, new GammaCorrectionRequest(0)));
            image.Dispose();
        }
Ejemplo n.º 17
0
        public void CanHandleRequestTest()
        {
            TexImage image = TestTools.Load(library, "TextureArray_WMipMaps_BC3.dds");

            Assert.True(library.CanHandleRequest(image, new DecompressingRequest(false)));
            Assert.True(library.CanHandleRequest(image, new FixedRescalingRequest(0, 0, Filter.Rescaling.Nearest)));
            Assert.True(library.CanHandleRequest(image, new MipMapsGenerationRequest(Filter.MipMapGeneration.Nearest)));
            Assert.True(library.CanHandleRequest(image, new NormalMapGenerationRequest(1)));
            Assert.True(library.CanHandleRequest(image, new LoadingRequest("TextureArray_WMipMaps_BC3.dds", false)));
            Assert.True(library.CanHandleRequest(image, new ExportRequest("TextureArray_WMipMaps_BC3.dds", 0)));
            Assert.True(library.CanHandleRequest(image, new CompressingRequest(Stride.Graphics.PixelFormat.BC3_UNorm)));
            Assert.False(library.CanHandleRequest(image, new GammaCorrectionRequest(0)));
            image.Dispose();
        }
Ejemplo n.º 18
0
        public void CanHandleRequestTest()
        {
            TexImage image = TestTools.Load(library, "TextureArray_WMipMaps_PVRTC2_4bpp.pvr");

            Assert.True(library.CanHandleRequest(image, new DecompressingRequest(false)));
            Assert.True(library.CanHandleRequest(image, new LoadingRequest("TextureArray_WMipMaps_PVRTC2_4bpp.pvr", false)));
            Assert.True(library.CanHandleRequest(image, new MipMapsGenerationRequest(Filter.MipMapGeneration.Linear)));
            Assert.True(library.CanHandleRequest(image, new NormalMapGenerationRequest(0.5f)));
            Assert.True(library.CanHandleRequest(image, new SwitchingBRChannelsRequest()));
            Assert.True(library.CanHandleRequest(image, new FlippingRequest(Orientation.Horizontal)));
            Assert.True(library.CanHandleRequest(image, new FixedRescalingRequest(512, 512, Filter.Rescaling.Nearest)));
            Assert.True(library.CanHandleRequest(image, new ExportRequest("TextureArray_WMipMaps_PVRTC2_4bpp.pvr", 0)));
            Assert.False(library.CanHandleRequest(image, new GammaCorrectionRequest(1)));
            image.Dispose();
        }
Ejemplo n.º 19
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();
        }
Ejemplo n.º 20
0
        public void UpdateTest(string arrayFile, int indice, string newTexture)
        {
            TexImage array = TestTools.Load(dxtLib, arrayFile);
            dxtLib.EndLibrary(array);

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

            library.Execute(array, new ArrayUpdateRequest(updateTexture, indice));
            library.EndLibrary(array);

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

            updateTexture.Dispose();
            array.Dispose();
        }
Ejemplo n.º 21
0
        public void ExportToStrideTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            ExportToStrideRequest request = new ExportToStrideRequest();

            library.Execute(image, request);

            var sd = request.XkImage;

            Assert.True(sd.TotalSizeInBytes == image.DataSize);
            Assert.True(sd.Description.MipLevels == image.MipmapCount);
            Assert.True(sd.Description.Width == image.Width);
            Assert.True(sd.Description.Height == image.Height);

            image.Dispose();
        }
Ejemplo n.º 22
0
        public void ExtractTest(string arrayFile, int indice)
        {
            TexImage array = TestTools.Load(dxtLib, arrayFile);

            var request = new ArrayExtractionRequest(indice, 16);
            library.Execute(array, request);
            array.CurrentLibrary = library;

            var extracted = request.Texture;

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

            extracted.Dispose();

            array.Dispose();
        }
Ejemplo n.º 23
0
        public void DecompressFailTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            Assert.True(image.Format == Stride.Graphics.PixelFormat.B8G8R8A8_UNorm);

            try
            {
                library.Execute(image, new DecompressingRequest(false));
                Assert.True(false);
            }
            catch (TextureToolsException)
            {
                Assert.True(true);
            }

            image.Dispose();
        }
Ejemplo n.º 24
0
        public void StartLibraryTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.StartLibraryTest(image, library);

            DxtTextureLibraryData libraryData = (DxtTextureLibraryData)image.LibraryData[library];

            Assert.True(libraryData.DxtImages.Length == image.SubImageArray.Length);
            for (int i = 0; i < libraryData.DxtImages.Length; ++i) // Checking on features
            {
                Assert.True(libraryData.DxtImages[i].RowPitch == image.SubImageArray[i].RowPitch);
            }

            image.CurrentLibrary = null; // If we don't set the CurrentLibrary to null, the Dispose() method of TexImage will try calling the EndMethod, which won't work if no operation has been made on the image since the StartLibrary call. This case can't happen.

            image.Dispose();
        }
Ejemplo n.º 25
0
        public void RemoveTest(string arrayFile, int indice)
        {
            TexImage array = TestTools.Load(dxtLib, arrayFile);

            int arraySize = array.ArraySize;

            dxtLib.EndLibrary(array);
            library.StartLibrary(array); // for fun cause it's empty
            library.Execute(array, new ArrayElementRemovalRequest(indice));
            array.CurrentLibrary = library;
            array.Update();

            Assert.True(arraySize == array.ArraySize + 1);

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

            array.Dispose();
        }
Ejemplo n.º 26
0
        public void InsertTest(string arrayFile, string newTexture, int indice)
        {
            TexImage array = TestTools.Load(dxtLib, arrayFile);

            int arraySize = array.ArraySize;

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

            dxtLib.EndLibrary(array);
            library.StartLibrary(array); // for fun cause it's empty
            library.Execute(array, new ArrayInsertionRequest(texture, indice));
            array.CurrentLibrary = library;
            array.Update();

            Assert.True(arraySize == array.ArraySize - 1);

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

            array.Dispose();
        }
Ejemplo n.º 27
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();
        }
Ejemplo n.º 28
0
        public void CanHandleRequestTest()
        {
            TexAtlas atlas = new TexAtlas(TexAtlas.TexLayout.Import(Module.PathToInputImages + Path.GetFileNameWithoutExtension("atlas_WMipMaps.dds") + TexAtlas.TexLayout.Extension), TestTools.Load(dxtLib, "atlas_WMipMaps.dds"));

            Assert.False(library.CanHandleRequest(atlas, new DecompressingRequest(false)));
            Assert.True(library.CanHandleRequest(atlas, new AtlasCreationRequest(new List <TexImage>())));
            Assert.True(library.CanHandleRequest(atlas, new AtlasExtractionRequest(0)));
            Assert.True(library.CanHandleRequest(atlas, new AtlasUpdateRequest(new TexImage(), "")));
            atlas.Dispose();
        }