Browse Source

Add more tga test cases for paletted rle images

pull/1165/head
Brian Popow 6 years ago
parent
commit
96fc00d28f
  1. 97
      tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs
  2. 10
      tests/ImageSharp.Tests/TestImages.cs
  3. BIN
      tests/Images/Input/Tga/indexed_a_rle_LL.tga
  4. BIN
      tests/Images/Input/Tga/indexed_a_rle_LR.tga
  5. BIN
      tests/Images/Input/Tga/indexed_a_rle_UL.tga
  6. BIN
      tests/Images/Input/Tga/indexed_a_rle_UR.tga
  7. BIN
      tests/Images/Input/Tga/indexed_rle_LL.tga
  8. BIN
      tests/Images/Input/Tga/indexed_rle_LR.tga
  9. BIN
      tests/Images/Input/Tga/indexed_rle_UL.tga
  10. BIN
      tests/Images/Input/Tga/indexed_rle_UR.tga

97
tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs

@ -6,6 +6,7 @@ using Microsoft.DotNet.RemoteExecutor;
using SixLabors.ImageSharp.Formats.Tga;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
using Xunit;
@ -499,6 +500,54 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga
}
}
[Theory]
[WithFile(Bit32PalRleTopLeft, PixelTypes.Rgba32)]
public void TgaDecoder_CanDecode_RLE_Paletted_WithTopLeftOrigin_32Bit<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage(TgaDecoder))
{
image.DebugSave(provider);
TgaTestUtils.CompareWithReferenceDecoder(provider, image);
}
}
[Theory]
[WithFile(Bit32PalRleBottomLeft, PixelTypes.Rgba32)]
public void TgaDecoder_CanDecode_RLE_Paletted_WithBottomLeftOrigin_32Bit<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage(TgaDecoder))
{
image.DebugSave(provider);
TgaTestUtils.CompareWithReferenceDecoder(provider, image);
}
}
[Theory]
[WithFile(Bit32PalRleTopRight, PixelTypes.Rgba32)]
public void TgaDecoder_CanDecode_RLE_WithTopRightOrigin_32Bit<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage(TgaDecoder))
{
image.DebugSave(provider);
TgaTestUtils.CompareWithReferenceDecoder(provider, image);
}
}
[Theory]
[WithFile(Bit32PalRleBottomRight, PixelTypes.Rgba32)]
public void TgaDecoder_CanDecode_RLE_Paletted_WithBottomRightOrigin_32Bit<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage(TgaDecoder))
{
image.DebugSave(provider);
TgaTestUtils.CompareWithReferenceDecoder(provider, image);
}
}
[Theory]
[WithFile(Bit16PalBottomLeft, PixelTypes.Rgba32)]
public void TgaDecoder_CanDecode_WithPaletteBottomLeftOrigin_16Bit<TPixel>(TestImageProvider<TPixel> provider)
@ -559,6 +608,54 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga
}
}
[Theory]
[WithFile(Bit24PalRleTopLeft, PixelTypes.Rgba32)]
public void TgaDecoder_CanDecode_RLE_WithPaletteTopLeftOrigin_24Bit<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage(TgaDecoder))
{
image.DebugSave(provider);
TgaTestUtils.CompareWithReferenceDecoder(provider, image);
}
}
[Theory]
[WithFile(Bit24PalRleTopRight, PixelTypes.Rgba32)]
public void TgaDecoder_CanDecode_RLE_WithPaletteTopRightOrigin_24Bit<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage(TgaDecoder))
{
image.DebugSave(provider);
TgaTestUtils.CompareWithReferenceDecoder(provider, image);
}
}
[Theory]
[WithFile(Bit24PalRleBottomLeft, PixelTypes.Rgba32)]
public void TgaDecoder_CanDecode_RLE_WithPaletteBottomLeftOrigin_24Bit<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage(TgaDecoder))
{
image.DebugSave(provider);
TgaTestUtils.CompareWithReferenceDecoder(provider, image);
}
}
[Theory]
[WithFile(Bit24PalRleBottomRight, PixelTypes.Rgba32)]
public void TgaDecoder_CanDecode_RLE_WithPaletteBottomRightOrigin_24Bit<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage(TgaDecoder))
{
image.DebugSave(provider);
TgaTestUtils.CompareWithReferenceDecoder(provider, image);
}
}
[Theory]
[WithFile(Bit32PalTopLeft, PixelTypes.Rgba32)]
public void TgaDecoder_CanDecode_WithPalette_32Bit<TPixel>(TestImageProvider<TPixel> provider)

10
tests/ImageSharp.Tests/TestImages.cs

@ -417,6 +417,11 @@ namespace SixLabors.ImageSharp.Tests
public const string Bit24PalBottomLeft = "Tga/targa_24bit_pal.tga";
public const string Bit24PalBottomRight = "Tga/indexed_LR.tga";
public const string Bit24PalRleTopLeft = "Tga/indexed_rle_UL.tga";
public const string Bit24PalRleBottomLeft = "Tga/indexed_rle_LL.tga";
public const string Bit24PalRleTopRight = "Tga/indexed_rle_UR.tga";
public const string Bit24PalRleBottomRight = "Tga/indexed_rle_LR.tga";
public const string Bit32TopLeft = "Tga/rgb_a_UL.tga";
public const string Bit32BottomLeft = "Tga/targa_32bit.tga";
public const string Bit32TopRight = "Tga/rgb_a_UR.tga";
@ -432,6 +437,11 @@ namespace SixLabors.ImageSharp.Tests
public const string Bit32RleBottomRight = "Tga/rgb_a_rle_LR.tga";
public const string Bit32RleBottomLeft = "Tga/targa_32bit_rle.tga";
public const string Bit32PalRleTopLeft = "Tga/indexed_a_rle_UL.tga";
public const string Bit32PalRleBottomLeft = "Tga/indexed_a_rle_LL.tga";
public const string Bit32PalRleTopRight = "Tga/indexed_a_rle_UR.tga";
public const string Bit32PalRleBottomRight = "Tga/indexed_a_rle_LR.tga";
public const string NoAlphaBits16Bit = "Tga/16bit_noalphabits.tga";
public const string NoAlphaBits16BitRle = "Tga/16bit_rle_noalphabits.tga";
public const string NoAlphaBits32Bit = "Tga/32bit_no_alphabits.tga";

BIN
tests/Images/Input/Tga/indexed_a_rle_LL.tga

Binary file not shown.

BIN
tests/Images/Input/Tga/indexed_a_rle_LR.tga

Binary file not shown.

BIN
tests/Images/Input/Tga/indexed_a_rle_UL.tga

Binary file not shown.

BIN
tests/Images/Input/Tga/indexed_a_rle_UR.tga

Binary file not shown.

BIN
tests/Images/Input/Tga/indexed_rle_LL.tga

Binary file not shown.

BIN
tests/Images/Input/Tga/indexed_rle_LR.tga

Binary file not shown.

BIN
tests/Images/Input/Tga/indexed_rle_UL.tga

Binary file not shown.

BIN
tests/Images/Input/Tga/indexed_rle_UR.tga

Binary file not shown.
Loading…
Cancel
Save