| import assert from 'node:assert/strict'; | |
| import { access, readFile } from 'node:fs/promises'; | |
| import { dirname, join } from 'node:path'; | |
| import { fileURLToPath } from 'node:url'; | |
| const root = join(dirname(fileURLToPath(import.meta.url)), '..', 'phase2-unreal'); | |
| const requiredFiles = [ | |
| 'GitWorldUnreal.uproject', | |
| 'Config/DefaultEngine.ini', | |
| 'Source/GitWorldUnreal/GitWorldUnreal.Build.cs', | |
| 'Source/GitWorldUnreal/Public/GitWorldData.h', | |
| 'Source/GitWorldUnreal/Public/GitWorldRepoWorld.h', | |
| 'Source/GitWorldUnreal/Public/GitWorldRepoPortal.h', | |
| 'Source/GitWorldUnreal/Public/GitWorldWorldSubsystem.h', | |
| 'Source/GitWorldUnreal/Public/GitWorldCudaBridge.h', | |
| 'Source/GitWorldUnreal/Public/GitWorldOpeningScene.h', | |
| 'Source/GitWorldUnreal/Public/GitWorldVRPawn.h', | |
| 'RealityCapture/Tools/reconstruct.ps1', | |
| 'Content/RealityScene/README.md', | |
| 'ReferenceSource/manifest.json', | |
| 'EditorScripts/import_gitworld_reference_scene.py', | |
| 'EditorScripts/import_gitworld_opening.py', | |
| 'Content/VR/README.md', | |
| 'Compute/CMakeLists.txt', | |
| 'Compute/GitWorldBuildPass.cu' | |
| ]; | |
| for (const file of requiredFiles) { | |
| await access(join(root, file)); | |
| } | |
| const project = JSON.parse(await readFile(join(root, 'GitWorldUnreal.uproject'), 'utf8')); | |
| assert.equal(project.Modules[0].Name, 'GitWorldUnreal'); | |
| assert.equal(project.Plugins.some((plugin) => plugin.Name === 'OpenXR' && plugin.Enabled === true), true); | |
| const buildRules = await readFile(join(root, 'Source', 'GitWorldUnreal', 'GitWorldUnreal.Build.cs'), 'utf8'); | |
| assert.match(buildRules, /RuntimeDependencies\.Add/); | |
| assert.match(buildRules, /3099\.mp4/); | |
| const engine = await readFile(join(root, 'Config', 'DefaultEngine.ini'), 'utf8'); | |
| assert.match(engine, /r\.Nanite\.ProjectEnabled=(?:1|True)/); | |
| assert.match(engine, /r\.Lumen\.HardwareRayTracing=(?:1|True)/); | |
| assert.match(engine, /ResolutionSizeX=7680/); | |
| assert.match(engine, /ResolutionSizeY=4320/); | |
| const sourceFiles = [ | |
| 'Source/GitWorldUnreal/Public/GitWorldRepoWorld.h', | |
| 'Source/GitWorldUnreal/Private/GitWorldSimulation.cpp', | |
| 'Source/GitWorldUnreal/Private/GitWorldRepoWorld.cpp', | |
| 'Source/GitWorldUnreal/Private/GitWorldRepoPortal.cpp', | |
| 'Source/GitWorldUnreal/Private/GitWorldWorldSubsystem.cpp', | |
| 'Source/GitWorldUnreal/Private/GitWorldCudaBridge.cpp', | |
| 'Source/GitWorldUnreal/Private/GitWorldGameMode.cpp', | |
| 'Source/GitWorldUnreal/Private/GitWorldOpeningScene.cpp', | |
| 'Source/GitWorldUnreal/Private/GitWorldVRPawn.cpp' | |
| ]; | |
| const source = (await Promise.all(sourceFiles.map((file) => readFile(join(root, file), 'utf8')))).join('\n'); | |
| for (const required of ['AdvanceSnapshot', 'ActivateRepository', 'SpawnDemoRepositoryWorld', 'GW_CudaBuildPass', 'TerminalTranscript', 'RealityCaptureMesh', 'ReferenceSetId', 'ReferenceImages', 'OpenUrl', 'OnEndReached', 'SetTrackingOrigin', 'InteractWithWorld', 'CompleteTeleport']) { | |
| assert.match(source, new RegExp(required)); | |
| } | |
| assert.doesNotMatch(source, /ironic-mirror|shadow-orchestrator/i); | |
| const captureScript = await readFile(join(root, 'RealityCapture', 'Tools', 'reconstruct.ps1'), 'utf8'); | |
| for (const required of ['-addFolder', '-align', '-selectMaximalComponent', '-calculateTexture', '-exportSelectedModel']) { | |
| assert.match(captureScript, new RegExp(required.replace('-', '\\-'))); | |
| } | |
| const referenceManifest = JSON.parse(await readFile(join(root, 'ReferenceSource', 'manifest.json'), 'utf8')); | |
| assert.equal(referenceManifest.photogrammetryReady, false); | |
| assert.equal(referenceManifest.assets.length, 4); | |
| assert.equal(referenceManifest.openingScene.file, 'Opening/3099.mp4'); | |
| const editorScript = await readFile(join(root, 'EditorScripts', 'import_gitworld_reference_scene.py'), 'utf8'); | |
| for (const required of ['AssetImportTask', 'create_material_expression', 'reference_images', 'save_current_level']) { | |
| assert.match(editorScript, new RegExp(required)); | |
| } | |
| const openingScript = await readFile(join(root, 'EditorScripts', 'import_gitworld_opening.py'), 'utf8'); | |
| for (const required of ['3099.mp4', 'FileMediaSourceFactoryNew', 'MediaPlayerFactoryNew', 'MediaTextureFactoryNew', 'GitWorldOpeningScene']) { | |
| assert.match(openingScript, new RegExp(required)); | |
| } | |
| const openingVideo = await readFile(join(root, 'ReferenceSource', 'Opening', '3099.mp4')); | |
| assert.ok(openingVideo.length > 0); | |
| console.log(`Phase 3 contract PASS: ${requiredFiles.length} files present; reference plates and opening video wired; Unreal execution still requires the local editor.`); | |