mirror of https://github.com/SixLabors/ImageSharp
7 changed files with 175 additions and 4 deletions
@ -0,0 +1,22 @@ |
|||||
|
// Copyright (c) Six Labors and contributors.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
|
||||
|
using SixLabors.ImageSharp.Formats.Bmp; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace SixLabors.ImageSharp.Tests.Formats.Bmp |
||||
|
{ |
||||
|
public class BmpMetaDataTests |
||||
|
{ |
||||
|
[Fact] |
||||
|
public void CloneIsDeep() |
||||
|
{ |
||||
|
var meta = new BmpMetaData() { BitsPerPixel = BmpBitsPerPixel.Pixel24 }; |
||||
|
var clone = (BmpMetaData)meta.DeepClone(); |
||||
|
|
||||
|
clone.BitsPerPixel = BmpBitsPerPixel.Pixel32; |
||||
|
|
||||
|
Assert.False(meta.BitsPerPixel.Equals(clone.BitsPerPixel)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
// Copyright (c) Six Labors and contributors.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
|
||||
|
using SixLabors.ImageSharp.Formats.Gif; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace SixLabors.ImageSharp.Tests.Formats.Gif |
||||
|
{ |
||||
|
public class GifFrameMetaDataTests |
||||
|
{ |
||||
|
[Fact] |
||||
|
public void CloneIsDeep() |
||||
|
{ |
||||
|
var meta = new GifFrameMetaData() |
||||
|
{ |
||||
|
FrameDelay = 1, |
||||
|
DisposalMethod = GifDisposalMethod.RestoreToBackground, |
||||
|
ColorTableLength = 2 |
||||
|
}; |
||||
|
|
||||
|
var clone = (GifFrameMetaData)meta.DeepClone(); |
||||
|
|
||||
|
clone.FrameDelay = 2; |
||||
|
clone.DisposalMethod = GifDisposalMethod.RestoreToPrevious; |
||||
|
clone.ColorTableLength = 1; |
||||
|
|
||||
|
Assert.False(meta.FrameDelay.Equals(clone.FrameDelay)); |
||||
|
Assert.False(meta.DisposalMethod.Equals(clone.DisposalMethod)); |
||||
|
Assert.False(meta.ColorTableLength.Equals(clone.ColorTableLength)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
// Copyright (c) Six Labors and contributors.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
|
||||
|
using SixLabors.ImageSharp.Formats.Gif; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace SixLabors.ImageSharp.Tests.Formats.Gif |
||||
|
{ |
||||
|
public class GifMetaDataTests |
||||
|
{ |
||||
|
[Fact] |
||||
|
public void CloneIsDeep() |
||||
|
{ |
||||
|
var meta = new GifMetaData() |
||||
|
{ |
||||
|
RepeatCount = 1, |
||||
|
ColorTableMode = GifColorTableMode.Global, |
||||
|
GlobalColorTableLength = 2 |
||||
|
}; |
||||
|
|
||||
|
var clone = (GifMetaData)meta.DeepClone(); |
||||
|
|
||||
|
clone.RepeatCount = 2; |
||||
|
clone.ColorTableMode = GifColorTableMode.Local; |
||||
|
clone.GlobalColorTableLength = 1; |
||||
|
|
||||
|
Assert.False(meta.RepeatCount.Equals(clone.RepeatCount)); |
||||
|
Assert.False(meta.ColorTableMode.Equals(clone.ColorTableMode)); |
||||
|
Assert.False(meta.GlobalColorTableLength.Equals(clone.GlobalColorTableLength)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
// Copyright (c) Six Labors and contributors.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
|
||||
|
using SixLabors.ImageSharp.Formats.Jpeg; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace SixLabors.ImageSharp.Tests.Formats.Jpg |
||||
|
{ |
||||
|
public class JpegMetaDataTests |
||||
|
{ |
||||
|
[Fact] |
||||
|
public void CloneIsDeep() |
||||
|
{ |
||||
|
var meta = new JpegMetaData() { Quality = 50 }; |
||||
|
var clone = (JpegMetaData)meta.DeepClone(); |
||||
|
|
||||
|
clone.Quality = 99; |
||||
|
|
||||
|
Assert.False(meta.Quality.Equals(clone.Quality)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
// Copyright (c) Six Labors and contributors.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
|
||||
|
using SixLabors.ImageSharp.Formats.Png; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace SixLabors.ImageSharp.Tests.Formats.Png |
||||
|
{ |
||||
|
public class PngMetaDataTests |
||||
|
{ |
||||
|
[Fact] |
||||
|
public void CloneIsDeep() |
||||
|
{ |
||||
|
var meta = new PngMetaData() |
||||
|
{ |
||||
|
BitDepth = PngBitDepth.Bit16, |
||||
|
ColorType = PngColorType.GrayscaleWithAlpha, |
||||
|
Gamma = 2 |
||||
|
}; |
||||
|
var clone = (PngMetaData)meta.DeepClone(); |
||||
|
|
||||
|
clone.BitDepth = PngBitDepth.Bit2; |
||||
|
clone.ColorType = PngColorType.Palette; |
||||
|
clone.Gamma = 1; |
||||
|
|
||||
|
Assert.False(meta.BitDepth.Equals(clone.BitDepth)); |
||||
|
Assert.False(meta.ColorType.Equals(clone.ColorType)); |
||||
|
Assert.False(meta.Gamma.Equals(clone.Gamma)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue