mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.2 KiB
34 lines
1.2 KiB
// Copyright (c) Six Labors.
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
using SixLabors.ImageSharp.Formats.Cur;
|
|
using SixLabors.ImageSharp.PixelFormats;
|
|
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
|
|
using static SixLabors.ImageSharp.Tests.TestImages.Cur;
|
|
|
|
namespace SixLabors.ImageSharp.Tests.Formats.Icon.Cur;
|
|
|
|
[Trait("Format", "Cur")]
|
|
public class CurEncoderTests
|
|
{
|
|
private static CurEncoder Encoder => new();
|
|
|
|
[Theory]
|
|
[WithFile(CurReal, PixelTypes.Rgba32)]
|
|
[WithFile(WindowsMouse, PixelTypes.Rgba32)]
|
|
public void CanRoundTripEncoder<TPixel>(TestImageProvider<TPixel> provider)
|
|
where TPixel : unmanaged, IPixel<TPixel>
|
|
{
|
|
using Image<TPixel> image = provider.GetImage(CurDecoder.Instance);
|
|
using MemoryStream memStream = new();
|
|
image.DebugSaveMultiFrame(provider);
|
|
|
|
image.Save(memStream, Encoder);
|
|
memStream.Seek(0, SeekOrigin.Begin);
|
|
|
|
using Image<TPixel> encoded = Image.Load<TPixel>(memStream);
|
|
encoded.DebugSaveMultiFrame(provider, appendPixelTypeToFileName: false);
|
|
|
|
encoded.CompareToOriginalMultiFrame(provider, ImageComparer.Exact, CurDecoder.Instance);
|
|
}
|
|
}
|
|
|