From 96940d22fb96ab75d2ce1bcdd1f305934cb59e19 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 9 May 2024 14:26:48 +0200 Subject: [PATCH] Add some debugging --- tests/NetVips.Tests/IoFuncsTests.cs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/NetVips.Tests/IoFuncsTests.cs b/tests/NetVips.Tests/IoFuncsTests.cs index a7901f68..e4d83c83 100644 --- a/tests/NetVips.Tests/IoFuncsTests.cs +++ b/tests/NetVips.Tests/IoFuncsTests.cs @@ -9,8 +9,11 @@ namespace NetVips.Tests public class IoFuncsTests : IClassFixture { + private readonly ITestOutputHelper _testOutputHelper; + public IoFuncsTests(TestsFixture testsFixture, ITestOutputHelper output) { + _testOutputHelper = output; testsFixture.SetUpLogging(output); } @@ -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(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]