@@ -448,6 +448,8 @@ public void Encode_WithPngTransparentColorBehaviorClear_Works(PngColorType color
448448
449449 [ Theory ]
450450 [ WithFile ( TestImages . Png . APng , PixelTypes . Rgba32 ) ]
451+ [ WithFile ( TestImages . Png . DefaultNotAnimated , PixelTypes . Rgba32 ) ]
452+ [ WithFile ( TestImages . Png . FrameOffset , PixelTypes . Rgba32 ) ]
451453 public void Encode_APng < TPixel > ( TestImageProvider < TPixel > provider )
452454 where TPixel : unmanaged, IPixel < TPixel >
453455 {
@@ -459,15 +461,17 @@ public void Encode_APng<TPixel>(TestImageProvider<TPixel> provider)
459461 image . DebugSave ( provider : provider , encoder : PngEncoder , null , false ) ;
460462
461463 using Image < Rgba32 > output = Image . Load < Rgba32 > ( memStream ) ;
462- ImageComparer . Exact . VerifySimilarity ( output , image ) ;
463464
464- Assert . Equal ( 5 , image . Frames . Count ) ;
465+ // some loss from original, due to compositing
466+ ImageComparer . TolerantPercentage ( 0.01f ) . VerifySimilarity ( output , image ) ;
467+
465468 Assert . Equal ( image . Frames . Count , output . Frames . Count ) ;
466469
467470 PngMetadata originalMetadata = image . Metadata . GetPngMetadata ( ) ;
468471 PngMetadata outputMetadata = output . Metadata . GetPngMetadata ( ) ;
469472
470473 Assert . Equal ( originalMetadata . RepeatCount , outputMetadata . RepeatCount ) ;
474+ Assert . Equal ( originalMetadata . DefaultImageAnimated , outputMetadata . DefaultImageAnimated ) ;
471475
472476 for ( int i = 0 ; i < image . Frames . Count ; i ++ )
473477 {
@@ -587,29 +591,6 @@ public void Encode_AnimatedFormatTransform_FromWebp<TPixel>(TestImageProvider<TP
587591 }
588592 }
589593
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-
613594 [ Theory ]
614595 [ MemberData ( nameof ( PngTrnsFiles ) ) ]
615596 public void Encode_PreserveTrns ( string imagePath , PngBitDepth pngBitDepth , PngColorType pngColorType )
0 commit comments