84 lines
4.2 KiB
TypeScript
84 lines
4.2 KiB
TypeScript
// Movement/Tests/FT_BasicMovement.ts
|
|
|
|
import { AC_DebugHUD } from '#root/Debug/Components/AC_DebugHUD.ts';
|
|
import { AC_Movement } from '#root/Movement/Components/AC_Movement.ts';
|
|
import { E_MovementState } from '#root/Movement/Enums/E_MovementState.ts';
|
|
import { EFunctionalTestResult } from '#root/UE/EFunctionalTestResult.ts';
|
|
import { FunctionalTest } from '#root/UE/FunctionalTest.ts';
|
|
import { StringLibrary } from '#root/UE/StringLibrary.ts';
|
|
|
|
/**
|
|
* Functional Test: Basic Movement System
|
|
* Tests fundamental movement mechanics: acceleration, friction, max speed
|
|
* Validates movement state transitions and input processing
|
|
*/
|
|
export class FT_BasicMovement extends FunctionalTest {
|
|
// ════════════════════════════════════════════════════════════════════════════════════════
|
|
// GRAPHS
|
|
// ════════════════════════════════════════════════════════════════════════════════════════
|
|
|
|
// ────────────────────────────────────────────────────────────────────────────────────────
|
|
// EventGraph
|
|
// ────────────────────────────────────────────────────────────────────────────────────────
|
|
|
|
/**
|
|
* Test execution - validates basic movement functionality
|
|
* Tests initialization, input processing, state management
|
|
*/
|
|
EventStartTest(): void {
|
|
// Initialize movement system
|
|
this.MovementComponent.InitializeMovementSystem(
|
|
null,
|
|
this.DebugHUDComponent
|
|
);
|
|
|
|
// Test 1: Initialization
|
|
if (this.MovementComponent.GetIsInitialized()) {
|
|
// Test 2: Initial state should be Idle
|
|
if (this.MovementComponent.GetMovementState() === E_MovementState.Idle) {
|
|
// Test 3: Initial speed & velocity is zero
|
|
|
|
if (
|
|
this.MovementComponent.GetCurrentSpeed() === 0 &&
|
|
this.MovementComponent.GetCurrentVelocity().X === 0 &&
|
|
this.MovementComponent.GetCurrentVelocity().Y === 0 &&
|
|
this.MovementComponent.GetCurrentVelocity().Z === 0
|
|
) {
|
|
this.FinishTest(EFunctionalTestResult.Succeeded);
|
|
} else {
|
|
this.FinishTest(
|
|
EFunctionalTestResult.Failed,
|
|
`Current Speed & Current velocity should be zero, got Speed: ${this.MovementComponent.GetCurrentSpeed()}, Velocity: ${StringLibrary.ConvVectorToString(this.MovementComponent.GetCurrentVelocity())}`
|
|
);
|
|
}
|
|
} else {
|
|
this.FinishTest(
|
|
EFunctionalTestResult.Failed,
|
|
`Initial movement state should be Idle, got ${this.MovementComponent.GetMovementState()}`
|
|
);
|
|
}
|
|
} else {
|
|
this.FinishTest(
|
|
EFunctionalTestResult.Failed,
|
|
'Movement system failed to initialize'
|
|
);
|
|
}
|
|
}
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════════════════
|
|
// VARIABLES
|
|
// ════════════════════════════════════════════════════════════════════════════════════════
|
|
|
|
/**
|
|
* Movement system component - component under test
|
|
* @category Components
|
|
*/
|
|
private MovementComponent = new AC_Movement();
|
|
|
|
/**
|
|
* Debug HUD system - displays test status and parameters
|
|
* @category Components
|
|
*/
|
|
private DebugHUDComponent = new AC_DebugHUD();
|
|
}
|