Skip to content

Commit

Permalink
More debug
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed May 9, 2024
1 parent bbc2270 commit b974a78
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/NetVips.Tests/IoFuncsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,20 @@ 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)");
}

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

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

[Fact]
Expand Down

0 comments on commit b974a78

Please sign in to comment.