Skip to content

Commit dba032b

Browse files
committed
Added unit tests for Composite with CopyAlpha.
1 parent 819088a commit dba032b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/Magick.NET.Tests/Drawing/DrawablesTests/TheCompositeMethod.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ public void ShouldCopyPixelsOfTheImage()
3636
ColorAssert.Equal(MagickColors.Purple, image, 1, 0);
3737
ColorAssert.Equal(MagickColors.Green, image, 2, 0);
3838
}
39+
40+
[Fact]
41+
public void ShouldCorrectlyCopyTheAlphaChannel()
42+
{
43+
using var image = new MagickImage(Files.RedPNG);
44+
using var other = image.Clone();
45+
image.Resize(0, 150);
46+
other.Resize(0, 150);
47+
other.Alpha(AlphaOption.Off);
48+
other.Composite(image, CompositeOperator.CopyAlpha);
49+
50+
var diference = other.Compare(image, ErrorMetric.RootMeanSquared);
51+
Assert.Equal(0, diference);
52+
}
3953
}
4054

4155
public class WithGeometryOffsetAndCompositeOperatorAndImage

0 commit comments

Comments
 (0)