Skip to content

Commit

Permalink
Let tests specify viewport sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
csciguy8 committed Oct 4, 2023
1 parent 2b37835 commit 2bf0b3b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
13 changes: 7 additions & 6 deletions Source/CesiumRuntime/Private/Tests/CesiumLoadTestCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ struct LoadTestContext {
SceneGenerationContext playContext;

float cameraFieldOfView = 90.0f;
int viewportWidth = 1024;
int viewportHeight = 768;

bool testInProgress;
double startMark;
Expand Down Expand Up @@ -135,17 +133,20 @@ void clearCacheDb() {
bool RunLoadTest(
const FString& testName,
std::function<void(SceneGenerationContext&)> locationSetup,
const std::vector<TestPass>& testPasses) {
const std::vector<TestPass>& 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();

Expand All @@ -165,8 +166,8 @@ bool RunLoadTest(
FRequestPlaySessionParams Params;
Params.WorldType = EPlaySessionWorldType::PlayInEditor;
Params.EditorPlaySettings = NewObject<ULevelEditorPlaySettings>();
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);

Expand Down
4 changes: 3 additions & 1 deletion Source/CesiumRuntime/Private/Tests/CesiumLoadTestCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ struct TestPass {
bool RunLoadTest(
const FString& testName,
std::function<void(SceneGenerationContext&)> locationSetup,
const std::vector<TestPass>& testPasses);
const std::vector<TestPass>& testPasses,
int viewportWidth,
int viewportHeight);

}; // namespace Cesium

Expand Down
11 changes: 8 additions & 3 deletions Source/CesiumRuntime/Private/Tests/CesiumLoadTestSamples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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

0 comments on commit 2bf0b3b

Please sign in to comment.