@@ -447,6 +447,8 @@ public void Encode_WithPngTransparentColorBehaviorClear_Works(PngColorType color
447
447
448
448
[ Theory ]
449
449
[ WithFile ( TestImages . Png . APng , PixelTypes . Rgba32 ) ]
450
+ [ WithFile ( TestImages . Png . DefaultNotAnimated , PixelTypes . Rgba32 ) ]
451
+ [ WithFile ( TestImages . Png . FrameOffset , PixelTypes . Rgba32 ) ]
450
452
public void Encode_APng < TPixel > ( TestImageProvider < TPixel > provider )
451
453
where TPixel : unmanaged, IPixel < TPixel >
452
454
{
@@ -458,15 +460,17 @@ public void Encode_APng<TPixel>(TestImageProvider<TPixel> provider)
458
460
image . DebugSave ( provider : provider , encoder : PngEncoder , null , false ) ;
459
461
460
462
using Image < Rgba32 > output = Image . Load < Rgba32 > ( memStream ) ;
461
- ImageComparer . Exact . VerifySimilarity ( output , image ) ;
462
463
463
- Assert . Equal ( 5 , image . Frames . Count ) ;
464
+ // some loss from original, due to compositing
465
+ ImageComparer . TolerantPercentage ( 0.01f ) . VerifySimilarity ( output , image ) ;
466
+
464
467
Assert . Equal ( image . Frames . Count , output . Frames . Count ) ;
465
468
466
469
PngMetadata originalMetadata = image . Metadata . GetPngMetadata ( ) ;
467
470
PngMetadata outputMetadata = output . Metadata . GetPngMetadata ( ) ;
468
471
469
472
Assert . Equal ( originalMetadata . RepeatCount , outputMetadata . RepeatCount ) ;
473
+ Assert . Equal ( originalMetadata . DefaultImageAnimated , outputMetadata . DefaultImageAnimated ) ;
470
474
471
475
for ( int i = 0 ; i < image . Frames . Count ; i ++ )
472
476
{
@@ -586,29 +590,6 @@ public void Encode_AnimatedFormatTransform_FromWebp<TPixel>(TestImageProvider<TP
586
590
}
587
591
}
588
592
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
-
612
593
[ Theory ]
613
594
[ MemberData ( nameof ( PngTrnsFiles ) ) ]
614
595
public void Encode_PreserveTrns ( string imagePath , PngBitDepth pngBitDepth , PngColorType pngColorType )
0 commit comments