Skip to content

Commit

Permalink
Refactored unit tests for the interlace method.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Oct 27, 2021
1 parent c338792 commit bfa6ddc
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 27 deletions.
51 changes: 51 additions & 0 deletions tests/Magick.NET.Tests/MagickImageTests/TheInterlaceMethod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
// Licensed under the Apache License, Version 2.0.

using System.IO;
using ImageMagick;
using Xunit;

namespace Magick.NET.Tests
{
public partial class MagickImageTests
{
public class TheInterlaceMethod
{
[Fact]
public void ShouldUseNoInterlaceAsTheDefault()
{
using (var image = new MagickImage(MagickColors.Fuchsia, 100, 60))
{
using (var memStream = new MemoryStream())
{
image.Format = MagickFormat.Jpeg;
image.Write(memStream);

memStream.Position = 0;
image.Read(memStream);

Assert.Equal(Interlace.NoInterlace, image.Interlace);
}
}
}

[Fact]
public void ShouldBeUseWhenWritingJpegImage()
{
using (var image = new MagickImage(MagickColors.Fuchsia, 100, 60))
{
using (var memStream = new MemoryStream())
{
image.Interlace = Interlace.Undefined;
image.Write(memStream);

memStream.Position = 0;
image.Read(memStream);

Assert.Equal(Interlace.Jpeg, image.Interlace);
}
}
}
}
}
}
27 changes: 0 additions & 27 deletions tests/Magick.NET.Tests/Settings/MagickSettingsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,33 +188,6 @@ public void Test_FillRule()
}
}

[Fact]
public void Test_Interlace()
{
using (var image = new MagickImage(MagickColors.Fuchsia, 100, 60))
{
using (MemoryStream memStream = new MemoryStream())
{
image.Format = MagickFormat.Jpeg;
image.Write(memStream);

memStream.Position = 0;
image.Read(memStream);
Assert.Equal(Interlace.NoInterlace, image.Interlace);
}

using (MemoryStream memStream = new MemoryStream())
{
image.Interlace = Interlace.Undefined;
image.Write(memStream);

memStream.Position = 0;
image.Read(memStream);
Assert.Equal(Interlace.Jpeg, image.Interlace);
}
}
}

[Fact]
public void Test_StrokeAntiAlias()
{
Expand Down

0 comments on commit bfa6ddc

Please sign in to comment.