MCPcopy Create free account
hub / github.com/Voidware-Prohibited/ALSXT / RunTest

Method RunTest

Source/ALSXT/Private/Tests/AlsxtTest_BasicMovement.cpp:24–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24bool FAlsxtTest_BasicMovement::RunTest(const FString& Parameters)
25{
26 // 1. Load a basic test level or use current
27 AutomationOpenMap(TEXT("/ALSXT/ALSExtras/Levels/L_TestMap")); // Replace with your actual test map path
28
29 UWorld* World = GEngine->GetWorldContexts()[0].World();
30 if (!World) return false;
31
32 // 2. Get or Spawn Character
33 ACharacter* Character = UGameplayStatics::GetPlayerCharacter(World, 0);
34 if (!Character) return false;
35
36 FVector StartLocation = Character->GetActorLocation();
37
38 // 3. Queue movement simulation (Latent command)
39 ADD_LATENT_AUTOMATION_COMMAND(FAlsxtSimulateMoveForward(Character, 1.0f, 0.0f));
40
41 // 4. Verify movement after latent command finishes
42 ADD_LATENT_AUTOMATION_COMMAND(FFunctionLatentCommand([this, Character, StartLocation]()
43 {
44 FVector EndLocation = Character->GetActorLocation();
45 float DistanceMoved = FVector::Dist(StartLocation, EndLocation);
46
47 // Assert that the character moved at least 100 units forward
48 TestTrue(TEXT("Character should have moved forward"), DistanceMoved > 100.0f);
49 return true;
50 }));
51
52 return true;
53}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected