Skip to content

Commit

Permalink
Add test coverage for CreateCanvasBgr(a)32
Browse files Browse the repository at this point in the history
  • Loading branch information
lilith committed May 15, 2024
1 parent 5b3288c commit 8562b92
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/Imageflow.Test/Imageflow.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<NoWarn>$(NoWarn);CA1510</NoWarn>
</PropertyGroup>
<ItemGroup>
<!-- <PackageReference Include="PolySharp" Version="1.*">-->
<!-- <PrivateAssets>all</PrivateAssets>-->
Expand Down
22 changes: 22 additions & 0 deletions tests/Imageflow.Test/TestApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,28 @@ public async Task TestAllJob()
Assert.True(r.First.TryGetBytes().HasValue);
}
}

[Fact]
public async Task TestCreateCanvasBgra32()
{
using var b = new ImageJob();
var r = await b.CreateCanvasBgra32(10, 20, AnyColor.Black).Encode(new BytesDestination(), new WebPLosslessEncoder()).Finish().InProcessAsync();

Assert.Equal(10, r.First!.Width);
Assert.Equal(20, r.First.Height);
Assert.True(r.First.TryGetBytes().HasValue);
}
[Fact]
public async Task TestCreateCanvasBgr32()
{
using var b = new ImageJob();
var r = await b.CreateCanvasBgr32(10, 20, AnyColor.Black).Encode(new BytesDestination(), new WebPLosslessEncoder()).Finish().InProcessAsync();

Assert.Equal(10, r.First!.Width);
Assert.Equal(20, r.First.Height);
Assert.True(r.First.TryGetBytes().HasValue);
}

[Fact]
public async Task TestConstraints()
{
Expand Down

0 comments on commit 8562b92

Please sign in to comment.