2
2
// Licensed under the Six Labors Split License.
3
3
4
4
using System . Runtime . InteropServices ;
5
+ using SixLabors . ImageSharp . Formats . Png ;
5
6
using SixLabors . ImageSharp . Formats . Webp ;
6
7
using SixLabors . ImageSharp . Metadata ;
7
8
using SixLabors . ImageSharp . PixelFormats ;
@@ -17,14 +18,28 @@ public class WebpEncoderTests
17
18
{
18
19
private static string TestImageLossyFullPath => Path . Combine ( TestEnvironment . InputImagesDirectoryFullPath , Lossy . NoFilter06 ) ;
19
20
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 >
22
25
{
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
28
43
}
29
44
30
45
[ Theory ]
0 commit comments