| 59 | EAutomationTestFlags::EditorContext | EAutomationTestFlags::ProductFilter) |
| 60 | |
| 61 | bool FMjDcMotorImportCreatesComponents::RunTest(const FString& Parameters) |
| 62 | { |
| 63 | FMjXmlImportSession S; |
| 64 | if (!S.Init(kDcMotorArmXml)) |
| 65 | { |
| 66 | AddError(FString::Printf(TEXT("Init failed: %s"), *S.LastError)); |
| 67 | return false; |
| 68 | } |
| 69 | |
| 70 | UMjDcMotorActuator* DcBias = S.FindTemplate<UMjDcMotorActuator>(TEXT("dc_bias")); |
| 71 | UMjDcMotorActuator* DcLugre = S.FindTemplate<UMjDcMotorActuator>(TEXT("dc_lugre")); |
| 72 | |
| 73 | TestNotNull(TEXT("dc_bias component"), DcBias); |
| 74 | TestNotNull(TEXT("dc_lugre component"), DcLugre); |
| 75 | |
| 76 | if (DcBias) |
| 77 | { |
| 78 | TestTrue(TEXT("dc_bias: Type == DcMotor"), DcBias->Type == EMjActuatorType::DcMotor); |
| 79 | TestTrue(TEXT("dc_bias: motorconst overridden"), DcBias->bOverride_motorconst); |
| 80 | if (DcBias->bOverride_motorconst && DcBias->motorconst.Num() >= 1) |
| 81 | { |
| 82 | TestEqual(TEXT("dc_bias: motorconst[0]"), DcBias->motorconst[0], 2.0f); |
| 83 | } |
| 84 | TestTrue(TEXT("dc_bias: resistance overridden"), DcBias->bOverride_resistance); |
| 85 | TestEqual(TEXT("dc_bias: resistance"), DcBias->resistance, 0.5f); |
| 86 | } |
| 87 | |
| 88 | if (DcLugre) |
| 89 | { |
| 90 | TestTrue(TEXT("dc_lugre: lugre overridden"), DcLugre->bOverride_lugre); |
| 91 | TestEqual(TEXT("dc_lugre: lugre length"), DcLugre->lugre.Num(), 5); |
| 92 | if (DcLugre->lugre.Num() == 5) |
| 93 | { |
| 94 | TestEqual(TEXT("dc_lugre: lugre[0]"), DcLugre->lugre[0], 1.0e4f); |
| 95 | TestEqual(TEXT("dc_lugre: lugre[4]"), DcLugre->lugre[4], 0.1f); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | return true; |
| 100 | } |
| 101 | |
| 102 | // ============================================================================ |
| 103 | // URLab.DcMotor.Compile_MatchesNativeActuatorCount |