MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / RunTest

Method RunTest

Source/URLabEditor/Private/Tests/MjFlexcompTests.cpp:37–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35 EAutomationTestFlags::EditorContext | EAutomationTestFlags::ProductFilter)
36
37bool FMjFlexcompGrid2DCompiles::RunTest(const FString& Parameters)
38{
39 FMjUESession S;
40 bool bOk = S.Init([](FMjUESession& Session) {
41 UMjFlexcomp* Flex = NewObject<UMjFlexcomp>(Session.Robot, TEXT("TestFlex"));
42 Flex->bOverride_FlexcompType = true;
43 Flex->FlexcompType = EMjFlexcompType::Grid;
44 Flex->bOverride_dim = true;
45 Flex->dim = 2;
46 Flex->bOverride_count = true;
47 Flex->count = {4, 4, 1};
48 Flex->bOverride_spacing = true;
49 Flex->spacing = {0.05, 0.05, 0.05};
50 Flex->bOverride_mass = true;
51 Flex->mass = 0.5f;
52 Flex->bOverride_radius = true;
53 Flex->radius = 0.005f;
54 Flex->MjName = TEXT("testgrid");
55 Flex->RegisterComponent();
56 Flex->AttachToComponent(Session.Body, FAttachmentTransformRules::KeepRelativeTransform);
57 });
58
59 if (!bOk)
60 {
61 AddError(FString::Printf(TEXT("Init failed: %s"), *S.LastError));
62 S.Cleanup();
63 return false;
64 }
65
66 mjModel* M = S.Manager->PhysicsEngine->m_model;
67 TestTrue(TEXT("Model should have at least 1 flex"), M->nflex >= 1);
68
69 S.Cleanup();
70 return true;
71}
72
73// ============================================================================
74// URLab.Flexcomp.Grid1D_Compiles

Callers

nothing calls this directly

Calls 3

NearlyEqualFunction · 0.85
InitMethod · 0.45
CleanupMethod · 0.45

Tested by

no test coverage detected