diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs index f3744acfdf..ae86de59af 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs @@ -48,14 +48,23 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg TestImages.Jpeg.Progressive.Festzug, TestImages.Jpeg.Progressive.Bad.BadEOF, TestImages.Jpeg.Issues.BadCoeffsProgressive178, TestImages.Jpeg.Issues.MissingFF00ProgressiveGirl159, + TestImages.Jpeg.Issues.MissingFF00ProgressiveBedroom159, TestImages.Jpeg.Issues.BadZigZagProgressive385, - TestImages.Jpeg.Progressive.Bad.ExifUndefType + TestImages.Jpeg.Progressive.Bad.ExifUndefType, + + TestImages.Jpeg.Issues.NoEoiProgressive517, + TestImages.Jpeg.Issues.BadRstProgressive518, + TestImages.Jpeg.Issues.MissingFF00ProgressiveBedroom159, }; - public static string[] FalsePositiveIssueJpegs = + /// + /// Golang decoder is unable to decode these + /// + public static string[] PdfJsOnly = { - TestImages.Jpeg.Issues.NoEOI517, - TestImages.Jpeg.Issues.BadRST518, + TestImages.Jpeg.Issues.NoEoiProgressive517, + TestImages.Jpeg.Issues.BadRstProgressive518, + TestImages.Jpeg.Issues.MissingFF00ProgressiveBedroom159 }; private static readonly Dictionary CustomToleranceValues = new Dictionary @@ -213,33 +222,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg appendPixelTypeToFileName: false); } } - - /// - /// Only can decode these images. - /// - /// The pixel format - /// The test image provider - [Theory] - [WithFileCollection(nameof(FalsePositiveIssueJpegs), PixelTypes.Rgba32)] - public void DecodeFalsePositiveJpeg_PdfJs(TestImageProvider provider) - where TPixel : struct, IPixel - { - if (TestEnvironment.RunsOnCI && !TestEnvironment.Is64BitProcess) - { - // skipping to avoid OutOfMemoryException on CI - return; - } - - using (Image image = provider.GetImage(PdfJsJpegDecoder)) - { - image.DebugSave(provider); - image.CompareToReferenceOutput( - ImageComparer.Tolerant(BaselineTolerance), - provider, - appendPixelTypeToFileName: true); - } - } - + [Theory] [WithFile(TestImages.Jpeg.Issues.CriticalEOF214, PixelTypes.Rgba32)] public void DecodeBaselineJpeg_CriticalEOF_ShouldThrow_Golang(TestImageProvider provider) @@ -271,6 +254,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg return; } + // Golang decoder is unable to decode these: + if (PdfJsOnly.Any(fn => fn.Contains(provider.SourceFileOrDescription))) + { + return; + } + // For 32 bit test enviroments: provider.Configuration.MemoryManager = ArrayPoolMemoryManager.CreateWithModeratePooling(); @@ -298,7 +287,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg // skipping to avoid OutOfMemoryException on CI return; } - + using (Image image = provider.GetImage(PdfJsJpegDecoder)) { image.DebugSave(provider); @@ -333,11 +322,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg private void CompareJpegDecodersImpl(TestImageProvider provider, string testName) where TPixel : struct, IPixel { - if (TestEnvironment.RunsOnCI) // Debug only test - { - return; - } - this.Output.WriteLine(provider.SourceFileOrDescription); provider.Utility.TestName = testName; @@ -355,7 +339,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg } } - [Theory] + [Theory(Skip = "Debug only, enable manually!")] [WithFileCollection(nameof(BaselineTestJpegs), PixelTypes.Rgba32)] public void CompareJpegDecoders_Baseline(TestImageProvider provider) where TPixel : struct, IPixel @@ -363,7 +347,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg this.CompareJpegDecodersImpl(provider, DecodeBaselineJpegOutputName); } - [Theory] + [Theory(Skip = "Debug only, enable manually!")] [WithFileCollection(nameof(ProgressiveTestJpegs), PixelTypes.Rgba32)] public void CompareJpegDecoders_Progressive(TestImageProvider provider) where TPixel : struct, IPixel diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index 166943c3a0..85f12bc808 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -130,11 +130,12 @@ namespace SixLabors.ImageSharp.Tests { public const string CriticalEOF214 = "Jpg/issues/Issue214-CriticalEOF.jpg"; public const string MissingFF00ProgressiveGirl159 = "Jpg/issues/Issue159-MissingFF00-Progressive-Girl.jpg"; + public const string MissingFF00ProgressiveBedroom159 = "Jpg/issues/Issue159-MissingFF00-Progressive-Bedroom.jpg"; public const string BadCoeffsProgressive178 = "Jpg/issues/Issue178-BadCoeffsProgressive-Lemon.jpg"; public const string BadZigZagProgressive385 = "Jpg/issues/Issue385-BadZigZag-Progressive.jpg"; public const string MultiHuffmanBaseline394 = "Jpg/issues/Issue394-MultiHuffmanBaseline-Speakers.jpg"; - public const string NoEOI517 = "Jpg/issues/Issue517-No-EOI.jpg"; - public const string BadRST518 = "Jpg/issues/Issue518-Bad-RST.jpg"; + public const string NoEoiProgressive517 = "Jpg/issues/Issue517-No-EOI-Progressive.jpg"; + public const string BadRstProgressive518 = "Jpg/issues/Issue518-Bad-RST-Progressive.jpg"; } public static readonly string[] All = Baseline.All.Concat(Progressive.All).ToArray(); diff --git a/tests/Images/Input/Jpg/issues/Issue159-MissingFF00-Progressive-Bedroom.jpg b/tests/Images/Input/Jpg/issues/Issue159-MissingFF00-Progressive-Bedroom.jpg new file mode 100644 index 0000000000..52a5832707 Binary files /dev/null and b/tests/Images/Input/Jpg/issues/Issue159-MissingFF00-Progressive-Bedroom.jpg differ diff --git a/tests/Images/Input/Jpg/issues/Issue517-No-EOI.jpg b/tests/Images/Input/Jpg/issues/Issue517-No-EOI-Progressive.jpg similarity index 100% rename from tests/Images/Input/Jpg/issues/Issue517-No-EOI.jpg rename to tests/Images/Input/Jpg/issues/Issue517-No-EOI-Progressive.jpg diff --git a/tests/Images/Input/Jpg/issues/Issue518-Bad-RST.jpg b/tests/Images/Input/Jpg/issues/Issue518-Bad-RST-Progressive.jpg similarity index 100% rename from tests/Images/Input/Jpg/issues/Issue518-Bad-RST.jpg rename to tests/Images/Input/Jpg/issues/Issue518-Bad-RST-Progressive.jpg