// Camera/Tests/FT_CameraSensitivity.ts import { AC_Camera } from '#root/Camera/Components/AC_Camera.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'; import { Vector } from '#root/UE/Vector.ts'; /** * Functional Test: Camera Sensitivity System * Tests device-specific sensitivity and device detection integration * Validates mouse vs gamepad sensitivity differences */ export class FT_CameraSensitivity extends FunctionalTest { // ════════════════════════════════════════════════════════════════════════════════════════ // GRAPHS // ════════════════════════════════════════════════════════════════════════════════════════ // ──────────────────────────────────────────────────────────────────────────────────────── // EventGraph // ──────────────────────────────────────────────────────────────────────────────────────── /** * Test execution - validates sensitivity calculations * Tests device detection and appropriate sensitivity application */ EventStartTest(): void { // Initialize system this.ToastSystemComponent.InitializeToastSystem(); this.InputDeviceComponent.InitializeDeviceDetection( this.ToastSystemComponent ); this.CameraComponent.InitializeCameraSystem(this.InputDeviceComponent); // Test 1: Verify sensitivity settings are loaded correctly const { MouseSensitivity: mouseSens, GamepadSensitivity: gamepadSens } = this.CameraComponent.CameraSettings; if (mouseSens > 0 && gamepadSens > 0) { // Test 2: Apply input and verify rotation occurs this.CameraComponent.ProcessLookInput(new Vector(1.0, 0.0, 0.0), 0.016); this.CameraComponent.UpdateCameraRotation(0.016); if (this.CameraComponent.GetCameraRotation().Yaw !== 0.0) { // Test 3: Verify IsCameraRotating() works with input this.CameraComponent.ProcessLookInput(new Vector(1.0, 1.0, 0.0), 0.016); if (this.CameraComponent.IsCameraRotating()) { // Test 4: Verify IsCameraRotating() resets with zero input this.CameraComponent.ProcessLookInput( new Vector(0.0, 0.0, 0.0), 0.016 ); if (!this.CameraComponent.IsCameraRotating()) { this.FinishTest(EFunctionalTestResult.Succeeded); } else { this.FinishTest( EFunctionalTestResult.Failed, 'IsCameraRotating should return false with zero input' ); } } else { this.FinishTest( EFunctionalTestResult.Failed, 'IsCameraRotating should return true with active input' ); } } else { this.FinishTest( EFunctionalTestResult.Failed, 'Input should produce rotation change' ); } } else { this.FinishTest( EFunctionalTestResult.Failed, 'Mouse and gamepad sensitivities should be different' ); } } // ════════════════════════════════════════════════════════════════════════════════════════ // 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(); }