SpaceCheetah
2 years ago
No known key found for this signature in database
GPG Key ID: A60F20D29141DFF9
2 changed files with
5 additions and
2 deletions
-
src/ImageSharp/Formats/Png/PngMetadata.cs
-
tests/ImageSharp.Tests/Formats/Png/PngMetadataTests.cs
|
|
|
@ -29,6 +29,7 @@ public class PngMetadata : IDeepCloneable |
|
|
|
this.InterlaceMethod = other.InterlaceMethod; |
|
|
|
this.TransparentColor = other.TransparentColor; |
|
|
|
this.RepeatCount = other.RepeatCount; |
|
|
|
this.DefaultImageAnimated = other.DefaultImageAnimated; |
|
|
|
|
|
|
|
if (other.ColorTable?.Length > 0) |
|
|
|
{ |
|
|
|
@ -86,7 +87,7 @@ public class PngMetadata : IDeepCloneable |
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets a value indicating whether the default image is shown as part of the animated sequence
|
|
|
|
/// </summary>
|
|
|
|
public bool DefaultImageAnimated { get; set; } |
|
|
|
public bool DefaultImageAnimated { get; set; } = true; |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public IDeepCloneable DeepClone() => new PngMetadata(this); |
|
|
|
|
|
|
|
@ -32,7 +32,8 @@ public class PngMetadataTests |
|
|
|
InterlaceMethod = PngInterlaceMode.Adam7, |
|
|
|
Gamma = 2, |
|
|
|
TextData = new List<PngTextData> { new PngTextData("name", "value", "foo", "bar") }, |
|
|
|
RepeatCount = 123 |
|
|
|
RepeatCount = 123, |
|
|
|
DefaultImageAnimated = false |
|
|
|
}; |
|
|
|
|
|
|
|
PngMetadata clone = (PngMetadata)meta.DeepClone(); |
|
|
|
@ -44,6 +45,7 @@ public class PngMetadataTests |
|
|
|
Assert.False(meta.TextData.Equals(clone.TextData)); |
|
|
|
Assert.True(meta.TextData.SequenceEqual(clone.TextData)); |
|
|
|
Assert.True(meta.RepeatCount == clone.RepeatCount); |
|
|
|
Assert.True(meta.DefaultImageAnimated == clone.DefaultImageAnimated); |
|
|
|
|
|
|
|
clone.BitDepth = PngBitDepth.Bit2; |
|
|
|
clone.ColorType = PngColorType.Palette; |
|
|
|
|