refactor(editor): isolate scene backend boundary
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "Inspector/InspectorPresentationModel.h"
|
||||
#include "Inspector/InspectorSubject.h"
|
||||
#include "Scene/EditorSceneRuntime.h"
|
||||
#include "Scene/EngineEditorSceneBackend.h"
|
||||
|
||||
#include <XCEngine/Components/CameraComponent.h>
|
||||
#include <XCEngine/Components/GameObject.h>
|
||||
@@ -87,6 +88,10 @@ void SaveMainScene(const TemporaryProjectRoot& projectRoot) {
|
||||
scene.Save(scenePath.string());
|
||||
}
|
||||
|
||||
void BindEngineSceneBackend(EditorSceneRuntime& runtime) {
|
||||
runtime.SetBackend(CreateEngineEditorSceneBackend());
|
||||
}
|
||||
|
||||
const UIEditorPropertyGridSection* FindSection(
|
||||
const InspectorPresentationModel& model,
|
||||
std::string_view title) {
|
||||
@@ -126,6 +131,7 @@ const InspectorPresentationComponentBinding* FindBinding(
|
||||
|
||||
TEST(InspectorPresentationModelTests, EmptySubjectBuildsDefaultEmptyState) {
|
||||
EditorSceneRuntime runtime = {};
|
||||
BindEngineSceneBackend(runtime);
|
||||
const InspectorPresentationModel model =
|
||||
BuildInspectorPresentationModel(
|
||||
{},
|
||||
@@ -150,6 +156,7 @@ TEST(InspectorPresentationModelTests, ProjectAssetSubjectBuildsIdentityAndLocati
|
||||
std::filesystem::path("D:/Xuanchi/Main/XCEngine/project/Assets/Materials/Test.mat");
|
||||
|
||||
EditorSceneRuntime runtime = {};
|
||||
BindEngineSceneBackend(runtime);
|
||||
const InspectorPresentationModel model =
|
||||
BuildInspectorPresentationModel(
|
||||
subject,
|
||||
@@ -190,6 +197,7 @@ TEST(InspectorPresentationModelTests, SceneObjectSubjectBuildsRegisteredComponen
|
||||
SaveMainScene(projectRoot);
|
||||
|
||||
EditorSceneRuntime runtime = {};
|
||||
BindEngineSceneBackend(runtime);
|
||||
ASSERT_TRUE(runtime.Initialize(projectRoot.Root()));
|
||||
Scene* scene = runtime.GetActiveScene();
|
||||
ASSERT_NE(scene, nullptr);
|
||||
@@ -261,6 +269,7 @@ TEST(InspectorPresentationModelTests, CameraSkyboxMaterialBuildsAssetField) {
|
||||
SaveMainScene(projectRoot);
|
||||
|
||||
EditorSceneRuntime runtime = {};
|
||||
BindEngineSceneBackend(runtime);
|
||||
ASSERT_TRUE(runtime.Initialize(projectRoot.Root()));
|
||||
Scene* scene = runtime.GetActiveScene();
|
||||
ASSERT_NE(scene, nullptr);
|
||||
|
||||
Reference in New Issue
Block a user