//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
using ImageSharp.Formats;
namespace ImageSharp.Tests
{
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using ImageSharp.IO;
using Xunit;
public class PngEncoderTests : FileTestBase
{
[Theory]
[WithBlankImages(1, 1, PixelTypes.All)]
public void WritesFileMarker(TestImageProvider provider)
where TColor : struct, IPixel
{
using (Image image = provider.GetImage())
using (MemoryStream ms = new MemoryStream())
{
image.Save(ms, new PngEncoder());
byte[] data = ms.ToArray().Take(8).ToArray();
byte[] expected = {
0x89, // Set the high bit.
0x50, // P
0x4E, // N
0x47, // G
0x0D, // Line ending CRLF
0x0A, // Line ending CRLF
0x1A, // EOF
0x0A // LF
};
Assert.Equal(expected, data);
}
}
}
}