From 79439dbea1754a2b661ade7b786a1283812932d4 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Mon, 13 May 2019 02:13:16 +0200 Subject: [PATCH] DrawImageOfDifferentPixelType test cases --- .../Drawing/DrawImageTests.cs | 22 +++++++++++++++++-- tests/Images/External | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs b/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs index e48a0b0ae..cb44651d6 100644 --- a/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs +++ b/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs @@ -96,8 +96,26 @@ namespace SixLabors.ImageSharp.Tests.Drawing testInfo); } } - - + + [Theory] + [WithTestPatternImages(200, 200, PixelTypes.Rgba32 | PixelTypes.Bgra32)] + public void DrawImageOfDifferentPixelType(TestImageProvider provider) + where TPixel : struct, IPixel + { + byte[] brushData = TestFile.Create(TestImages.Png.Ducky).Bytes; + + using (Image image = provider.GetImage()) + using (Image brushImage = provider.PixelType == PixelTypes.Rgba32 + ? (Image)Image.Load(brushData) + : Image.Load(brushData)) + { + image.Mutate(c => c.DrawImage(brushImage, 0.5f)); + + image.DebugSave(provider, appendSourceFileOrDescription: false); + image.CompareToReferenceOutput(provider, appendSourceFileOrDescription: false); + } + } + [Theory] [WithSolidFilledImages(100, 100, "White", PixelTypes.Rgba32, 0, 0)] [WithSolidFilledImages(100, 100, "White", PixelTypes.Rgba32, 25, 25)] diff --git a/tests/Images/External b/tests/Images/External index 9d1d9dd53..82f082ed3 160000 --- a/tests/Images/External +++ b/tests/Images/External @@ -1 +1 @@ -Subproject commit 9d1d9dd53755007ee812907f64304d1925c6a91a +Subproject commit 82f082ed3b47cc21b38dda9c5f8dda06dca5233a