editor: centralize product panel manifest

This commit is contained in:
2026-04-28 04:33:44 +08:00
parent ea765b9481
commit 8c66cdac07
12 changed files with 574 additions and 136 deletions

View File

@@ -1,6 +1,8 @@
#include <gtest/gtest.h>
#include "EditorShellAssetBuilder.h"
#include "Panels/EditorPanelIds.h"
#include "Product/EditorProductManifest.h"
#include <XCEditor/Shell/UIEditorShellAsset.h>
@@ -10,6 +12,13 @@ namespace {
using XCEngine::Input::KeyCode;
using XCEngine::UI::Editor::App::BuildEditorApplicationShellAsset;
using XCEngine::UI::Editor::App::EditorProductManifestValidationCode;
using XCEngine::UI::Editor::App::EditorProductPanelRuntimeKind;
using XCEngine::UI::Editor::App::EditorProductViewportRendererKind;
using XCEngine::UI::Editor::App::FindEditorProductPanel;
using XCEngine::UI::Editor::App::GetEditorProductPanels;
using XCEngine::UI::Editor::App::kGamePanelId;
using XCEngine::UI::Editor::App::ValidateEditorProductManifest;
using XCEngine::UI::Editor::EditorShellAssetValidationCode;
using XCEngine::UI::Editor::FindUIEditorPanelDescriptor;
using XCEngine::UI::Editor::UIEditorCommandPanelSource;
@@ -64,6 +73,24 @@ TEST(EditorShellAssetValidationTest, DefaultShellAssetPassesValidation) {
shellAsset.panelRegistry.panels.front().presentationKind);
}
TEST(EditorShellAssetValidationTest, ProductManifestDeclaresPanelRuntimeAndViewportOwners) {
const auto validation = ValidateEditorProductManifest();
EXPECT_EQ(validation.code, EditorProductManifestValidationCode::None)
<< validation.message;
ASSERT_TRUE(validation.IsValid());
const auto shellAsset = BuildEditorApplicationShellAsset(".");
ASSERT_EQ(shellAsset.panelRegistry.panels.size(), GetEditorProductPanels().size());
const auto* gamePanel = FindEditorProductPanel(kGamePanelId);
ASSERT_NE(gamePanel, nullptr);
EXPECT_EQ(gamePanel->runtimeKind, EditorProductPanelRuntimeKind::None);
EXPECT_EQ(
gamePanel->viewportRendererKind,
EditorProductViewportRendererKind::Placeholder);
EXPECT_FALSE(gamePanel->viewportPlaceholderStatus.empty());
}
TEST(EditorShellAssetValidationTest, ValidationRejectsWorkspacePanelMissingFromRegistry) {
auto shellAsset = BuildEditorApplicationShellAsset(".");