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.
38 lines
1.1 KiB
38 lines
1.1 KiB
// Copyright (c) Six Labors.
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
using SixLabors.ImageSharp.Formats.Tiff;
|
|
using SixLabors.ImageSharp.Formats.Tiff.Writers;
|
|
|
|
namespace SixLabors.ImageSharp.Tests.Formats.Tiff;
|
|
|
|
[Trait("Format", "Tiff")]
|
|
public class TiffEncoderHeaderTests
|
|
{
|
|
private static readonly TiffEncoder Encoder = new();
|
|
|
|
[Fact]
|
|
public void WriteHeader_WritesValidHeader()
|
|
{
|
|
using MemoryStream stream = new();
|
|
TiffEncoderCore encoder = new(Encoder, Configuration.Default);
|
|
|
|
using (TiffStreamWriter writer = new(stream))
|
|
{
|
|
long firstIfdMarker = TiffEncoderCore.WriteHeader(writer, stackalloc byte[4]);
|
|
}
|
|
|
|
Assert.Equal(new byte[] { 0x49, 0x49, 42, 0, 0x00, 0x00, 0x00, 0x00 }, stream.ToArray());
|
|
}
|
|
|
|
[Fact]
|
|
public void WriteHeader_ReturnsFirstIfdMarker()
|
|
{
|
|
using MemoryStream stream = new();
|
|
TiffEncoderCore encoder = new(Encoder, Configuration.Default);
|
|
|
|
using TiffStreamWriter writer = new(stream);
|
|
long firstIfdMarker = TiffEncoderCore.WriteHeader(writer, stackalloc byte[4]);
|
|
Assert.Equal(4, firstIfdMarker);
|
|
}
|
|
}
|
|
|