Skip to content

Commit

Permalink
Add some debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed May 9, 2024
1 parent 559c00d commit 96940d2
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions tests/NetVips.Tests/IoFuncsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ namespace NetVips.Tests

public class IoFuncsTests : IClassFixture<TestsFixture>
{
private readonly ITestOutputHelper _testOutputHelper;

public IoFuncsTests(TestsFixture testsFixture, ITestOutputHelper output)
{
_testOutputHelper = output;
testsFixture.SetUpLogging(output);
}

Expand Down Expand Up @@ -235,14 +238,24 @@ public void TestSetProgress()

var im = Image.NewFromFile(Helper.JpegFile, access: Enums.Access.Sequential);

var lastPercent = 0;
void EvalCallback(Image image, VipsProgress progressStruct)
{
_testOutputHelper.WriteLine($" run = {progressStruct.Run} (seconds of run time)");
_testOutputHelper.WriteLine($" eta = {progressStruct.Eta} (estimated seconds left)");
_testOutputHelper.WriteLine($" tpels = {progressStruct.TPels} (total number of pels)");
_testOutputHelper.WriteLine($" npels = {progressStruct.NPels} (number of pels computed so far)");
_testOutputHelper.WriteLine($" percent = {progressStruct.Percent} (percent complete)");
_testOutputHelper.WriteLine($" active = {progressStruct.Start.Active} (timer active)");
}

var progress = new Progress<int>(percent => lastPercent = percent);
im.SetProgress(progress);
im.SetProgress(true);
im.SignalConnect(Enums.Signals.PreEval, EvalCallback);
im.SignalConnect(Enums.Signals.Eval, EvalCallback);
im.SignalConnect(Enums.Signals.PostEval, EvalCallback);

var buf = im.DzsaveBuffer("image-pyramid");
var buf = im.DzsaveBuffer("image-pyramid", suffix: ".png");
Assert.True(buf.Length > 0);
Assert.True(lastPercent <= 100);
Assert.True(false);
}

[Fact]
Expand Down

0 comments on commit 96940d2

Please sign in to comment.