diff --git a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs index 47983a3ade..a2a50ead2d 100644 --- a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs @@ -31,6 +31,30 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga } } + [Theory] + [WithFile(Bit15, PixelTypes.Rgba32)] + public void TgaDecoder_CanDecode_Uncompressed_15Bit(TestImageProvider provider) + where TPixel : struct, IPixel + { + using (Image image = provider.GetImage(new TgaDecoder())) + { + image.DebugSave(provider); + CompareWithReferenceDecoder(provider, image); + } + } + + [Theory] + [WithFile(Bit15Rle, PixelTypes.Rgba32)] + public void TgaDecoder_CanDecode_RunLengthEncoded_15Bit(TestImageProvider provider) + where TPixel : struct, IPixel + { + using (Image image = provider.GetImage(new TgaDecoder())) + { + image.DebugSave(provider); + CompareWithReferenceDecoder(provider, image); + } + } + [Theory] [WithFile(Bit16, PixelTypes.Rgba32)] public void TgaDecoder_CanDecode_Uncompressed_16Bit(TestImageProvider provider) @@ -43,6 +67,18 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga } } + [Theory] + [WithFile(Bit16PalRle, PixelTypes.Rgba32)] + public void TgaDecoder_CanDecode_RunLengthEncoded_WithPalette_16Bit(TestImageProvider provider) + where TPixel : struct, IPixel + { + using (Image image = provider.GetImage(new TgaDecoder())) + { + image.DebugSave(provider); + CompareWithReferenceDecoder(provider, image); + } + } + [Theory] [WithFile(Bit24, PixelTypes.Rgba32)] public void TgaDecoder_CanDecode_Uncompressed_24Bit(TestImageProvider provider) @@ -115,6 +151,30 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga } } + [Theory] + [WithFile(Bit16Pal, PixelTypes.Rgba32)] + public void TgaDecoder_CanDecode_WithPalette_16Bit(TestImageProvider provider) + where TPixel : struct, IPixel + { + using (Image image = provider.GetImage(new TgaDecoder())) + { + image.DebugSave(provider); + CompareWithReferenceDecoder(provider, image); + } + } + + [Theory] + [WithFile(Bit24Pal, PixelTypes.Rgba32)] + public void TgaDecoder_CanDecode_WithPalette_24Bit(TestImageProvider provider) + where TPixel : struct, IPixel + { + using (Image image = provider.GetImage(new TgaDecoder())) + { + image.DebugSave(provider); + CompareWithReferenceDecoder(provider, image); + } + } + private void CompareWithReferenceDecoder(TestImageProvider provider, Image image) where TPixel : struct, IPixel { diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index 51ca48c375..8499e51ebd 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -368,14 +368,19 @@ namespace SixLabors.ImageSharp.Tests public static class Tga { - public const string Bit32 = "Tga/bike_32bit.tga"; - public const string Bit24 = "Tga/bike_24bit.tga"; - public const string Bit16 = "Tga/bike_16bit.tga"; - public const string Grey = "Tga/bike_8bit.tga"; - public const string Bit32Rle = "Tga/bike_32bit_rle.tga"; - public const string Bit24Rle = "Tga/bike_24bit_rle.tga"; - public const string Bit16Rle = "Tga/bike_16bit_rle.tga"; - public const string GreyRle = "Tga/bike_8bit_rle.tga"; + public const string Bit15 = "Tga/rgb15.tga"; + public const string Bit15Rle = "Tga/rgb15rle.tga"; + public const string Bit16 = "Tga/targa_16bit.tga"; + public const string Bit16PalRle = "Tga/ccm8.tga"; + public const string Bit24 = "Tga/targa_24bit.tga"; + public const string Bit32 = "Tga/targa_32bit.tga"; + public const string Grey = "Tga/targa_8bit.tga"; + public const string GreyRle = "Tga/targa_8bit_rle.tga"; + public const string Bit16Rle = "Tga/targa_16bit_rle.tga"; + public const string Bit24Rle = "Tga/targa_24bit_rle.tga"; + public const string Bit32Rle = "Tga/targa_32bit_rle.tga"; + public const string Bit16Pal = "Tga/targa_16bit_pal.tga"; + public const string Bit24Pal = "Tga/targa_24bit_pal.tga"; } } } diff --git a/tests/Images/Input/Tga/bike_16bit.tga b/tests/Images/Input/Tga/bike_16bit.tga deleted file mode 100644 index 6fb6c3c6b5..0000000000 Binary files a/tests/Images/Input/Tga/bike_16bit.tga and /dev/null differ diff --git a/tests/Images/Input/Tga/bike_16bit_rle.tga b/tests/Images/Input/Tga/bike_16bit_rle.tga deleted file mode 100644 index 686dce9a68..0000000000 Binary files a/tests/Images/Input/Tga/bike_16bit_rle.tga and /dev/null differ diff --git a/tests/Images/Input/Tga/bike_24bit.tga b/tests/Images/Input/Tga/bike_24bit.tga deleted file mode 100644 index 3d729fc6bd..0000000000 Binary files a/tests/Images/Input/Tga/bike_24bit.tga and /dev/null differ diff --git a/tests/Images/Input/Tga/bike_24bit_rle.tga b/tests/Images/Input/Tga/bike_24bit_rle.tga deleted file mode 100644 index 350e75e87f..0000000000 Binary files a/tests/Images/Input/Tga/bike_24bit_rle.tga and /dev/null differ diff --git a/tests/Images/Input/Tga/bike_32bit.tga b/tests/Images/Input/Tga/bike_32bit.tga deleted file mode 100644 index d0439140cf..0000000000 Binary files a/tests/Images/Input/Tga/bike_32bit.tga and /dev/null differ diff --git a/tests/Images/Input/Tga/bike_32bit_rle.tga b/tests/Images/Input/Tga/bike_32bit_rle.tga deleted file mode 100644 index d199fe2cac..0000000000 Binary files a/tests/Images/Input/Tga/bike_32bit_rle.tga and /dev/null differ diff --git a/tests/Images/Input/Tga/bike_8bit.tga b/tests/Images/Input/Tga/bike_8bit.tga deleted file mode 100644 index 03a84631e4..0000000000 Binary files a/tests/Images/Input/Tga/bike_8bit.tga and /dev/null differ diff --git a/tests/Images/Input/Tga/bike_8bit_rle.tga b/tests/Images/Input/Tga/bike_8bit_rle.tga deleted file mode 100644 index add26ab9a1..0000000000 Binary files a/tests/Images/Input/Tga/bike_8bit_rle.tga and /dev/null differ diff --git a/tests/Images/Input/Tga/ccm8.tga b/tests/Images/Input/Tga/ccm8.tga new file mode 100644 index 0000000000..7a21efef7b Binary files /dev/null and b/tests/Images/Input/Tga/ccm8.tga differ diff --git a/tests/Images/Input/Tga/rgb15.tga b/tests/Images/Input/Tga/rgb15.tga new file mode 100644 index 0000000000..9506b418ae Binary files /dev/null and b/tests/Images/Input/Tga/rgb15.tga differ diff --git a/tests/Images/Input/Tga/rgb15rle.tga b/tests/Images/Input/Tga/rgb15rle.tga new file mode 100644 index 0000000000..5d4672c9cf Binary files /dev/null and b/tests/Images/Input/Tga/rgb15rle.tga differ diff --git a/tests/Images/Input/Tga/targa.png b/tests/Images/Input/Tga/targa.png new file mode 100644 index 0000000000..c18cf7e23d Binary files /dev/null and b/tests/Images/Input/Tga/targa.png differ diff --git a/tests/Images/Input/Tga/targa_16bit.tga b/tests/Images/Input/Tga/targa_16bit.tga new file mode 100644 index 0000000000..eeaf33d592 Binary files /dev/null and b/tests/Images/Input/Tga/targa_16bit.tga differ diff --git a/tests/Images/Input/Tga/targa_16bit_pal.tga b/tests/Images/Input/Tga/targa_16bit_pal.tga new file mode 100644 index 0000000000..8074ad78f5 Binary files /dev/null and b/tests/Images/Input/Tga/targa_16bit_pal.tga differ diff --git a/tests/Images/Input/Tga/targa_16bit_rle.tga b/tests/Images/Input/Tga/targa_16bit_rle.tga new file mode 100644 index 0000000000..968f4de320 Binary files /dev/null and b/tests/Images/Input/Tga/targa_16bit_rle.tga differ diff --git a/tests/Images/Input/Tga/targa_24bit.tga b/tests/Images/Input/Tga/targa_24bit.tga new file mode 100644 index 0000000000..ebe78aea5f Binary files /dev/null and b/tests/Images/Input/Tga/targa_24bit.tga differ diff --git a/tests/Images/Input/Tga/targa_24bit_pal.tga b/tests/Images/Input/Tga/targa_24bit_pal.tga new file mode 100644 index 0000000000..d97c646748 Binary files /dev/null and b/tests/Images/Input/Tga/targa_24bit_pal.tga differ diff --git a/tests/Images/Input/Tga/targa_24bit_rle.tga b/tests/Images/Input/Tga/targa_24bit_rle.tga new file mode 100644 index 0000000000..e887af750b Binary files /dev/null and b/tests/Images/Input/Tga/targa_24bit_rle.tga differ diff --git a/tests/Images/Input/Tga/targa_32bit.tga b/tests/Images/Input/Tga/targa_32bit.tga new file mode 100644 index 0000000000..7f29e022fd Binary files /dev/null and b/tests/Images/Input/Tga/targa_32bit.tga differ diff --git a/tests/Images/Input/Tga/targa_32bit_rle.tga b/tests/Images/Input/Tga/targa_32bit_rle.tga new file mode 100644 index 0000000000..c5af174b1f Binary files /dev/null and b/tests/Images/Input/Tga/targa_32bit_rle.tga differ diff --git a/tests/Images/Input/Tga/targa_8bit.tga b/tests/Images/Input/Tga/targa_8bit.tga new file mode 100644 index 0000000000..0b69052ec2 Binary files /dev/null and b/tests/Images/Input/Tga/targa_8bit.tga differ diff --git a/tests/Images/Input/Tga/targa_8bit_rle.tga b/tests/Images/Input/Tga/targa_8bit_rle.tga new file mode 100644 index 0000000000..21e9dfa3dd Binary files /dev/null and b/tests/Images/Input/Tga/targa_8bit_rle.tga differ