@@ -447,6 +447,8 @@ public void Encode_WithPngTransparentColorBehaviorClear_Works(PngColorType color
447447
448448 [ Theory ]
449449 [ WithFile ( TestImages . Png . APng , PixelTypes . Rgba32 ) ]
450+ [ WithFile ( TestImages . Png . DefaultNotAnimated , PixelTypes . Rgba32 ) ]
451+ [ WithFile ( TestImages . Png . FrameOffset , PixelTypes . Rgba32 ) ]
450452 public void Encode_APng < TPixel > ( TestImageProvider < TPixel > provider )
451453 where TPixel : unmanaged, IPixel < TPixel >
452454 {
@@ -458,15 +460,17 @@ public void Encode_APng<TPixel>(TestImageProvider<TPixel> provider)
458460 image . DebugSave ( provider : provider , encoder : PngEncoder , null , false ) ;
459461
460462 using Image < Rgba32 > output = Image . Load < Rgba32 > ( memStream ) ;
461- ImageComparer . Exact . VerifySimilarity ( output , image ) ;
462463
463- Assert . Equal ( 5 , image . Frames . Count ) ;
464+ // some loss from original, due to compositing
465+ ImageComparer . TolerantPercentage ( 0.01f ) . VerifySimilarity ( output , image ) ;
466+
464467 Assert . Equal ( image . Frames . Count , output . Frames . Count ) ;
465468
466469 PngMetadata originalMetadata = image . Metadata . GetPngMetadata ( ) ;
467470 PngMetadata outputMetadata = output . Metadata . GetPngMetadata ( ) ;
468471
469472 Assert . Equal ( originalMetadata . RepeatCount , outputMetadata . RepeatCount ) ;
473+ Assert . Equal ( originalMetadata . DefaultImageAnimated , outputMetadata . DefaultImageAnimated ) ;
470474
471475 for ( int i = 0 ; i < image . Frames . Count ; i ++ )
472476 {
@@ -586,29 +590,6 @@ public void Encode_AnimatedFormatTransform_FromWebp<TPixel>(TestImageProvider<TP
586590 }
587591 }
588592
589- [ Theory ]
590- [ WithFile ( TestImages . Png . DefaultNotAnimated , PixelTypes . Rgba32 ) ]
591- public void Encode_DefaultNotAnimated < TPixel > ( TestImageProvider < TPixel > provider )
592- where TPixel : unmanaged, IPixel < TPixel >
593- {
594- using Image < TPixel > image = provider . GetImage ( PngDecoder . Instance ) ;
595- using MemoryStream memStream = new ( ) ;
596- image . Save ( memStream , PngEncoder ) ;
597- memStream . Position = 0 ;
598-
599- image . DebugSave ( provider : provider , encoder : PngEncoder , null , false ) ;
600-
601- using Image < Rgba32 > output = Image . Load < Rgba32 > ( memStream ) ;
602- ImageComparer . Exact . VerifySimilarity ( output , image ) ;
603-
604- Assert . Equal ( 2 , image . Frames . Count ) ;
605- Assert . Equal ( image . Frames . Count , output . Frames . Count ) ;
606-
607- PngMetadata originalMetadata = image . Metadata . GetPngMetadata ( ) ;
608- PngMetadata outputMetadata = output . Metadata . GetPngMetadata ( ) ;
609- Assert . Equal ( originalMetadata . DefaultImageAnimated , outputMetadata . DefaultImageAnimated ) ;
610- }
611-
612593 [ Theory ]
613594 [ MemberData ( nameof ( PngTrnsFiles ) ) ]
614595 public void Encode_PreserveTrns ( string imagePath , PngBitDepth pngBitDepth , PngColorType pngColorType )
0 commit comments