Browse Source

Merge branch 'main' into js/smaller-aot

pull/2514/head
James Jackson-South 3 years ago
committed by GitHub
parent
commit
a794ac1b57
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.LongArray.cs
  2. 13
      src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedShortArray.cs
  3. 5
      src/ImageSharp/Metadata/Profiles/Exif/Values/ExifSignedShortArray.cs
  4. 5
      src/ImageSharp/Metadata/Profiles/Exif/Values/ExifValues.cs
  5. 23
      tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs

5
src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.LongArray.cs

@ -56,11 +56,6 @@ public abstract partial class ExifTag
/// </summary>
public static ExifTag<uint[]> IntergraphRegisters { get; } = new ExifTag<uint[]>(ExifTagValue.IntergraphRegisters);
/// <summary>
/// Gets the TimeZoneOffset exif tag.
/// </summary>
public static ExifTag<uint[]> TimeZoneOffset { get; } = new ExifTag<uint[]>(ExifTagValue.TimeZoneOffset);
/// <summary>
/// Gets the offset to child IFDs exif tag.
/// </summary>

13
src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.SignedShortArray.cs

@ -0,0 +1,13 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif;
/// <content/>
public abstract partial class ExifTag
{
/// <summary>
/// Gets the TimeZoneOffset exif tag.
/// </summary>
public static ExifTag<short[]> TimeZoneOffset { get; } = new ExifTag<short[]>(ExifTagValue.TimeZoneOffset);
}

5
src/ImageSharp/Metadata/Profiles/Exif/Values/ExifSignedShortArray.cs

@ -5,6 +5,11 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif;
internal sealed class ExifSignedShortArray : ExifArrayValue<short>
{
public ExifSignedShortArray(ExifTag<short[]> tag)
: base(tag)
{
}
public ExifSignedShortArray(ExifTagValue tag)
: base(tag)
{

5
src/ImageSharp/Metadata/Profiles/Exif/Values/ExifValues.cs

@ -144,8 +144,6 @@ internal static partial class ExifValues
return new ExifLongArray(ExifTag.StripRowCounts);
case ExifTagValue.IntergraphRegisters:
return new ExifLongArray(ExifTag.IntergraphRegisters);
case ExifTagValue.TimeZoneOffset:
return new ExifLongArray(ExifTag.TimeZoneOffset);
case ExifTagValue.SubIFDs:
return new ExifLongArray(ExifTag.SubIFDs);
@ -417,6 +415,9 @@ internal static partial class ExifValues
case ExifTagValue.Decode:
return new ExifSignedRationalArray(ExifTag.Decode);
case ExifTagValue.TimeZoneOffset:
return new ExifSignedShortArray(ExifTag.TimeZoneOffset);
case ExifTagValue.ImageDescription:
return new ExifString(ExifTag.ImageDescription);
case ExifTagValue.Make:

23
tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs

@ -70,8 +70,7 @@ public class ExifValuesTests
{ ExifTag.JPEGDCTables },
{ ExifTag.JPEGACTables },
{ ExifTag.StripRowCounts },
{ ExifTag.IntergraphRegisters },
{ ExifTag.TimeZoneOffset }
{ ExifTag.IntergraphRegisters }
};
public static TheoryData<ExifTag> NumberTags => new TheoryData<ExifTag>
@ -235,6 +234,11 @@ public class ExifValuesTests
{ ExifTag.Decode }
};
public static TheoryData<ExifTag> SignedShortArrayTags => new TheoryData<ExifTag>
{
{ ExifTag.TimeZoneOffset }
};
public static TheoryData<ExifTag> StringTags => new TheoryData<ExifTag>
{
{ ExifTag.ImageDescription },
@ -559,6 +563,21 @@ public class ExifValuesTests
Assert.Equal(expected, typed.Value);
}
[Theory]
[MemberData(nameof(SignedShortArrayTags))]
public void ExifSignedShortArrayTests(ExifTag tag)
{
short[] expected = new short[] { 21, 42 };
ExifValue value = ExifValues.Create(tag);
Assert.False(value.TrySetValue(expected.ToString()));
Assert.True(value.TrySetValue(expected));
var typed = (ExifSignedShortArray)value;
Assert.Equal(expected, typed.Value);
}
[Theory]
[MemberData(nameof(StringTags))]
public void ExifStringTests(ExifTag tag)

Loading…
Cancel
Save