-
-
Notifications
You must be signed in to change notification settings - Fork 840
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,18 @@ public partial class PngDecoderTests | |
{ TestImages.Png.Rgba64Bpp, typeof(Image<Rgba64>) }, | ||
}; | ||
|
||
public static readonly string[] MultiFrameTestFiles = | ||
{ | ||
//TestImages.Png.APng, | ||
Check warning on line 83 in tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs GitHub Actions / Build (false, ubuntu-latest, net6.0, 6.0.x, -x64, false)
Check warning on line 83 in tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs GitHub Actions / Build (false, windows-latest, net6.0, 6.0.x, -x64, false)
Check warning on line 83 in tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs GitHub Actions / Build (false, windows-latest, net7.0, 7.0.x, true, -x64, false)
|
||
//TestImages.Png.SplitIDatZeroLength, | ||
Check warning on line 84 in tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs GitHub Actions / Build (false, ubuntu-latest, net6.0, 6.0.x, -x64, false)
Check warning on line 84 in tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs GitHub Actions / Build (false, windows-latest, net6.0, 6.0.x, -x64, false)
Check warning on line 84 in tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs GitHub Actions / Build (false, windows-latest, net7.0, 7.0.x, true, -x64, false)
|
||
//TestImages.Png.DisposeNone, | ||
Check warning on line 85 in tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs GitHub Actions / Build (false, ubuntu-latest, net6.0, 6.0.x, -x64, false)
|
||
//TestImages.Png.DisposeBackground, | ||
Check warning on line 86 in tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs GitHub Actions / Build (false, ubuntu-latest, net6.0, 6.0.x, -x64, false)
|
||
//TestImages.Png.DisposeBackgroundRegion, | ||
Check warning on line 87 in tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs GitHub Actions / Build (false, ubuntu-latest, net6.0, 6.0.x, -x64, false)
|
||
//TestImages.Png.DisposePreviousFirst, | ||
//TestImages.Png.DisposeBackgroundBeforeRegion, | ||
TestImages.Png.BlendOverMultiple | ||
}; | ||
|
||
[Theory] | ||
[MemberData(nameof(PixelFormatRange))] | ||
public void Decode_NonGeneric_CreatesCorrectImageType(string path, Type type) | ||
|
@@ -107,16 +119,16 @@ public void Decode<TPixel>(TestImageProvider<TPixel> provider) | |
} | ||
|
||
[Theory] | ||
[WithFile(TestImages.Png.APng, PixelTypes.Rgba32)] | ||
public void Decode_APng<TPixel>(TestImageProvider<TPixel> provider) | ||
where TPixel : unmanaged, IPixel<TPixel> | ||
[WithFileCollection(nameof(MultiFrameTestFiles), PixelTypes.Rgba32)] | ||
public void Decode_VerifyAllFrames<TPixel>(TestImageProvider<TPixel> provider) | ||
where TPixel : unmanaged, IPixel<TPixel> | ||
{ | ||
using Image<TPixel> image = provider.GetImage(PngDecoder.Instance); | ||
|
||
Assert.Equal(5, image.Frames.Count); | ||
|
||
// TODO: Assertations. | ||
// MagickReferenceDecoder cannot decode APNGs (Though ImageMagick can, we likely need to update our mapping implementation) | ||
// Some images have many frames, only compare a selection of them. | ||
static bool Predicate(int i, int _) => i <= 8 || i % 8 == 0; | ||
image.DebugSaveMultiFrame(provider, predicate: Predicate); | ||
image.CompareToReferenceOutputMultiFrame(provider, ImageComparer.Exact, predicate: Predicate); | ||
} | ||
|
||
[Theory] | ||
|