Skip to content

Commit 6cb8717

Browse files
committed
Add unit test for issue #1732
1 parent 18edc46 commit 6cb8717

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,19 @@ public async Task Identify_IsCancellable()
174174
await Assert.ThrowsAsync<TaskCanceledException>(async () => await Image.IdentifyAsync(config, "someFakeFile", cts.Token));
175175
}
176176

177+
// https://github.com/SixLabors/ImageSharp/pull/1732
178+
[Theory]
179+
[WithFile(TestImages.Jpeg.Issues.WrongColorSpace, PixelTypes.Rgba32)]
180+
public void Issue1732_DecodesWithRgbColorSpace<TPixel>(TestImageProvider<TPixel> provider)
181+
where TPixel : unmanaged, IPixel<TPixel>
182+
{
183+
using (Image<TPixel> image = provider.GetImage(new JpegDecoder()))
184+
{
185+
image.DebugSave(provider);
186+
image.CompareToOriginal(provider);
187+
}
188+
}
189+
177190
// DEBUG ONLY!
178191
// The PDF.js output should be saved by "tests\ImageSharp.Tests\Formats\Jpg\pdfjs\jpeg-converter.htm"
179192
// into "\tests\Images\ActualOutput\JpegDecoderTests\"

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ public static class Issues
237237
public const string ExifResize1049 = "Jpg/issues/issue1049-exif-resize.jpg";
238238
public const string BadSubSampling1076 = "Jpg/issues/issue-1076-invalid-subsampling.jpg";
239239
public const string IdentifyMultiFrame1211 = "Jpg/issues/issue-1221-identify-multi-frame.jpg";
240+
public const string WrongColorSpace = "Jpg/issues/Issue1732-WrongColorSpace.jpg";
240241

241242
public static class Fuzz
242243
{
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)