From 19ebfbdf5c09b3a4de48aff26dec733df9d8e98f Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Fri, 27 Mar 2020 16:49:04 +0100 Subject: [PATCH] Split tga alpha bits tests in 16 bit and 32 bit tests --- .../Formats/Tga/TgaDecoderTests.cs | 20 +++++++++++++++--- tests/ImageSharp.Tests/TestImages.cs | 2 +- tests/Images/External | 2 +- ...noalphabits.tga => 32bit_no_alphabits.tga} | Bin 4 files changed, 19 insertions(+), 5 deletions(-) rename tests/Images/Input/Tga/{32bit_noalphabits.tga => 32bit_no_alphabits.tga} (100%) diff --git a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs index ec2621e65..767b3b954 100644 --- a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs @@ -7,6 +7,7 @@ using SixLabors.ImageSharp.Formats.Tga; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Tests.TestUtilities; +using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using Xunit; // ReSharper disable InconsistentNaming @@ -199,11 +200,9 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga } [Theory] - [WithFile(NoAlphaBits32Bit, PixelTypes.Rgba32)] [WithFile(NoAlphaBits16Bit, PixelTypes.Rgba32)] - [WithFile(NoAlphaBits32BitRle, PixelTypes.Rgba32)] [WithFile(NoAlphaBits16BitRle, PixelTypes.Rgba32)] - public void TgaDecoder_CanDecode_WhenAlphaBitsNotSet(TestImageProvider provider) + public void TgaDecoder_CanDecode_WhenAlphaBitsNotSet_16Bit(TestImageProvider provider) where TPixel : unmanaged, IPixel { using (Image image = provider.GetImage(TgaDecoder)) @@ -213,6 +212,21 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga } } + [Theory] + [WithFile(NoAlphaBits32Bit, PixelTypes.Rgba32)] + [WithFile(NoAlphaBits32BitRle, PixelTypes.Rgba32)] + public void TgaDecoder_CanDecode_WhenAlphaBitsNotSet(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using (Image image = provider.GetImage(TgaDecoder)) + { + // Using here the reference output instead of the the reference decoder, + // because the reference decoder does not ignore the alpha data here. + image.DebugSave(provider); + image.CompareToReferenceOutput(ImageComparer.Exact, provider); + } + } + [Theory] [WithFile(Bit16, PixelTypes.Rgba32)] [WithFile(Bit24, PixelTypes.Rgba32)] diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index db4c9a448..3e2f4aa6f 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -392,7 +392,7 @@ namespace SixLabors.ImageSharp.Tests public const string Bit24Pal = "Tga/targa_24bit_pal.tga"; public const string NoAlphaBits16Bit = "Tga/16bit_noalphabits.tga"; public const string NoAlphaBits16BitRle = "Tga/16bit_rle_noalphabits.tga"; - public const string NoAlphaBits32Bit = "Tga/32bit_noalphabits.tga"; + public const string NoAlphaBits32Bit = "Tga/32bit_no_alphabits.tga"; public const string NoAlphaBits32BitRle = "Tga/32bit_rle_no_alphabits.tga"; } } diff --git a/tests/Images/External b/tests/Images/External index d80955193..985e050aa 160000 --- a/tests/Images/External +++ b/tests/Images/External @@ -1 +1 @@ -Subproject commit d809551931858cd3873bad49d2fe915fddff7a26 +Subproject commit 985e050aa7ac11830ae7a178ca2283f8b6307e4c diff --git a/tests/Images/Input/Tga/32bit_noalphabits.tga b/tests/Images/Input/Tga/32bit_no_alphabits.tga similarity index 100% rename from tests/Images/Input/Tga/32bit_noalphabits.tga rename to tests/Images/Input/Tga/32bit_no_alphabits.tga