Skip to content

Commit

Permalink
Added unit test for the extension issue reported in: ImageMagick/Imag…
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Apr 17, 2023
1 parent ce50ca3 commit b1d6197
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/Magick.NET.Tests/Coders/TheMapCoder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
// Licensed under the Apache License, Version 2.0.

using ImageMagick;
using Xunit;

namespace Magick.NET.Tests
{
public class TheMapCoder
{
[Fact]
public void CanBeReadFromFileWithMapExtensions()
{
using (var image = new MagickImage(Files.Builtin.Logo))
{
using (var file = new TemporaryFile("test.map"))
{
image.Write(file.FullName, MagickFormat.Map);

image.Read(file.FullName, image.Width, image.Height);

Assert.Equal(MagickFormat.Map, image.Format);
}
}
}

[Fact]
public void CannotBeReadFromFileWithoutMapExtensions()
{
using (var image = new MagickImage(Files.Builtin.Logo))
{
using (var file = new TemporaryFile("test"))
{
image.Write(file.FullName, MagickFormat.Map);

Assert.Throws<MagickMissingDelegateErrorException>(() => image.Read(file.FullName, image.Width, image.Height));
}
}
}
}
}

0 comments on commit b1d6197

Please sign in to comment.