Skip to content

Commit ff9ed12

Browse files
Fix operations tests
1 parent 3f65ff6 commit ff9ed12

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tests/ImageSharp.Tests/Drawing/DrawImageExtensionsTests.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ public class DrawImageExtensionsTests : BaseImageOperationsExtensionTest
1313
[Fact]
1414
public void DrawImage_OpacityOnly_VerifyGraphicOptionsTakenFromContext()
1515
{
16-
// non-default values as we cant easly defect usage otherwise
16+
// non-default values as we cant easily defect usage otherwise
1717
this.options.AlphaCompositionMode = PixelAlphaCompositionMode.Xor;
1818
this.options.ColorBlendingMode = PixelColorBlendingMode.Screen;
1919

20-
this.operations.DrawImage(null, 0.5f);
20+
using Image<Rgba32> image = new(Configuration.Default, 1, 1);
21+
this.operations.DrawImage(image, 0.5f);
2122
DrawImageProcessor dip = this.Verify<DrawImageProcessor>();
2223

2324
Assert.Equal(0.5, dip.Opacity);
@@ -28,11 +29,12 @@ public void DrawImage_OpacityOnly_VerifyGraphicOptionsTakenFromContext()
2829
[Fact]
2930
public void DrawImage_OpacityAndBlending_VerifyGraphicOptionsTakenFromContext()
3031
{
31-
// non-default values as we cant easly defect usage otherwise
32+
// non-default values as we cant easily defect usage otherwise
3233
this.options.AlphaCompositionMode = PixelAlphaCompositionMode.Xor;
3334
this.options.ColorBlendingMode = PixelColorBlendingMode.Screen;
3435

35-
this.operations.DrawImage(null, PixelColorBlendingMode.Multiply, 0.5f);
36+
using Image<Rgba32> image = new(Configuration.Default, 1, 1);
37+
this.operations.DrawImage(image, PixelColorBlendingMode.Multiply, 0.5f);
3638
DrawImageProcessor dip = this.Verify<DrawImageProcessor>();
3739

3840
Assert.Equal(0.5, dip.Opacity);
@@ -43,11 +45,12 @@ public void DrawImage_OpacityAndBlending_VerifyGraphicOptionsTakenFromContext()
4345
[Fact]
4446
public void DrawImage_LocationAndOpacity_VerifyGraphicOptionsTakenFromContext()
4547
{
46-
// non-default values as we cant easly defect usage otherwise
48+
// non-default values as we cant easily defect usage otherwise
4749
this.options.AlphaCompositionMode = PixelAlphaCompositionMode.Xor;
4850
this.options.ColorBlendingMode = PixelColorBlendingMode.Screen;
4951

50-
this.operations.DrawImage(null, Point.Empty, 0.5f);
52+
using Image<Rgba32> image = new(Configuration.Default, 1, 1);
53+
this.operations.DrawImage(image, Point.Empty, 0.5f);
5154
DrawImageProcessor dip = this.Verify<DrawImageProcessor>();
5255

5356
Assert.Equal(0.5, dip.Opacity);
@@ -58,11 +61,12 @@ public void DrawImage_LocationAndOpacity_VerifyGraphicOptionsTakenFromContext()
5861
[Fact]
5962
public void DrawImage_LocationAndOpacityAndBlending_VerifyGraphicOptionsTakenFromContext()
6063
{
61-
// non-default values as we cant easly defect usage otherwise
64+
// non-default values as we cant easily defect usage otherwise
6265
this.options.AlphaCompositionMode = PixelAlphaCompositionMode.Xor;
6366
this.options.ColorBlendingMode = PixelColorBlendingMode.Screen;
6467

65-
this.operations.DrawImage(null, Point.Empty, PixelColorBlendingMode.Multiply, 0.5f);
68+
using Image<Rgba32> image = new(Configuration.Default, 1, 1);
69+
this.operations.DrawImage(image, Point.Empty, PixelColorBlendingMode.Multiply, 0.5f);
6670
DrawImageProcessor dip = this.Verify<DrawImageProcessor>();
6771

6872
Assert.Equal(0.5, dip.Opacity);

0 commit comments

Comments
 (0)