Skip to content

Commit 0830a97

Browse files
committed
Add test case for #1505
1 parent f85b686 commit 0830a97

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,21 @@ public void WuQuantizerYieldsCorrectTransparentPixel<TPixel>(TestImageProvider<T
110110
}
111111
}
112112

113+
// Test case for issue: https://github.com/SixLabors/ImageSharp/issues/1505
114+
[Theory]
115+
[WithFile(TestImages.Gif.Issues.Issue1505, PixelTypes.Rgba32)]
116+
public void Issue1505<TPixel>(TestImageProvider<TPixel> provider)
117+
where TPixel : unmanaged, IPixel<TPixel>
118+
{
119+
using (Image<TPixel> image = provider.GetImage())
120+
{
121+
var octreeQuantizer = new OctreeQuantizer();
122+
IQuantizer<TPixel> quantizer = octreeQuantizer.CreatePixelSpecificQuantizer<TPixel>(Configuration.Default, new QuantizerOptions() { MaxColors = 128 });
123+
ImageFrame<TPixel> frame = image.Frames[0];
124+
quantizer.BuildPaletteAndQuantizeFrame(frame, frame.Bounds());
125+
}
126+
}
127+
113128
private int GetTransparentIndex<TPixel>(IndexedImageFrame<TPixel> quantized)
114129
where TPixel : unmanaged, IPixel<TPixel>
115130
{

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ public static class Issues
415415
public const string BadAppExtLength = "Gif/issues/issue405_badappextlength252.gif";
416416
public const string BadAppExtLength_2 = "Gif/issues/issue405_badappextlength252-2.gif";
417417
public const string BadDescriptorWidth = "Gif/issues/issue403_baddescriptorwidth.gif";
418+
public const string Issue1505 = "Gif/issues/issue1505_argumentoutofrange.png";
418419
}
419420

420421
public static readonly string[] All = { Rings, Giphy, Cheers, Trans, Kumin, Leo, Ratio4x1, Ratio1x4 };
100 KB
Loading

0 commit comments

Comments
 (0)