tengri/Content/Camera/Tests/FT_CameraInitialization.ts

102 lines
4.4 KiB
TypeScript

// Camera/Tests/FT_CameraInitialization.ts
import { AC_Camera } from '#root/Camera/Components/AC_Camera.ts';
import { AC_DebugHUD } from '#root/Debug/Components/AC_DebugHUD.ts';
import { AC_InputDevice } from '#root/Input/Components/AC_InputDevice.ts';
import { AC_ToastSystem } from '#root/Toasts/Components/AC_ToastSystem.ts';
import { EFunctionalTestResult } from '#root/UE/EFunctionalTestResult.ts';
import { FunctionalTest } from '#root/UE/FunctionalTest.ts';
/**
* Functional Test: Camera System Initialization
* Tests basic camera initialization and device integration
* Validates initial state and component references
*/
export class FT_CameraInitialization extends FunctionalTest {
// ════════════════════════════════════════════════════════════════════════════════════════
// GRAPHS
// ════════════════════════════════════════════════════════════════════════════════════════
// ────────────────────────────────────────────────────────────────────────────────────────
// EventGraph
// ────────────────────────────────────────────────────────────────────────────────────────
/**
* Test execution - validates camera initialization
* Tests default values, device integration, and state consistency
*/
EventStartTest(): void {
// Initialize dependencies
this.ToastSystemComponent.InitializeToastSystem();
this.InputDeviceComponent.InitializeDeviceDetection(
this.ToastSystemComponent,
this.DebugHUDComponent
);
// Initialize camera system
this.CameraComponent.InitializeCameraSystem(
this.InputDeviceComponent,
this.DebugHUDComponent
);
// Validate initialization
if (
this.CameraComponent.InputDeviceComponent === this.InputDeviceComponent
) {
// Validate initial state
const { Pitch: pitch, Yaw: yaw } =
this.CameraComponent.GetCameraRotation();
if (pitch === 0.0 && yaw === 0.0) {
// Validate not rotating initially
if (!this.CameraComponent.IsCameraRotating()) {
this.FinishTest(EFunctionalTestResult.Succeeded);
} else {
this.FinishTest(
EFunctionalTestResult.Failed,
'Camera should not be rotating initially'
);
}
} else {
this.FinishTest(
EFunctionalTestResult.Failed,
`Initial rotation should be 0,0 but got Pitch=${pitch}, Yaw=${yaw}`
);
}
} else {
this.FinishTest(
EFunctionalTestResult.Failed,
'Input device component reference not set correctly'
);
}
}
// ════════════════════════════════════════════════════════════════════════════════════════
// VARIABLES
// ════════════════════════════════════════════════════════════════════════════════════════
/**
* Camera system component - component under test
* @category Components
*/
private CameraComponent = new AC_Camera();
/**
* Input device detection system - required for camera initialization
* @category Components
*/
private InputDeviceComponent = new AC_InputDevice();
/**
* Toast notification system - required for input device initialization
* @category Components
*/
private ToastSystemComponent = new AC_ToastSystem();
/**
* Debug HUD system - displays test status and parameters
* @category Components
*/
private DebugHUDComponent = new AC_DebugHUD();
}