From 2bf0b3b060f2075a0f500d69fa39bae2000af9b4 Mon Sep 17 00:00:00 2001 From: Brian L <130494071+csciguy8@users.noreply.github.com> Date: Wed, 4 Oct 2023 15:09:51 -0600 Subject: [PATCH] Let tests specify viewport sizes --- .../Private/Tests/CesiumLoadTestCore.cpp | 13 +++++++------ .../Private/Tests/CesiumLoadTestCore.h | 4 +++- .../Private/Tests/CesiumLoadTestSamples.cpp | 11 ++++++++--- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Source/CesiumRuntime/Private/Tests/CesiumLoadTestCore.cpp b/Source/CesiumRuntime/Private/Tests/CesiumLoadTestCore.cpp index 400da9870..ccb210f06 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumLoadTestCore.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumLoadTestCore.cpp @@ -19,8 +19,6 @@ struct LoadTestContext { SceneGenerationContext playContext; float cameraFieldOfView = 90.0f; - int viewportWidth = 1024; - int viewportHeight = 768; bool testInProgress; double startMark; @@ -135,17 +133,20 @@ void clearCacheDb() { bool RunLoadTest( const FString& testName, std::function locationSetup, - const std::vector& testPasses) { + const std::vector& testPasses, + int viewportWidth, + int viewportHeight) { gLoadTestContext.reset(); // // Programmatically set up the world // - UE_LOG(LogCesium, Display, TEXT("Creating world objects...")); + UE_LOG(LogCesium, Display, TEXT("Creating common world objects...")); createCommonWorldObjects(gLoadTestContext.creationContext); // Configure location specific objects + UE_LOG(LogCesium, Display, TEXT("Setting up location...")); locationSetup(gLoadTestContext.creationContext); gLoadTestContext.creationContext.trackForPlay(); @@ -165,8 +166,8 @@ bool RunLoadTest( FRequestPlaySessionParams Params; Params.WorldType = EPlaySessionWorldType::PlayInEditor; Params.EditorPlaySettings = NewObject(); - Params.EditorPlaySettings->NewWindowWidth = gLoadTestContext.viewportWidth; - Params.EditorPlaySettings->NewWindowHeight = gLoadTestContext.viewportHeight; + Params.EditorPlaySettings->NewWindowWidth = viewportWidth; + Params.EditorPlaySettings->NewWindowHeight = viewportHeight; Params.EditorPlaySettings->EnableGameSound = false; GEditor->RequestPlaySession(Params); diff --git a/Source/CesiumRuntime/Private/Tests/CesiumLoadTestCore.h b/Source/CesiumRuntime/Private/Tests/CesiumLoadTestCore.h index 9908b8baf..75e5fcb74 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumLoadTestCore.h +++ b/Source/CesiumRuntime/Private/Tests/CesiumLoadTestCore.h @@ -19,7 +19,9 @@ struct TestPass { bool RunLoadTest( const FString& testName, std::function locationSetup, - const std::vector& testPasses); + const std::vector& testPasses, + int viewportWidth, + int viewportHeight); }; // namespace Cesium diff --git a/Source/CesiumRuntime/Private/Tests/CesiumLoadTestSamples.cpp b/Source/CesiumRuntime/Private/Tests/CesiumLoadTestSamples.cpp index 5442882e8..a0337d7c9 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumLoadTestSamples.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumLoadTestSamples.cpp @@ -36,7 +36,7 @@ bool FCesiumSampleLoadDenver::RunTest(const FString& Parameters) { testPasses.push_back(TestPass{"Cold Cache", nullptr, nullptr}); testPasses.push_back(TestPass{"Warm Cache", refreshSampleTilesets, nullptr}); - return RunLoadTest(GetTestName(), setupForDenver, testPasses); + return RunLoadTest(GetTestName(), setupForDenver, testPasses, 1024, 768); } bool FCesiumSampleLoadGoogleplex::RunTest(const FString& Parameters) { @@ -45,7 +45,7 @@ bool FCesiumSampleLoadGoogleplex::RunTest(const FString& Parameters) { testPasses.push_back(TestPass{"Cold Cache", nullptr, nullptr}); testPasses.push_back(TestPass{"Warm Cache", refreshSampleTilesets, nullptr}); - return RunLoadTest(GetTestName(), setupForGoogleplex, testPasses); + return RunLoadTest(GetTestName(), setupForGoogleplex, testPasses, 1280, 720); } bool FCesiumSampleLoadMontrealPointCloud::RunTest(const FString& Parameters) { @@ -89,7 +89,12 @@ bool FCesiumSampleLoadMontrealPointCloud::RunTest(const FString& Parameters) { testPasses.push_back(TestPass{"Cold Cache", nullptr, nullptr}); testPasses.push_back(TestPass{"Adjust", adjustCamera, verifyVisibleTiles}); - return RunLoadTest(GetTestName(), setupForMontrealPointCloud, testPasses); + return RunLoadTest( + GetTestName(), + setupForMontrealPointCloud, + testPasses, + 512, + 512); } #endif