chore: snapshot editor work and restore tests

Key points:\n- restore the tests tree removed by bc47e6e\n- capture current editor workspace, scene, and docs reshuffle changes\n- keep local cloud.nvdb resources ignored from this commit
This commit is contained in:
2026-04-25 22:11:47 +08:00
parent 9ab1beb2c4
commit 12b71a319f
911 changed files with 3518184 additions and 1823 deletions

View File

@@ -0,0 +1,111 @@
#include <XCEditor/Panels/UIEditorPanelRegistry.h>
#include <XCEditor/Workspace/UIEditorWindowWorkspaceController.h>
#include <XCEditor/Workspace/UIEditorWindowWorkspaceModel.h>
#include <XCEditor/Workspace/UIEditorWorkspaceModel.h>
#include <iostream>
#include <string_view>
#include <vector>
namespace {
using namespace XCEngine::UI::Editor;
bool Require(bool condition, std::string_view message) {
if (!condition) {
std::cerr << message << '\n';
return false;
}
return true;
}
UIEditorPanelRegistry BuildPanelRegistry() {
UIEditorPanelRegistry registry = {};
registry.panels.push_back(UIEditorPanelDescriptor{
"scene",
"Scene",
UIEditorPanelPresentationKind::Placeholder,
true,
true,
true,
{},
{},
});
registry.panels.push_back(UIEditorPanelDescriptor{
"game",
"Game",
UIEditorPanelPresentationKind::Placeholder,
true,
true,
true,
{},
{},
});
return registry;
}
UIEditorWorkspaceModel BuildWorkspace() {
UIEditorWorkspaceModel workspace = {};
workspace.root = BuildUIEditorWorkspaceTabStack(
"root",
std::vector<UIEditorWorkspaceNode>{
BuildUIEditorWorkspacePanel("scene-panel", "scene", "Scene"),
BuildUIEditorWorkspacePanel("game-panel", "game", "Game"),
},
0u);
workspace.activePanelId = "scene";
return workspace;
}
} // namespace
int main() {
UIEditorWindowWorkspaceController controller =
BuildDefaultUIEditorWindowWorkspaceController(
BuildPanelRegistry(),
BuildWorkspace(),
"main");
const UIEditorWindowWorkspaceValidationResult validation = controller.ValidateState();
if (!Require(validation.IsValid(), validation.message)) {
return 1;
}
const UIEditorWindowWorkspaceOperationResult detachResult =
controller.DetachPanelToNewWindow("main", "root", "game", "game-window");
if (!Require(
detachResult.status == UIEditorWindowWorkspaceOperationStatus::Changed,
detachResult.message)) {
return 1;
}
const UIEditorWindowWorkspaceSet& windowSet = controller.GetWindowSet();
if (!Require(windowSet.windows.size() == 2u, "expected two windows after detach")) {
return 1;
}
if (!Require(windowSet.primaryWindowId == "main", "primary window id changed unexpectedly")) {
return 1;
}
if (!Require(windowSet.activeWindowId == "game-window", "detached window was not activated")) {
return 1;
}
const UIEditorWindowWorkspaceState* const mainWindow =
FindUIEditorWindowWorkspaceState(windowSet, "main");
const UIEditorWindowWorkspaceState* const detachedWindow =
FindUIEditorWindowWorkspaceState(windowSet, "game-window");
if (!Require(mainWindow != nullptr, "main window state missing")) {
return 1;
}
if (!Require(detachedWindow != nullptr, "detached window state missing")) {
return 1;
}
if (!Require(
detachedWindow->workspace.activePanelId == "game",
"detached workspace active panel mismatch")) {
return 1;
}
return 0;
}