Skip to content

Commit 85fd431

Browse files
committed
Fix PngMetadata copy
1 parent 9b8ef10 commit 85fd431

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/ImageSharp/Formats/Png/PngMetadata.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ private PngMetadata(PngMetadata other)
2929
this.InterlaceMethod = other.InterlaceMethod;
3030
this.TransparentColor = other.TransparentColor;
3131
this.RepeatCount = other.RepeatCount;
32+
this.DefaultImageAnimated = other.DefaultImageAnimated;
3233

3334
if (other.ColorTable?.Length > 0)
3435
{
@@ -86,7 +87,7 @@ private PngMetadata(PngMetadata other)
8687
/// <summary>
8788
/// Gets or sets a value indicating whether the default image is shown as part of the animated sequence
8889
/// </summary>
89-
public bool DefaultImageAnimated { get; set; }
90+
public bool DefaultImageAnimated { get; set; } = true;
9091

9192
/// <inheritdoc/>
9293
public IDeepCloneable DeepClone() => new PngMetadata(this);

tests/ImageSharp.Tests/Formats/Png/PngMetadataTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public void CloneIsDeep()
3232
InterlaceMethod = PngInterlaceMode.Adam7,
3333
Gamma = 2,
3434
TextData = new List<PngTextData> { new PngTextData("name", "value", "foo", "bar") },
35-
RepeatCount = 123
35+
RepeatCount = 123,
36+
DefaultImageAnimated = false
3637
};
3738

3839
PngMetadata clone = (PngMetadata)meta.DeepClone();
@@ -44,6 +45,7 @@ public void CloneIsDeep()
4445
Assert.False(meta.TextData.Equals(clone.TextData));
4546
Assert.True(meta.TextData.SequenceEqual(clone.TextData));
4647
Assert.True(meta.RepeatCount == clone.RepeatCount);
48+
Assert.True(meta.DefaultImageAnimated == clone.DefaultImageAnimated);
4749

4850
clone.BitDepth = PngBitDepth.Bit2;
4951
clone.ColorType = PngColorType.Palette;

0 commit comments

Comments
 (0)