Skip to content

Commit 29aa049

Browse files
committed
Add test for #2057
1 parent 555a0d7 commit 29aa049

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System;
55
using System.IO;
66
using System.Runtime.CompilerServices;
7-
using System.Text;
87
using SixLabors.ImageSharp.Formats;
98
using SixLabors.ImageSharp.Formats.Jpeg;
109
using SixLabors.ImageSharp.Metadata;

tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
namespace SixLabors.ImageSharp.Tests.Formats.Jpg
2222
{
2323
// TODO: Scatter test cases into multiple test classes
24-
[Trait("Format", "Jpg")]
24+
[Trait("Format", "Jpg")]
2525
public partial class JpegDecoderTests
2626
{
2727
public const PixelTypes CommonNonDefaultPixelTypes = PixelTypes.Rgba32 | PixelTypes.Argb32 | PixelTypes.Bgr24 | PixelTypes.RgbaVector;
@@ -65,7 +65,7 @@ private static bool SkipTest(ITestImageProvider provider)
6565

6666
private ITestOutputHelper Output { get; }
6767

68-
private static JpegDecoder JpegDecoder => new JpegDecoder();
68+
private static JpegDecoder JpegDecoder => new();
6969

7070
[Fact]
7171
public void ParseStream_BasicPropertiesAreCorrect()
@@ -213,6 +213,19 @@ public void Issue1732_DecodesWithRgbColorSpace<TPixel>(TestImageProvider<TPixel>
213213
}
214214
}
215215

216+
// https://github.com/SixLabors/ImageSharp/issues/2057
217+
[Theory]
218+
[WithFile(TestImages.Jpeg.Issues.Issue2057App1Parsing, PixelTypes.Rgba32)]
219+
public void Issue2057_DecodeWorks<TPixel>(TestImageProvider<TPixel> provider)
220+
where TPixel : unmanaged, IPixel<TPixel>
221+
{
222+
using (Image<TPixel> image = provider.GetImage(JpegDecoder))
223+
{
224+
image.DebugSave(provider);
225+
image.CompareToOriginal(provider);
226+
}
227+
}
228+
216229
// DEBUG ONLY!
217230
// The PDF.js output should be saved by "tests\ImageSharp.Tests\Formats\Jpg\pdfjs\jpeg-converter.htm"
218231
// into "\tests\Images\ActualOutput\JpegDecoderTests\"

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ public static class Issues
262262
public const string MalformedUnsupportedComponentCount = "Jpg/issues/issue-1900-malformed-unsupported-255-components.jpg";
263263
public const string MultipleApp01932 = "Jpg/issues/issue-1932-app0-resolution.jpg";
264264
public const string InvalidIptcTag = "Jpg/issues/Issue1942InvalidIptcTag.jpg";
265+
public const string Issue2057App1Parsing = "Jpg/issues/Issue2057-App1Parsing.jpg";
265266

266267
public static class Fuzz
267268
{
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)