diff --git a/Source/CesiumRuntime/Private/Tests/CesiumTestHelpers.h b/Source/CesiumRuntime/Private/Tests/CesiumTestHelpers.h index 2e0c67ac5..05f4fca5f 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumTestHelpers.h +++ b/Source/CesiumRuntime/Private/Tests/CesiumTestHelpers.h @@ -52,7 +52,10 @@ void waitForImpl( done.Execute(); } else { pWorld->GetTimerManager().SetTimerForNextTick( - [done, pWorld, condition, timerHandle]() mutable { + [done, + pWorld, + condition = std::forward(condition), + timerHandle]() mutable { waitForImpl(done, pWorld, std::move(condition), timerHandle); }); } diff --git a/Source/CesiumRuntime/Private/Tests/SampleHeightMostDetailed.spec.cpp b/Source/CesiumRuntime/Private/Tests/SampleHeightMostDetailed.spec.cpp index 805e1e31e..d22b7661f 100644 --- a/Source/CesiumRuntime/Private/Tests/SampleHeightMostDetailed.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/SampleHeightMostDetailed.spec.cpp @@ -59,10 +59,13 @@ void FSampleHeightMostDetailedSpec::Define() { "works with a single position", EAsyncExecution::TaskGraphMainThread, [this](const FDoneDelegate& done) { + CesiumAsync::Promise foo = + getAsyncSystem().createPromise(); + pTileset->SampleHeightMostDetailed( {FVector(-105.1, 40.1, 1.0)}, FCesiumSampleHeightMostDetailedCallback::CreateLambda( - [this, done]( + [this, done, foo]( ACesium3DTileset* pTileset, const TArray& result, const TArray& warnings) { @@ -85,8 +88,17 @@ void FSampleHeightMostDetailedSpec::Define() { result[0].LongitudeLatitudeHeight.Z, 1.0, 1.0)); - done.ExecuteIfBound(); + foo.resolve(); + // done.ExecuteIfBound(); })); + + CesiumTestHelpers::waitFor( + done, + CesiumTestHelpers::getGlobalWorldContext(), + 30.0f, + [future = foo.getFuture().share()]() { + return future.isReady(); + }); }); LatentIt(