@@ -448,6 +448,8 @@ public void Encode_WithPngTransparentColorBehaviorClear_Works(PngColorType color
448
448
449
449
[ Theory ]
450
450
[ WithFile ( TestImages . Png . APng , PixelTypes . Rgba32 ) ]
451
+ [ WithFile ( TestImages . Png . DefaultNotAnimated , PixelTypes . Rgba32 ) ]
452
+ [ WithFile ( TestImages . Png . FrameOffset , PixelTypes . Rgba32 ) ]
451
453
public void Encode_APng < TPixel > ( TestImageProvider < TPixel > provider )
452
454
where TPixel : unmanaged, IPixel < TPixel >
453
455
{
@@ -459,15 +461,17 @@ public void Encode_APng<TPixel>(TestImageProvider<TPixel> provider)
459
461
image . DebugSave ( provider : provider , encoder : PngEncoder , null , false ) ;
460
462
461
463
using Image < Rgba32 > output = Image . Load < Rgba32 > ( memStream ) ;
462
- ImageComparer . Exact . VerifySimilarity ( output , image ) ;
463
464
464
- Assert . Equal ( 5 , image . Frames . Count ) ;
465
+ // some loss from original, due to compositing
466
+ ImageComparer . TolerantPercentage ( 0.01f ) . VerifySimilarity ( output , image ) ;
467
+
465
468
Assert . Equal ( image . Frames . Count , output . Frames . Count ) ;
466
469
467
470
PngMetadata originalMetadata = image . Metadata . GetPngMetadata ( ) ;
468
471
PngMetadata outputMetadata = output . Metadata . GetPngMetadata ( ) ;
469
472
470
473
Assert . Equal ( originalMetadata . RepeatCount , outputMetadata . RepeatCount ) ;
474
+ Assert . Equal ( originalMetadata . DefaultImageAnimated , outputMetadata . DefaultImageAnimated ) ;
471
475
472
476
for ( int i = 0 ; i < image . Frames . Count ; i ++ )
473
477
{
@@ -587,29 +591,6 @@ public void Encode_AnimatedFormatTransform_FromWebp<TPixel>(TestImageProvider<TP
587
591
}
588
592
}
589
593
590
- [ Theory ]
591
- [ WithFile ( TestImages . Png . DefaultNotAnimated , PixelTypes . Rgba32 ) ]
592
- public void Encode_DefaultNotAnimated < TPixel > ( TestImageProvider < TPixel > provider )
593
- where TPixel : unmanaged, IPixel < TPixel >
594
- {
595
- using Image < TPixel > image = provider . GetImage ( PngDecoder . Instance ) ;
596
- using MemoryStream memStream = new ( ) ;
597
- image . Save ( memStream , PngEncoder ) ;
598
- memStream . Position = 0 ;
599
-
600
- image . DebugSave ( provider : provider , encoder : PngEncoder , null , false ) ;
601
-
602
- using Image < Rgba32 > output = Image . Load < Rgba32 > ( memStream ) ;
603
- ImageComparer . Exact . VerifySimilarity ( output , image ) ;
604
-
605
- Assert . Equal ( 2 , image . Frames . Count ) ;
606
- Assert . Equal ( image . Frames . Count , output . Frames . Count ) ;
607
-
608
- PngMetadata originalMetadata = image . Metadata . GetPngMetadata ( ) ;
609
- PngMetadata outputMetadata = output . Metadata . GetPngMetadata ( ) ;
610
- Assert . Equal ( originalMetadata . DefaultImageAnimated , outputMetadata . DefaultImageAnimated ) ;
611
- }
612
-
613
594
[ Theory ]
614
595
[ MemberData ( nameof ( PngTrnsFiles ) ) ]
615
596
public void Encode_PreserveTrns ( string imagePath , PngBitDepth pngBitDepth , PngColorType pngColorType )
0 commit comments