Detect potential errors copying metadata and avoid them (#2447) (#6997)

This commit is contained in:
Tony Mitchell
2020-10-08 16:16:32 -07:00
committed by GitHub
parent 42ebc42c98
commit 38e03e6bb0
4 changed files with 30 additions and 1 deletions

View File

@@ -123,6 +123,9 @@
<Content Include="Test.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestMetadataIssue2447.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestPortrait.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View File

@@ -30,6 +30,18 @@ namespace ImageResizer.Models
image => Assert.Equal("Test", ((BitmapMetadata)image.Frames[0].Metadata).Comment));
}
[Fact]
public void ExecuteCopiesFrameMetadataExceptWhenMetadataCannotBeCloned()
{
var operation = new ResizeOperation("TestMetadataIssue2447.jpg", _directory, Settings());
operation.Execute();
AssertEx.Image(
_directory.File(),
image => Assert.Null(((BitmapMetadata)image.Frames[0].Metadata).CameraModel));
}
[Fact]
public void ExecuteKeepsDateModified()
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 MiB