22// Licensed under the Six Labors Split License.
33
44using System . Runtime . InteropServices ;
5+ using SixLabors . ImageSharp . Formats . Png ;
56using SixLabors . ImageSharp . Formats . Webp ;
67using SixLabors . ImageSharp . Metadata ;
78using SixLabors . ImageSharp . PixelFormats ;
@@ -17,14 +18,28 @@ public class WebpEncoderTests
1718{
1819 private static string TestImageLossyFullPath => Path . Combine ( TestEnvironment . InputImagesDirectoryFullPath , Lossy . NoFilter06 ) ;
1920
20- [ Fact ]
21- public void Encode_AnimatedLossy ( )
21+ [ Theory ]
22+ [ WithFile ( Lossless . Animated , PixelTypes . Rgba32 ) ]
23+ public void Encode_AnimatedLossless < TPixel > ( TestImageProvider < TPixel > provider )
24+ where TPixel : unmanaged, IPixel < TPixel >
2225 {
23- Image < Rgba32 > image = Image . Load < Rgba32 > ( @"C:\WorkSpace\ImageSharp\tests\Images\Input\Webp\leo_animated_lossless.webp" ) ;
24- image . SaveAsWebp ( @"C:\Users\poker\Desktop\3.webp" , new WebpEncoder ( )
25- {
26- FileFormat = WebpFileFormatType . Lossless
27- } ) ;
26+ using Image < TPixel > image = provider . GetImage ( ) ;
27+ using MemoryStream memStream = new ( ) ;
28+ image . SaveAsWebp ( memStream , new ( ) { FileFormat = WebpFileFormatType . Lossless } ) ;
29+
30+ // TODO: DebugSave, VerifySimilarity
31+ }
32+
33+ [ Theory ]
34+ [ WithFile ( Lossy . Animated , PixelTypes . Rgba32 ) ]
35+ public void Encode_AnimatedLossy < TPixel > ( TestImageProvider < TPixel > provider )
36+ where TPixel : unmanaged, IPixel < TPixel >
37+ {
38+ using Image < TPixel > image = provider . GetImage ( ) ;
39+ using MemoryStream memStream = new ( ) ;
40+ image . SaveAsWebp ( memStream , new ( ) ) ;
41+
42+ // TODO: DebugSave, VerifySimilarity
2843 }
2944
3045 [ Theory ]
0 commit comments