Skip to content

Commit 288fb0a

Browse files
committed
Add test making sure envelope data is written, when UTF-8 data is present
1 parent 65c3c44 commit 288fb0a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.IPTC
1515
{
1616
public class IptcProfileTests
1717
{
18-
private static JpegDecoder JpegDecoder => new JpegDecoder() { IgnoreMetadata = false };
18+
private static JpegDecoder JpegDecoder => new() { IgnoreMetadata = false };
1919

20-
private static TiffDecoder TiffDecoder => new TiffDecoder() { IgnoreMetadata = false };
20+
private static TiffDecoder TiffDecoder => new() { IgnoreMetadata = false };
2121

2222
public static IEnumerable<object[]> AllIptcTags()
2323
{
@@ -27,6 +27,22 @@ public static IEnumerable<object[]> AllIptcTags()
2727
}
2828
}
2929

30+
[Fact]
31+
public void IptcProfile_WithUtf8Data_WritesEnvelopeRecord_Works()
32+
{
33+
// arrange
34+
var profile = new IptcProfile();
35+
profile.SetValue(IptcTag.City, "ESPAÑA");
36+
profile.UpdateData();
37+
byte[] expectedEnvelopeData = { 28, 1, 90, 0, 3, 27, 37, 71 };
38+
39+
// act
40+
byte[] profileBytes = profile.Data;
41+
42+
// assert
43+
Assert.True(profileBytes.AsSpan(0, 8).SequenceEqual(expectedEnvelopeData));
44+
}
45+
3046
[Theory]
3147
[MemberData(nameof(AllIptcTags))]
3248
public void IptcProfile_SetValue_WithStrictEnabled_Works(IptcTag tag)

0 commit comments

Comments
 (0)