Skip to content

Commit 78ef6de

Browse files
committed
Add scalar version of PngDecoder_Decode_Resize test
1 parent 3541a4e commit 78ef6de

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,42 @@ public void PngDecoder_Decode_Resize<TPixel>(TestImageProvider<TPixel> provider)
132132
appendPixelTypeToFileName: false);
133133
}
134134

135+
[Theory]
136+
[WithFile(TestImages.Png.Splash, PixelTypes.Rgba32)]
137+
public void PngDecoder_Decode_Resize_ScalarResizeKernel(TestImageProvider<Rgba32> provider)
138+
{
139+
HwIntrinsics intrinsicsFilter = HwIntrinsics.DisableHWIntrinsic;
140+
141+
FeatureTestRunner.RunWithHwIntrinsicsFeature(
142+
RunTest,
143+
intrinsicsFilter,
144+
provider,
145+
string.Empty);
146+
147+
static void RunTest(string arg1, string notUsed)
148+
{
149+
TestImageProvider<Rgba32> provider =
150+
FeatureTestRunner.DeserializeForXunit<TestImageProvider<Rgba32>>(arg1);
151+
152+
DecoderOptions options = new()
153+
{
154+
TargetSize = new() { Width = 150, Height = 150 }
155+
};
156+
157+
using Image<Rgba32> image = provider.GetImage(PngDecoder.Instance, options);
158+
159+
FormattableString details = $"{options.TargetSize.Value.Width}_{options.TargetSize.Value.Height}";
160+
161+
image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false);
162+
163+
image.CompareToReferenceOutput(
164+
ImageComparer.TolerantPercentage(0.0005F),
165+
provider,
166+
testOutputDetails: details,
167+
appendPixelTypeToFileName: false);
168+
}
169+
}
170+
135171
[Theory]
136172
[WithFile(TestImages.Png.AverageFilter3BytesPerPixel, PixelTypes.Rgba32)]
137173
[WithFile(TestImages.Png.AverageFilter4BytesPerPixel, PixelTypes.Rgba32)]
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)