Browse Source

Add test making sure envelope data is written, when UTF-8 data is present

pull/2213/head
Brian Popow 4 years ago
parent
commit
288fb0ad51
  1. 20
      tests/ImageSharp.Tests/Metadata/Profiles/IPTC/IptcProfileTests.cs

20
tests/ImageSharp.Tests/Metadata/Profiles/IPTC/IptcProfileTests.cs

@ -15,9 +15,9 @@ namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.IPTC
{
public class IptcProfileTests
{
private static JpegDecoder JpegDecoder => new JpegDecoder() { IgnoreMetadata = false };
private static JpegDecoder JpegDecoder => new() { IgnoreMetadata = false };
private static TiffDecoder TiffDecoder => new TiffDecoder() { IgnoreMetadata = false };
private static TiffDecoder TiffDecoder => new() { IgnoreMetadata = false };
public static IEnumerable<object[]> AllIptcTags()
{
@ -27,6 +27,22 @@ namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.IPTC
}
}
[Fact]
public void IptcProfile_WithUtf8Data_WritesEnvelopeRecord_Works()
{
// arrange
var profile = new IptcProfile();
profile.SetValue(IptcTag.City, "ESPAÑA");
profile.UpdateData();
byte[] expectedEnvelopeData = { 28, 1, 90, 0, 3, 27, 37, 71 };
// act
byte[] profileBytes = profile.Data;
// assert
Assert.True(profileBytes.AsSpan(0, 8).SequenceEqual(expectedEnvelopeData));
}
[Theory]
[MemberData(nameof(AllIptcTags))]
public void IptcProfile_SetValue_WithStrictEnabled_Works(IptcTag tag)

Loading…
Cancel
Save