Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(FExecStringCommand, FString, ExecCommand);
- //DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(FRotateCamera, ACharacter*, character);
- DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(FMovePlayerToNextLocationLevelOne, ACharacter*, character);
- //DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(FLoadMap, FString, MapName);
- TArray<FVector> g_levelOneTestLocations;
- int g_index = 0;
- bool FExecStringCommand::Update()
- {
- /*check(GEngine->GetWorldContexts().Num() == 1);
- check(GEngine->GetWorldContexts()[0].WorldType == EWorldType::Game);*/
- UE_LOG(LogEngineAutomationTests, Log, TEXT("Running exec command: %s"), *ExecCommand);
- GEngine->Exec(GEngine->GetWorldContexts()[0].World(), *ExecCommand);
- return true;
- }
- bool FMovePlayerToNextLocationLevelOne::Update()
- {
- if (character)
- {
- FVector& current = g_levelOneTestLocations[g_index];
- UE_LOG(LogEngineAutomationTests, Display, TEXT("Moving player %s to %f, %f, %f"), *character->GetName(), current.X, current.Y, current.Z);
- character->SetActorLocation(current);
- ++g_index;
- }
- return true;
- }
- void MovePlayerTest()
- {
- for (TObjectIterator<ACharacter> it; it; ++it)
- {
- ACharacter* character = *it;
- if (character)
- {
- ADD_LATENT_AUTOMATION_COMMAND(FMovePlayerToNextLocationLevelOne(character));
- ADD_LATENT_AUTOMATION_COMMAND(FWaitLatentCommand(1.f));
- }
- else
- {
- UE_LOG(LogEngineAutomationTests, Display, TEXT("Unable to find character."));
- }
- }
- }
- IMPLEMENT_SIMPLE_AUTOMATION_TEST(SmokeExample7, "Game.Character.Smoke.Example 7", EAutomationTestFlags::ATF_Editor | EAutomationTestFlags::ATF_Game);
- bool SmokeExample7::RunTest(const FString& Parameters)
- {
- g_levelOneTestLocations.Add(FVector(1251.949f, 95.634f, 1208.150f));
- g_levelOneTestLocations.Add(FVector(3023.030f, 8126.014f, 2148.240f));
- g_levelOneTestLocations.Add(FVector(6167.309f, 13026.611f, 2472.841f));
- g_levelOneTestLocations.Add(FVector(6763.314f, 12864.243f, 4445.650f));
- g_levelOneTestLocations.Add(FVector(6375.776f, 18058.902f, 6058.165f));
- g_levelOneTestLocations.Add(FVector(1255.106f, 24944.250f, 5729.320f));
- ADD_LATENT_AUTOMATION_COMMAND(FWaitLatentCommand(30.f));
- ADD_LATENT_AUTOMATION_COMMAND(FExecStringCommand(TEXT("StartFPSChart")));
- ADD_LATENT_AUTOMATION_COMMAND(FWaitLatentCommand(1.f));
- for (int count = 0; count < g_levelOneTestLocations.Num(); ++count)
- {
- //MovePlayerTest();
- }
- ADD_LATENT_AUTOMATION_COMMAND(FExecStringCommand(TEXT("StopFPSChart")));
- ADD_LATENT_AUTOMATION_COMMAND(FWaitLatentCommand(1.f));
- ADD_LATENT_AUTOMATION_COMMAND(FExecStringCommand(TEXT("stat stopfile")));
- ADD_LATENT_AUTOMATION_COMMAND(FWaitLatentCommand(1.f));
- ADD_LATENT_AUTOMATION_COMMAND(FExecStringCommand(TEXT("quit")));
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement