tengri/Content/Debug/Tests/FT_DebugPageContentGenerato...

126 lines
5.2 KiB
TypeScript

// Debug/Tests/FT_DebugPageContentGenerator.ts
import { AC_Camera } from '#root/Camera/Components/AC_Camera.ts';
import { AC_DebugHUD } from '#root/Debug/Components/AC_DebugHUD.ts';
import { E_DebugPageID } from '#root/Debug/Enums/E_DebugPageID.ts';
import { E_DebugUpdateFunction } from '#root/Debug/Enums/E_DebugUpdateFunction.ts';
import type { S_DebugPage } from '#root/Debug/Structs/S_DebugPage.ts';
import { AC_InputDevice } from '#root/Input/Components/AC_InputDevice.ts';
import { AC_Movement } from '#root/Movement/Components/AC_Movement.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: Debug HUD Page Content Generation
* Validates that all registered debug pages generate non-empty content
*/
export class FT_DebugPageContentGenerator extends FunctionalTest {
// ════════════════════════════════════════════════════════════════════════════════════════
// GRAPHS
// ════════════════════════════════════════════════════════════════════════════════════════
// ────────────────────────────────────────────────────────────────────────────────────────
// EventGraph
// ────────────────────────────────────────────────────────────────────────────────────────
/**
* Test entry point - validates content generation for all debug pages
* Iterates through all pages and tests their update functions
*/
EventStartTest(): void {
this.DebugHUDComponent.InitializeDebugHUD(
this.MovementComponent,
this.ToastSystemComponent,
this.InputDeviceComponent,
this.CameraComponent
);
this.DebugHUDComponent.GetTestData().DebugPages.forEach(
(arrayElement, arrayIndex) => {
this.UpdatedPage = arrayElement;
switch (this.UpdatedPage.UpdateFunction) {
case E_DebugUpdateFunction.UpdateMovementPage: {
this.UpdatedPage = this.DebugHUDComponent.UpdateMovementPage(
this.UpdatedPage
);
break;
}
case E_DebugUpdateFunction.UpdateSurfacePage: {
this.UpdatedPage = this.DebugHUDComponent.UpdateSurfacePage(
this.UpdatedPage
);
break;
}
case E_DebugUpdateFunction.UpdatePerformancePage: {
this.UpdatedPage = this.DebugHUDComponent.UpdatePerformancePage(
this.UpdatedPage
);
break;
}
}
if (this.UpdatedPage.Content.length > 0) {
this.FinishTest(EFunctionalTestResult.Succeeded);
} else {
this.FinishTest(
EFunctionalTestResult.Failed,
`DebugHUD: Page ${arrayIndex + 1} content empty`
);
}
}
);
}
// ════════════════════════════════════════════════════════════════════════════════════════
// VARIABLES
// ════════════════════════════════════════════════════════════════════════════════════════
/**
* Movement system component - required for debug HUD initialization
* @category Components
*/
MovementComponent = new AC_Movement();
/**
* Debug HUD system - primary component under test
* Tests page content generation functionality
* @category Components
*/
DebugHUDComponent = new AC_DebugHUD();
/**
* Toast notification system - required for debug HUD initialization
* @category Components
*/
ToastSystemComponent = new AC_ToastSystem();
/**
* Input device detection system - used for input device debug page testing
* @category Components
*/
InputDeviceComponent = new AC_InputDevice();
/**
* Camera system component - included for completeness, not directly tested
* @category Components
*/
CameraComponent = new AC_Camera();
/**
* Working copy of debug page for content generation testing
* Updated during test execution for each page
* @category Test State
*/
UpdatedPage: S_DebugPage = {
PageID: E_DebugPageID.MovementInfo,
Title: '',
Content: '',
IsVisible: false,
UpdateFunction: E_DebugUpdateFunction.UpdateMovementPage,
};
}