diff --git a/editor/app/Platform/Win32/Runtime/EditorWindowRuntimeController.cpp b/editor/app/Platform/Win32/Runtime/EditorWindowRuntimeController.cpp index e0daacb4..3125182c 100644 --- a/editor/app/Platform/Win32/Runtime/EditorWindowRuntimeController.cpp +++ b/editor/app/Platform/Win32/Runtime/EditorWindowRuntimeController.cpp @@ -180,15 +180,9 @@ bool EditorWindowRuntimeController::Initialize( if (const EditorWindowWorkspaceBinding* workspaceBinding = TryGetWorkspaceBinding(); workspaceBinding != nullptr) { - const UIEditorWorkspaceController* workspaceController = - workspaceBinding->TryGetWorkspaceController(); - assert(workspaceController != nullptr); LogRuntimeTrace( "app", - "shell runtime initialized: " + - editorContext.DescribeWorkspaceState( - *workspaceController, - m_contentController->GetShellInteractionState())); + "shell runtime initialized: workspace content"); } else { LogRuntimeTrace("app", "window content initialized: non-workspace content"); } diff --git a/editor/app/Platform/Win32/Windowing/EditorWindow.cpp b/editor/app/Platform/Win32/Windowing/EditorWindow.cpp index 2c1f9c94..7666259d 100644 --- a/editor/app/Platform/Win32/Windowing/EditorWindow.cpp +++ b/editor/app/Platform/Win32/Windowing/EditorWindow.cpp @@ -166,13 +166,6 @@ std::string_view EditorWindow::GetCachedTitleText() const { return m_session->GetCachedTitleText(); } -const UIEditorWorkspaceController* EditorWindow::TryGetWorkspaceController() const { - const EditorWindowWorkspaceBinding* workspaceBinding = m_runtime->TryGetWorkspaceBinding(); - return workspaceBinding != nullptr - ? workspaceBinding->TryGetWorkspaceController() - : nullptr; -} - const EditorWorkspaceWindowProjection* EditorWindow::TryGetWorkspaceProjection() const { const EditorWindowWorkspaceBinding* workspaceBinding = m_runtime->TryGetWorkspaceBinding(); return workspaceBinding != nullptr @@ -180,12 +173,6 @@ const EditorWorkspaceWindowProjection* EditorWindow::TryGetWorkspaceProjection() : nullptr; } -const UIEditorWorkspaceController& EditorWindow::GetWorkspaceController() const { - const UIEditorWorkspaceController* workspaceController = TryGetWorkspaceController(); - assert(workspaceController != nullptr); - return *workspaceController; -} - EditorWindowDockHostBinding* EditorWindow::TryGetDockHostBinding() { return m_runtime->TryGetDockHostBinding(); } diff --git a/editor/app/Platform/Win32/Windowing/EditorWindow.h b/editor/app/Platform/Win32/Windowing/EditorWindow.h index 40647c69..0821a1f0 100644 --- a/editor/app/Platform/Win32/Windowing/EditorWindow.h +++ b/editor/app/Platform/Win32/Windowing/EditorWindow.h @@ -94,9 +94,7 @@ public: bool HasLiveHostWindow() const override; const std::wstring& GetTitle() const override; std::string_view GetCachedTitleText() const; - const UIEditorWorkspaceController* TryGetWorkspaceController() const override; const EditorWorkspaceWindowProjection* TryGetWorkspaceProjection() const override; - const UIEditorWorkspaceController& GetWorkspaceController() const; EditorWindowDockHostBinding* TryGetDockHostBinding() override; const EditorWindowDockHostBinding* TryGetDockHostBinding() const override; ::XCEngine::UI::UIPoint ConvertScreenPixelsToClientDips( diff --git a/editor/app/Windowing/Content/EditorWindowContentController.h b/editor/app/Windowing/Content/EditorWindowContentController.h index a1351f64..4b616a31 100644 --- a/editor/app/Windowing/Content/EditorWindowContentController.h +++ b/editor/app/Windowing/Content/EditorWindowContentController.h @@ -31,9 +31,6 @@ struct UISize; } // namespace XCEngine::UI namespace XCEngine::UI::Editor { - -class UIEditorWorkspaceController; - struct UIEditorShellInteractionFrame; struct UIEditorShellInteractionState; @@ -73,7 +70,6 @@ class EditorWindowWorkspaceBinding { public: virtual ~EditorWindowWorkspaceBinding() = default; - virtual const UIEditorWorkspaceController* TryGetWorkspaceController() const = 0; virtual const EditorWorkspaceWindowProjection* TryGetWorkspaceProjection() const = 0; virtual void RefreshWorkspaceProjection(EditorWorkspaceWindowProjection projection) = 0; }; diff --git a/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.cpp b/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.cpp index 9ed0f98e..002f668d 100644 --- a/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.cpp +++ b/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.cpp @@ -11,6 +11,16 @@ namespace XCEngine::UI::Editor::App { namespace { +UIEditorWindowWorkspaceState BuildWindowStateFromController( + std::string_view windowId, + const UIEditorWorkspaceController& workspaceController) { + UIEditorWindowWorkspaceState windowState = {}; + windowState.windowId = std::string(windowId); + windowState.workspace = workspaceController.GetWorkspace(); + windowState.session = workspaceController.GetSession(); + return windowState; +} + EditorWindowContentCursorKind ToContentCursorKind(ProjectPanel::CursorKind cursorKind) { switch (cursorKind) { case ProjectPanel::CursorKind::ResizeEW: @@ -35,12 +45,8 @@ EditorWindowContentCursorKind ToContentCursorKind( } EditorWorkspaceWindowProjection BuildWorkspaceProjectionFromController( - const UIEditorWorkspaceController& workspaceController, - std::string_view windowId) { + const UIEditorWorkspaceController& workspaceController) { EditorWorkspaceWindowProjection projection = {}; - projection.windowState.windowId = std::string(windowId); - projection.windowState.workspace = workspaceController.GetWorkspace(); - projection.windowState.session = workspaceController.GetSession(); projection.minimumOuterSize = ResolveUIEditorDetachedWorkspaceMinimumOuterSize( workspaceController); projection.useDetachedTitleBarTabStrip = HasUIEditorSingleVisibleRootTab(workspaceController); @@ -56,9 +62,8 @@ EditorWorkspaceWindowContentController::EditorWorkspaceWindowContentController( UIEditorWorkspaceController workspaceController, EditorWindowSystem& windowSystem) : m_windowId(std::move(windowId)), - m_workspaceController(std::move(workspaceController)), m_windowSystem(windowSystem) { - RefreshProjectionFromWorkspaceController(); + RefreshProjectionFromWorkspaceController(workspaceController); } EditorWorkspaceWindowContentController::~EditorWorkspaceWindowContentController() = default; @@ -103,11 +108,6 @@ EditorWorkspaceWindowContentController::TryGetTitleBarBinding() const { return this; } -const UIEditorWorkspaceController* -EditorWorkspaceWindowContentController::TryGetWorkspaceController() const { - return &m_workspaceController; -} - const EditorWorkspaceWindowProjection* EditorWorkspaceWindowContentController::TryGetWorkspaceProjection() const { return &m_projection; @@ -115,43 +115,39 @@ EditorWorkspaceWindowContentController::TryGetWorkspaceProjection() const { void EditorWorkspaceWindowContentController::RefreshWorkspaceProjection( EditorWorkspaceWindowProjection projection) { - projection.windowState.windowId = m_windowId; - const auto currentSnapshot = BuildUIEditorWorkspaceLayoutSnapshot( - m_workspaceController.GetWorkspace(), - m_workspaceController.GetSession()); - const auto nextSnapshot = BuildUIEditorWorkspaceLayoutSnapshot( - projection.windowState.workspace, - projection.windowState.session); - if (!AreUIEditorWorkspaceLayoutSnapshotsEquivalent(currentSnapshot, nextSnapshot)) { - m_workspaceController = UIEditorWorkspaceController( - m_workspaceController.GetPanelRegistry(), - projection.windowState.workspace, - projection.windowState.session); - } m_projection = std::move(projection); } -void EditorWorkspaceWindowContentController::RefreshProjectionFromWorkspaceController(bool primary) { +bool EditorWorkspaceWindowContentController::TryBuildAuthoritativeWorkspaceController( + UIEditorWorkspaceController& outController) const { + const UIEditorWindowWorkspaceState* windowState = + m_windowSystem.FindWindowState(m_windowId); + if (windowState == nullptr) { + return false; + } + + outController = BuildWorkspaceControllerForWindowState( + m_windowSystem.GetPanelRegistry(), + *windowState); + return true; +} + +void EditorWorkspaceWindowContentController::RefreshProjectionFromWorkspaceController( + const UIEditorWorkspaceController& workspaceController, + bool primary) { const std::wstring preservedWindowTitle = m_projection.windowTitle; - m_projection = BuildWorkspaceProjectionFromController(m_workspaceController, m_windowId); + m_projection = BuildWorkspaceProjectionFromController(workspaceController); if (!primary) { m_projection.windowTitle = ResolveEditorWindowPresentationTitle( std::wstring_view{}, - m_workspaceController.GetPanelRegistry(), - m_projection.windowState, + workspaceController.GetPanelRegistry(), + BuildWindowStateFromController(m_windowId, workspaceController), false); } else if (!preservedWindowTitle.empty()) { m_projection.windowTitle = preservedWindowTitle; } } -void EditorWorkspaceWindowContentController::RestoreWorkspaceControllerFromProjection() { - m_workspaceController = UIEditorWorkspaceController( - m_workspaceController.GetPanelRegistry(), - m_projection.windowState.workspace, - m_projection.windowState.session); -} - void EditorWorkspaceWindowContentController::Initialize( const EditorWindowContentInitializationContext& context) { m_shellRuntime.Initialize(context.repoRoot, context.textureHost, context.textMeasurer); @@ -173,12 +169,21 @@ void EditorWorkspaceWindowContentController::SetViewportSurfacePresentationEnabl EditorWindowFrameTransferRequests EditorWorkspaceWindowContentController::UpdateAndAppend( const EditorWindowContentFrameContext& context, ::XCEngine::UI::UIDrawData& drawData) { + UIEditorWorkspaceController workspaceController = {}; + if (!TryBuildAuthoritativeWorkspaceController(workspaceController)) { + AppendUIEditorRuntimeTrace( + "window", + "workspace frame skipped: authoritative state missing for window '" + + m_windowId + "'"); + return {}; + } + const auto beforeSnapshot = BuildUIEditorWorkspaceLayoutSnapshot( - m_workspaceController.GetWorkspace(), - m_workspaceController.GetSession()); + workspaceController.GetWorkspace(), + workspaceController.GetSession()); EditorWindowFrameTransferRequests transferRequests = m_frameOrchestrator.UpdateAndAppend( context.editorContext, - m_workspaceController, + workspaceController, m_shellRuntime, context.bounds, context.inputEvents, @@ -189,21 +194,20 @@ EditorWindowFrameTransferRequests EditorWorkspaceWindowContentController::Update context.useDetachedTitleBarTabStrip, drawData); const auto afterSnapshot = BuildUIEditorWorkspaceLayoutSnapshot( - m_workspaceController.GetWorkspace(), - m_workspaceController.GetSession()); + workspaceController.GetWorkspace(), + workspaceController.GetSession()); if (!AreUIEditorWorkspaceLayoutSnapshotsEquivalent(beforeSnapshot, afterSnapshot)) { std::string error = {}; if (!m_windowSystem.CommitLiveWindowMutation( m_windowId, - m_workspaceController, + workspaceController, error)) { AppendUIEditorRuntimeTrace( "window", "workspace direct commit rejected for window '" + m_windowId + "': " + error); - RestoreWorkspaceControllerFromProjection(); } else { - RefreshProjectionFromWorkspaceController(context.primary); + RefreshProjectionFromWorkspaceController(workspaceController, context.primary); } } return transferRequests; diff --git a/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.h b/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.h index 3d34f1f9..1075174c 100644 --- a/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.h +++ b/editor/app/Windowing/Content/EditorWorkspaceWindowContentController.h @@ -32,7 +32,6 @@ public: const EditorWindowDockHostBinding* TryGetDockHostBinding() const override; const EditorWindowInputFeedbackBinding* TryGetInputFeedbackBinding() const override; const EditorWindowTitleBarBinding* TryGetTitleBarBinding() const override; - const UIEditorWorkspaceController* TryGetWorkspaceController() const override; const EditorWorkspaceWindowProjection* TryGetWorkspaceProjection() const override; void RefreshWorkspaceProjection(EditorWorkspaceWindowProjection projection) override; @@ -75,11 +74,12 @@ public: std::string_view fallbackWindowTitle) const override; private: - void RefreshProjectionFromWorkspaceController(bool primary = false); - void RestoreWorkspaceControllerFromProjection(); + bool TryBuildAuthoritativeWorkspaceController(UIEditorWorkspaceController& outController) const; + void RefreshProjectionFromWorkspaceController( + const UIEditorWorkspaceController& workspaceController, + bool primary = false); std::string m_windowId = {}; - UIEditorWorkspaceController m_workspaceController = {}; EditorWindowSystem& m_windowSystem; EditorWorkspaceWindowProjection m_projection = {}; EditorShellRuntime m_shellRuntime = {}; diff --git a/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.cpp b/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.cpp index 1a431927..2abef12b 100644 --- a/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.cpp +++ b/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.cpp @@ -40,19 +40,22 @@ EditorWindowScreenPoint BuildFallbackGlobalTabDragHotspot() { } bool CanStartGlobalTabDragFromWindow( + const EditorWindowSystem& windowSystem, const EditorHostWindow& sourceWindow, std::string_view sourceNodeId, std::string_view panelId) { - const UIEditorWorkspaceController* workspaceController = - sourceWindow.TryGetWorkspaceController(); - if (workspaceController == nullptr) { + const UIEditorWindowWorkspaceState* windowState = + windowSystem.FindWindowState(sourceWindow.GetWindowId()); + if (windowState == nullptr) { return false; } - UIEditorWorkspaceModel workspace = - workspaceController->GetWorkspace(); - UIEditorWorkspaceSession session = - workspaceController->GetSession(); + const UIEditorWorkspaceController workspaceController = + BuildWorkspaceControllerForWindowState( + windowSystem.GetPanelRegistry(), + *windowState); + UIEditorWorkspaceModel workspace = workspaceController.GetWorkspace(); + UIEditorWorkspaceSession session = workspaceController.GetSession(); UIEditorWorkspaceExtractedPanel extractedPanel = {}; return TryExtractUIEditorWorkspaceVisiblePanel( workspace, @@ -151,19 +154,13 @@ EditorWindowWorkspaceCoordinator::BuildWorkspaceMutationController() const { UIEditorWindowWorkspaceState EditorWindowWorkspaceCoordinator::BuildWindowStateForWindow( const EditorHostWindow& window) const { - if (const EditorWorkspaceWindowProjection* projection = window.TryGetWorkspaceProjection(); - projection != nullptr) { - return projection->windowState; + if (const UIEditorWindowWorkspaceState* windowState = + m_windowSystem.FindWindowState(window.GetWindowId()); + windowState != nullptr) { + return *windowState; } - UIEditorWindowWorkspaceState state = {}; - if (const UIEditorWorkspaceController* workspaceController = window.TryGetWorkspaceController(); - workspaceController != nullptr) { - state.windowId = std::string(window.GetWindowId()); - state.workspace = workspaceController->GetWorkspace(); - state.session = workspaceController->GetSession(); - } - return state; + return {}; } EditorWorkspaceWindowProjection EditorWindowWorkspaceCoordinator::BuildWorkspaceProjectionForState( @@ -201,9 +198,7 @@ bool EditorWindowWorkspaceCoordinator::RefreshWorkspaceProjectionFromAuthoritati } const UIEditorWindowWorkspaceState* authoritativeState = - FindUIEditorWindowWorkspaceState( - m_windowSystem.GetWindowSet(), - window.GetWindowId()); + m_windowSystem.FindWindowState(window.GetWindowId()); if (authoritativeState == nullptr) { return false; } @@ -306,10 +301,13 @@ std::vector EditorWindowWorkspaceCoordinator::CaptureH snapshot.destroyed = window->IsDestroyed(); snapshot.hasNativeWindow = window->HasLiveHostWindow(); snapshot.title = window->GetTitle(); - if (window->TryGetWorkspaceProjection() != nullptr || - window->TryGetWorkspaceController() != nullptr) { - snapshot.hasWorkspaceProjection = true; - snapshot.workspaceState = BuildWindowStateForWindow(*window); + if (window->IsWorkspaceWindow()) { + if (const UIEditorWindowWorkspaceState* windowState = + m_windowSystem.FindWindowState(window->GetWindowId()); + windowState != nullptr) { + snapshot.hasWorkspaceState = true; + snapshot.workspaceState = *windowState; + } } snapshots.push_back(std::move(snapshot)); } @@ -735,16 +733,16 @@ bool EditorWindowWorkspaceCoordinator::TryStartGlobalTabDrag( return false; } - const EditorWorkspaceWindowProjection* detachedProjection = - detachedWindow->TryGetWorkspaceProjection(); - if (detachedProjection == nullptr) { - LogRuntimeTrace("drag", "detached drag window projection was not initialized."); + const UIEditorWindowWorkspaceState* detachedWindowState = + m_windowSystem.FindWindowState(result.targetWindowId); + if (detachedWindowState == nullptr) { + LogRuntimeTrace("drag", "detached drag window state was not committed."); return false; } BeginGlobalTabDragSession( detachedWindow->GetWindowId(), - detachedProjection->windowState.workspace.root.nodeId, + detachedWindowState->workspace.root.nodeId, request.panelId, request.screenPoint, dragHotspot); @@ -784,7 +782,11 @@ bool EditorWindowWorkspaceCoordinator::TryStartGlobalTabDrag( "failed to start global tab drag from detached window: " + result.message); return false; } - if (!CanStartGlobalTabDragFromWindow(sourceWindow, request.nodeId, request.panelId)) { + if (!CanStartGlobalTabDragFromWindow( + m_windowSystem, + sourceWindow, + request.nodeId, + request.panelId)) { LogRuntimeTrace( "drag", "failed to start global tab drag from detached window: invalid source panel request"); diff --git a/editor/app/Windowing/EditorWorkspaceWindowProjection.h b/editor/app/Windowing/EditorWorkspaceWindowProjection.h index e0305035..0f9ce22c 100644 --- a/editor/app/Windowing/EditorWorkspaceWindowProjection.h +++ b/editor/app/Windowing/EditorWorkspaceWindowProjection.h @@ -1,6 +1,5 @@ #pragma once -#include #include #include @@ -8,7 +7,6 @@ namespace XCEngine::UI::Editor::App { struct EditorWorkspaceWindowProjection { - UIEditorWindowWorkspaceState windowState = {}; ::XCEngine::UI::UISize minimumOuterSize = ::XCEngine::UI::UISize(640.0f, 360.0f); bool useDetachedTitleBarTabStrip = false; std::string tabStripTitleText = {}; diff --git a/editor/app/Windowing/Host/EditorWindowHostInterfaces.h b/editor/app/Windowing/Host/EditorWindowHostInterfaces.h index 2e601b42..a1a54f43 100644 --- a/editor/app/Windowing/Host/EditorWindowHostInterfaces.h +++ b/editor/app/Windowing/Host/EditorWindowHostInterfaces.h @@ -42,7 +42,6 @@ public: virtual bool IsDestroyed() const = 0; virtual bool HasLiveHostWindow() const = 0; virtual const std::wstring& GetTitle() const = 0; - virtual const UIEditorWorkspaceController* TryGetWorkspaceController() const = 0; virtual const EditorWorkspaceWindowProjection* TryGetWorkspaceProjection() const = 0; virtual EditorWindowDockHostBinding* TryGetDockHostBinding() = 0; virtual const EditorWindowDockHostBinding* TryGetDockHostBinding() const = 0; diff --git a/editor/app/Windowing/System/EditorWindowPresentationPolicy.cpp b/editor/app/Windowing/System/EditorWindowPresentationPolicy.cpp index c28b7205..fb04dabe 100644 --- a/editor/app/Windowing/System/EditorWindowPresentationPolicy.cpp +++ b/editor/app/Windowing/System/EditorWindowPresentationPolicy.cpp @@ -32,7 +32,6 @@ EditorWorkspaceWindowProjection BuildEditorWorkspaceWindowProjection( BuildWorkspaceControllerForWindowState(panelRegistry, windowState); EditorWorkspaceWindowProjection projection = {}; - projection.windowState = windowState; projection.minimumOuterSize = ResolveUIEditorDetachedWorkspaceMinimumOuterSize( workspaceController); projection.useDetachedTitleBarTabStrip = HasUIEditorSingleVisibleRootTab(workspaceController); diff --git a/editor/app/Windowing/System/EditorWindowSynchronizationPlan.h b/editor/app/Windowing/System/EditorWindowSynchronizationPlan.h index eedc4a6c..3b82aa8b 100644 --- a/editor/app/Windowing/System/EditorWindowSynchronizationPlan.h +++ b/editor/app/Windowing/System/EditorWindowSynchronizationPlan.h @@ -17,7 +17,7 @@ struct EditorWindowHostSnapshot { bool running = false; bool destroyed = false; bool hasNativeWindow = false; - bool hasWorkspaceProjection = false; + bool hasWorkspaceState = false; UIEditorWindowWorkspaceState workspaceState = {}; std::wstring title = {}; }; diff --git a/editor/app/Windowing/System/EditorWindowSynchronizationPlanner.cpp b/editor/app/Windowing/System/EditorWindowSynchronizationPlanner.cpp index 1ce7f52e..7898c477 100644 --- a/editor/app/Windowing/System/EditorWindowSynchronizationPlanner.cpp +++ b/editor/app/Windowing/System/EditorWindowSynchronizationPlanner.cpp @@ -99,7 +99,7 @@ EditorWindowSynchronizationPlan EditorWindowSynchronizationPlanner::Build( } const bool needsUpdate = - !existingSnapshot->hasWorkspaceProjection || + !existingSnapshot->hasWorkspaceState || !AreWindowWorkspaceStatesEquivalent( existingSnapshot->workspaceState, targetWindowState) || diff --git a/editor/app/Windowing/System/EditorWindowSystem.cpp b/editor/app/Windowing/System/EditorWindowSystem.cpp index 0c4b1a9e..e6ed6332 100644 --- a/editor/app/Windowing/System/EditorWindowSystem.cpp +++ b/editor/app/Windowing/System/EditorWindowSystem.cpp @@ -50,6 +50,11 @@ const UIEditorWindowWorkspaceSet& EditorWindowSystem::GetWindowSet() const { return m_workspaceStore.GetWindowSet(); } +const UIEditorWindowWorkspaceState* EditorWindowSystem::FindWindowState( + std::string_view windowId) const { + return FindUIEditorWindowWorkspaceState(GetWindowSet(), windowId); +} + UIEditorWindowWorkspaceController EditorWindowSystem::BuildWorkspaceMutationController() const { return UIEditorWindowWorkspaceController(GetPanelRegistry(), GetWindowSet()); } diff --git a/editor/app/Windowing/System/EditorWindowSystem.h b/editor/app/Windowing/System/EditorWindowSystem.h index e568dfe8..fe9475f3 100644 --- a/editor/app/Windowing/System/EditorWindowSystem.h +++ b/editor/app/Windowing/System/EditorWindowSystem.h @@ -28,6 +28,7 @@ public: bool IsPrimaryWindowId(std::string_view windowId) const; const UIEditorWindowWorkspaceSet& GetWindowSet() const; + const UIEditorWindowWorkspaceState* FindWindowState(std::string_view windowId) const; UIEditorWindowWorkspaceController BuildWorkspaceMutationController() const; bool CommitLiveWindowMutation( std::string_view windowId, diff --git a/Rendering/AGENTS.md b/engine/include/XCEngine/Rendering/AGENTS.md similarity index 100% rename from Rendering/AGENTS.md rename to engine/include/XCEngine/Rendering/AGENTS.md diff --git a/scripts/Run-RendererPhaseRegression.ps1 b/scripts/Run-RendererPhaseRegression.ps1 deleted file mode 100644 index b99b2f63..00000000 --- a/scripts/Run-RendererPhaseRegression.ps1 +++ /dev/null @@ -1,184 +0,0 @@ -[CmdletBinding()] -param( - [string]$RepoRoot = (Split-Path -Parent $PSScriptRoot), - [string]$BuildDir = "", - [string]$Config = "Debug", - [switch]$SkipBuild, - [switch]$IncludeSmoke, - [switch]$SkipCtestEnumerate -) - -Set-StrictMode -Version Latest -$ErrorActionPreference = "Stop" - -function Resolve-NormalizedPath { - param( - [Parameter(Mandatory = $true)] - [string]$Path - ) - - if (Test-Path -LiteralPath $Path) { - return (Resolve-Path -LiteralPath $Path).Path - } - - return [System.IO.Path]::GetFullPath($Path) -} - -function Join-NormalizedPath { - param( - [Parameter(Mandatory = $true)] - [string[]]$Parts - ) - - return [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($Parts)) -} - -function Assert-PathExists { - param( - [Parameter(Mandatory = $true)] - [string]$Path, - [Parameter(Mandatory = $true)] - [string]$Label - ) - - if (-not (Test-Path -LiteralPath $Path)) { - throw "$Label not found: $Path" - } -} - -function Invoke-NativeStep { - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [Parameter(Mandatory = $true)] - [string]$FilePath, - [string[]]$Arguments = @() - ) - - Write-Host "==> $Name" -ForegroundColor Cyan - & $FilePath @Arguments - $exitCode = $LASTEXITCODE - if ($exitCode -ne 0) { - throw "$Name failed with exit code $exitCode." - } -} - -function Invoke-CtestEnumeration { - param( - [Parameter(Mandatory = $true)] - [string]$BuildDir, - [Parameter(Mandatory = $true)] - [string]$Config - ) - - Write-Host "==> Enumerate CTest registry" -ForegroundColor Cyan - $output = & ctest --test-dir $BuildDir -N -C $Config 2>&1 - $exitCode = $LASTEXITCODE - if ($exitCode -ne 0) { - $output | ForEach-Object { Write-Host $_ } - throw "Enumerate CTest registry failed with exit code $exitCode." - } - - $lines = $output | ForEach-Object { $_.ToString() } - $registeredCount = ($lines | Where-Object { $_ -match '^\s*Test\s+#\d+:' }).Count - $notBuiltCount = ($lines | Where-Object { $_ -match '_NOT_BUILT' }).Count - $totalLine = $lines | Where-Object { $_ -match '^Total Tests:\s+\d+' } | Select-Object -Last 1 - if ($null -ne $totalLine) { - Write-Host ("{0}; NOT_BUILT placeholders: {1}" -f $totalLine.Trim(), $notBuiltCount) ` - -ForegroundColor DarkGray - } else { - Write-Host ("CTest enumeration completed; registered tests: {0}; NOT_BUILT placeholders: {1}" ` - -f $registeredCount, $notBuiltCount) -ForegroundColor DarkGray - } -} - -$RepoRoot = Resolve-NormalizedPath -Path $RepoRoot -if ([string]::IsNullOrWhiteSpace($BuildDir)) { - $BuildDir = Join-NormalizedPath -Parts @($RepoRoot, "build") -} else { - $BuildDir = Resolve-NormalizedPath -Path $BuildDir -} - -$ctestRoot = Join-NormalizedPath -Parts @($BuildDir, "CTestTestfile.cmake") -Assert-PathExists -Path $ctestRoot -Label "CTest root" - -$scriptingExe = Join-NormalizedPath -Parts @( - $BuildDir, "tests", "Scripting", $Config, "scripting_tests.exe") -$windowingExe = Join-NormalizedPath -Parts @( - $BuildDir, "tests", "UI", "Editor", "unit", $Config, "editor_windowing_phase1_tests.exe") - -$srpValidationTests = @( - "MonoScriptRuntimeTest.ManagedRenderPipelineBridgeRuntimeExposesDefaultNativeBackendPolicy", - "MonoScriptRuntimeTest.ScriptCoreUniversalRenderPipelineAssetExposesDefaultNativeBackendPolicy", - "MonoScriptRuntimeTest.ManagedRenderPipelineBridgeUsesDefaultRendererSelectionForNativeBackendPolicy", - "MonoScriptRuntimeTest.ManagedRenderPipelineBridgeUsesCameraRendererOverrideAcrossPlanningAndExecution", - "MonoScriptRuntimeTest.ManagedRenderPipelineBridgeRebuildsRendererAfterRendererDataInvalidation", - "MonoScriptRuntimeTest.ManagedRenderPipelineBridgeReleasesPersistentRendererFeatureAcrossRendererInvalidationAndAssetRuntimeRelease", - "MonoScriptRuntimeTest.ManagedRenderPipelineBridgeRebuildsPipelineAfterAssetInvalidation", - "MonoScriptRuntimeTest.ManagedRenderPipelineAssetPlansFullscreenStagesFromPipelineStageSupport", - "MonoScriptRuntimeTest.ManagedRendererFeatureConfiguresCameraFramePlanThroughPlanningContext", - "ProjectScriptAssemblyTest.ProjectManagedBridgeRebuildsRendererAfterProjectRendererDataInvalidation", - "ProjectScriptAssemblyTest.ProjectManagedBridgeReleasesProjectRendererCachesAcrossInvalidationAndAssetRuntimeRelease", - "ProjectScriptAssemblyTest.ProjectManagedBridgeRebuildsPipelineAfterProjectAssetInvalidation" -) -$srpValidationFilter = [string]::Join(":", $srpValidationTests) - -Push-Location $RepoRoot -try { - if (-not $SkipBuild) { - $buildTargets = @( - "scripting_tests", - "editor_windowing_phase1_tests" - ) - if ($IncludeSmoke) { - $buildTargets += "editor_ui_smoke_targets" - } - - $buildArguments = @( - "--build", - $BuildDir, - "--config", - $Config, - "--target" - ) + $buildTargets - - Invoke-NativeStep ` - -Name "Build renderer phase regression targets ($Config)" ` - -FilePath "cmake" ` - -Arguments $buildArguments - } - - Assert-PathExists -Path $scriptingExe -Label "scripting_tests.exe" - Assert-PathExists -Path $windowingExe -Label "editor_windowing_phase1_tests.exe" - - if (-not $SkipCtestEnumerate) { - Write-Host "ctest enumeration may still print *_NOT_BUILT placeholders for targets that were not built." ` - -ForegroundColor DarkGray - Invoke-CtestEnumeration -BuildDir $BuildDir -Config $Config - } - - Invoke-NativeStep ` - -Name "Run managed SRP validation batch (12 tests)" ` - -FilePath $scriptingExe ` - -Arguments @("--gtest_filter=$srpValidationFilter") - - Invoke-NativeStep ` - -Name "Run editor windowing phase1 tests" ` - -FilePath $windowingExe - - if ($IncludeSmoke) { - Invoke-NativeStep ` - -Name "Run XCUI editor smoke" ` - -FilePath "ctest" ` - -Arguments @( - "--test-dir", $BuildDir, - "-C", $Config, - "-R", "^xcui_editor_app_smoke$", - "--output-on-failure" - ) - } - - Write-Host "Renderer phase regression passed." -ForegroundColor Green -} finally { - Pop-Location -} diff --git a/tests/UI/Editor/unit/test_editor_window_synchronization_planner.cpp b/tests/UI/Editor/unit/test_editor_window_synchronization_planner.cpp index dc4ab252..6ef353da 100644 --- a/tests/UI/Editor/unit/test_editor_window_synchronization_planner.cpp +++ b/tests/UI/Editor/unit/test_editor_window_synchronization_planner.cpp @@ -75,7 +75,7 @@ EditorWindowHostSnapshot BuildWorkspaceSnapshot( snapshot.primary = primary; snapshot.running = true; snapshot.hasNativeWindow = true; - snapshot.hasWorkspaceProjection = true; + snapshot.hasWorkspaceState = true; snapshot.workspaceState.windowId = snapshot.windowId; snapshot.workspaceState.workspace = workspaceController.GetWorkspace(); snapshot.workspaceState.session = workspaceController.GetSession(); @@ -188,7 +188,7 @@ TEST(EditorWindowSynchronizationPlannerTest, ProducesCloseActionForRemovedDetach .primary = false, .running = true, .hasNativeWindow = true, - .hasWorkspaceProjection = true, + .hasWorkspaceState = true, .workspaceState = *detachedWindow, .title = L"Document B - XCEngine Editor", }, @@ -238,7 +238,7 @@ TEST(EditorWindowSynchronizationPlannerTest, ProducesUpdateActionWhenPrimaryWind .primary = true, .running = true, .hasNativeWindow = true, - .hasWorkspaceProjection = true, + .hasWorkspaceState = true, .workspaceState = *mainWindow, .title = L"Main Scene - XCEngine Editor", }, @@ -248,7 +248,7 @@ TEST(EditorWindowSynchronizationPlannerTest, ProducesUpdateActionWhenPrimaryWind .primary = false, .running = true, .hasNativeWindow = true, - .hasWorkspaceProjection = true, + .hasWorkspaceState = true, .workspaceState = *detachedWindow, .title = L"Document B - XCEngine Editor", }, @@ -295,7 +295,6 @@ TEST(EditorWindowSynchronizationPlannerTest, WorkspaceProjectionBuildsDetachedPr windowState, false); - EXPECT_EQ(projection.windowState.windowId, "detached-inspector"); EXPECT_TRUE(projection.useDetachedTitleBarTabStrip); EXPECT_EQ(projection.tabStripTitleText, "Inspector"); EXPECT_EQ(projection.detachedWindowTitleText, "Inspector"); @@ -507,7 +506,7 @@ TEST(EditorWindowSynchronizationPlannerTest, DestroyedPrimaryWindowProducesClose .running = true, .destroyed = false, .hasNativeWindow = true, - .hasWorkspaceProjection = true, + .hasWorkspaceState = true, .workspaceState = *detachedState, .title = L"Document B - XCEngine Editor", },