Compare commits

...

2 Commits

Author SHA1 Message Date
131f46682b test: close render object id coverage gaps 2026-04-10 02:03:45 +08:00
899442c64d refactor editor ui host and shell asset layout 2026-04-10 01:59:15 +08:00
57 changed files with 172 additions and 157 deletions

View File

@@ -46,9 +46,9 @@ Shader "Builtin Object Id Outline"
bool IsSelectedObject(float4 objectIdColor)
{
// Object-id surfaces encode the low 32 bits across RGBA, so low-valued
// runtime ids legitimately have zero alpha. Only the all-zero clear
// color should be treated as "no object".
// Object-id surfaces encode the formal 32-bit render object id across
// RGBA. Low-valued ids legitimately have zero alpha, so only the
// all-zero clear color should be treated as "no object".
if (all(abs(objectIdColor) <= float4(
0.0025,
0.0025,

View File

@@ -65,7 +65,7 @@ set(XCUI_EDITOR_COLLECTION_SOURCES
)
set(XCUI_EDITOR_SHELL_SOURCES
src/Shell/EditorShellAsset.cpp
src/Shell/UIEditorShellAsset.cpp
src/Shell/UIEditorDockHost.cpp
src/Shell/UIEditorDockHostInteraction.cpp
src/Shell/UIEditorMenuBar.cpp
@@ -122,13 +122,13 @@ target_link_libraries(XCUIEditorLib PUBLIC
)
add_library(XCUIEditorHost STATIC
app/Host/AutoScreenshot.cpp
app/Host/NativeRenderer.cpp
Host/AutoScreenshot.cpp
Host/NativeRenderer.cpp
)
target_include_directories(XCUIEditorHost
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/app
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/engine/include
)
@@ -148,8 +148,8 @@ if(XCENGINE_BUILD_XCUI_EDITOR_APP)
)
target_include_directories(XCUIEditorApp PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/app
${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions(XCUIEditorApp PRIVATE
@@ -165,6 +165,5 @@ if(XCENGINE_BUILD_XCUI_EDITOR_APP)
set_target_properties(XCUIEditorApp PROPERTIES
OUTPUT_NAME "XCUIEditor"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin"
)
endif()

View File

@@ -4,15 +4,11 @@
#define NOMINMAX
#endif
#include "Host/AutoScreenshot.h"
#include "Host/InputModifierTracker.h"
#include "Host/NativeRenderer.h"
#include <Host/AutoScreenshot.h>
#include <Host/InputModifierTracker.h>
#include <Host/NativeRenderer.h>
#include "Shell/EditorShellAsset.h"
#include <XCEditor/Shell/UIEditorShellInteraction.h>
#include <XCEditor/Foundation/UIEditorShortcutManager.h>
#include <XCEditor/Shell/UIEditorWorkspaceController.h>
#include <XCEditor/Shell/UIEditorStructuredShell.h>
#include <XCEngine/UI/Runtime/UIScreenDocumentHost.h>
#include <XCEngine/UI/Runtime/UIScreenPlayer.h>
@@ -28,44 +24,6 @@
namespace XCEngine::UI::Editor {
struct StructuredEditorShellBinding {
::XCEngine::UI::Runtime::UIScreenAsset screenAsset = {};
UIEditorWorkspaceController workspaceController = {};
UIEditorShellInteractionDefinition shellDefinition = {};
UIEditorShortcutManager shortcutManager = {};
EditorShellAssetValidationResult assetValidation = {};
[[nodiscard]] bool IsValid() const {
return assetValidation.IsValid();
}
};
inline UIEditorShortcutManager BuildStructuredEditorShortcutManager(
const EditorShellAsset& asset) {
return BuildEditorShellShortcutManager(asset);
}
inline StructuredEditorShellBinding BuildStructuredEditorShellBinding(
const EditorShellAsset& asset) {
StructuredEditorShellBinding binding = {};
binding.screenAsset.screenId = asset.screenId;
binding.screenAsset.documentPath = asset.documentPath.string();
binding.workspaceController =
UIEditorWorkspaceController(asset.panelRegistry, asset.workspace, asset.workspaceSession);
binding.shellDefinition = asset.shellDefinition;
binding.shortcutManager = BuildStructuredEditorShortcutManager(asset);
binding.assetValidation = ValidateEditorShellAsset(asset);
return binding;
}
inline UIEditorShellInteractionServices BuildStructuredEditorShellServices(
const StructuredEditorShellBinding& binding) {
UIEditorShellInteractionServices services = {};
services.commandDispatcher = &binding.shortcutManager.GetCommandDispatcher();
services.shortcutManager = &binding.shortcutManager;
return services;
}
class Application {
public:
Application();

View File

@@ -1,6 +1,7 @@
#pragma once
#include <XCEditor/Foundation/UIEditorShortcutManager.h>
#include <XCEditor/Shell/UIEditorMenuModel.h>
#include <XCEditor/Shell/UIEditorPanelRegistry.h>
#include <XCEditor/Shell/UIEditorShellInteraction.h>
#include <XCEditor/Shell/UIEditorWorkspaceModel.h>
@@ -15,7 +16,7 @@ namespace XCEngine::UI::Editor {
struct EditorShellShortcutAsset {
UIEditorCommandRegistry commandRegistry = {};
std::vector<XCEngine::UI::UIShortcutBinding> bindings = {};
std::vector<UIShortcutBinding> bindings = {};
};
struct EditorShellAsset {

View File

@@ -0,0 +1,45 @@
#pragma once
#include <XCEditor/Foundation/UIEditorShortcutManager.h>
#include <XCEditor/Shell/UIEditorShellAsset.h>
#include <XCEditor/Shell/UIEditorShellInteraction.h>
#include <XCEditor/Shell/UIEditorWorkspaceController.h>
#include <XCEngine/UI/Runtime/UIScreenTypes.h>
namespace XCEngine::UI::Editor {
struct StructuredEditorShellBinding {
::XCEngine::UI::Runtime::UIScreenAsset screenAsset = {};
UIEditorWorkspaceController workspaceController = {};
UIEditorShellInteractionDefinition shellDefinition = {};
UIEditorShortcutManager shortcutManager = {};
EditorShellAssetValidationResult assetValidation = {};
[[nodiscard]] bool IsValid() const {
return assetValidation.IsValid();
}
};
inline StructuredEditorShellBinding BuildStructuredEditorShellBinding(
const EditorShellAsset& asset) {
StructuredEditorShellBinding binding = {};
binding.screenAsset.screenId = asset.screenId;
binding.screenAsset.documentPath = asset.documentPath.string();
binding.workspaceController =
UIEditorWorkspaceController(asset.panelRegistry, asset.workspace, asset.workspaceSession);
binding.shellDefinition = asset.shellDefinition;
binding.shortcutManager = BuildEditorShellShortcutManager(asset);
binding.assetValidation = ValidateEditorShellAsset(asset);
return binding;
}
inline UIEditorShellInteractionServices BuildStructuredEditorShellServices(
const StructuredEditorShellBinding& binding) {
UIEditorShellInteractionServices services = {};
services.commandDispatcher = &binding.shortcutManager.GetCommandDispatcher();
services.shortcutManager = &binding.shortcutManager;
return services;
}
} // namespace XCEngine::UI::Editor

View File

@@ -1,4 +1,4 @@
#include "EditorShellAsset.h"
#include <XCEditor/Shell/UIEditorShellAsset.h>
#include <unordered_set>
#include <utility>

View File

@@ -1,7 +0,0 @@
<View
name="EditorShell">
<Column
id="editor-foundation-root"
width="fill"
height="fill" />
</View>

View File

@@ -29,6 +29,7 @@ using XCEngine::Rendering::BuildRenderCameraData;
using XCEngine::Rendering::CompareVisibleRenderItemsStable;
using XCEngine::Rendering::CollectRenderItemsForEntityIds;
using XCEngine::Rendering::ConvertRenderObjectIdToRuntimeObjectId;
using XCEngine::Rendering::IsValidRenderObjectId;
using XCEngine::Rendering::VisibleRenderItem;
using XCEngine::Rendering::kInvalidRenderObjectId;
using XCEngine::Resources::Mesh;
@@ -200,9 +201,10 @@ TEST_F(RenderSceneUtilityTest, CollectRenderItemsForEntityIdsFiltersInvalidTarge
ASSERT_EQ(renderables.size(), 1u);
EXPECT_EQ(renderables[0].gameObject, validObject);
EXPECT_EQ(renderables[0].meshRenderer, validObject->GetComponent<MeshRendererComponent>());
EXPECT_TRUE(renderables[0].hasSection);
EXPECT_TRUE(IsValidRenderObjectId(renderables[0].renderObjectId));
EXPECT_NE(renderables[0].renderObjectId, kInvalidRenderObjectId);
EXPECT_EQ(ConvertRenderObjectIdToRuntimeObjectId(renderables[0].renderObjectId), validObject->GetID());
EXPECT_TRUE(renderables[0].hasSection);
}
TEST_F(RenderSceneUtilityTest, CollectRenderItemsForEntityIdsExpandsMeshSections) {
@@ -221,6 +223,8 @@ TEST_F(RenderSceneUtilityTest, CollectRenderItemsForEntityIdsExpandsMeshSections
ASSERT_EQ(renderables.size(), 2u);
EXPECT_EQ(renderables[0].gameObject, object);
EXPECT_TRUE(IsValidRenderObjectId(renderables[0].renderObjectId));
EXPECT_EQ(renderables[0].renderObjectId, renderables[1].renderObjectId);
EXPECT_EQ(renderables[0].sectionIndex, 0u);
EXPECT_EQ(renderables[0].materialIndex, 0u);
EXPECT_EQ(renderables[1].sectionIndex, 1u);

View File

@@ -2,6 +2,17 @@ cmake_minimum_required(VERSION 3.15)
project(XCEngine_EditorUITests)
set(XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT
"${CMAKE_SOURCE_DIR}/new_editor")
if(NOT EXISTS "${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/Host/AutoScreenshot.h"
OR NOT EXISTS "${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/Host/InputModifierTracker.h"
OR NOT EXISTS "${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/Host/NativeRenderer.h")
message(FATAL_ERROR
"Editor UI tests expect host headers under "
"${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/Host.")
endif()
add_subdirectory(unit)
add_subdirectory(integration)

View File

@@ -29,9 +29,8 @@ target_include_directories(editor_ui_integration_host
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${CMAKE_SOURCE_DIR}/new_editor/src
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
)
target_compile_definitions(editor_ui_integration_host

View File

@@ -4,8 +4,8 @@ add_executable(editor_ui_asset_field_basic_validation WIN32
target_include_directories(editor_ui_asset_field_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -4,8 +4,8 @@ add_executable(editor_ui_bool_field_basic_validation WIN32
target_include_directories(editor_ui_bool_field_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -4,8 +4,8 @@ add_executable(editor_ui_color_field_basic_validation WIN32
target_include_directories(editor_ui_color_field_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -4,9 +4,8 @@ add_executable(editor_ui_context_menu_basic_validation WIN32
target_include_directories(editor_ui_context_menu_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${CMAKE_SOURCE_DIR}/new_editor/src
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
)
target_compile_definitions(editor_ui_context_menu_basic_validation PRIVATE

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_dock_host_basic_validation WIN32
)
target_include_directories(editor_ui_dock_host_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_editor_shell_compose_validation WIN32
)
target_include_directories(editor_ui_editor_shell_compose_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -4,9 +4,8 @@ add_executable(editor_ui_editor_shell_interaction_validation WIN32
target_include_directories(editor_ui_editor_shell_interaction_validation PRIVATE
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${CMAKE_SOURCE_DIR}/new_editor/src
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
)
target_compile_definitions(editor_ui_editor_shell_interaction_validation PRIVATE

View File

@@ -2,7 +2,7 @@
#define NOMINMAX
#endif
#include "Shell/EditorShellAsset.h"
#include <XCEditor/Shell/UIEditorShellAsset.h>
#include <XCEditor/Foundation/UIEditorCommandDispatcher.h>
#include <XCEditor/Foundation/UIEditorTheme.h>

View File

@@ -4,8 +4,8 @@ add_executable(editor_ui_enum_field_basic_validation WIN32
target_include_directories(editor_ui_enum_field_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_list_view_basic_validation WIN32
)
target_include_directories(editor_ui_list_view_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_list_view_inline_rename_validation WIN32
)
target_include_directories(editor_ui_list_view_inline_rename_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
)

View File

@@ -4,8 +4,8 @@ add_executable(editor_ui_list_view_multiselect_validation WIN32
target_include_directories(editor_ui_list_view_multiselect_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -4,9 +4,8 @@ add_executable(editor_ui_menu_bar_basic_validation WIN32
target_include_directories(editor_ui_menu_bar_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${CMAKE_SOURCE_DIR}/new_editor/src
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
)
target_compile_definitions(editor_ui_menu_bar_basic_validation PRIVATE

View File

@@ -4,8 +4,8 @@ add_executable(editor_ui_number_field_basic_validation WIN32
target_include_directories(editor_ui_number_field_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -4,8 +4,8 @@ add_executable(editor_ui_object_field_basic_validation WIN32
target_include_directories(editor_ui_object_field_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -4,9 +4,8 @@ add_executable(editor_ui_panel_content_host_basic_validation WIN32
target_include_directories(editor_ui_panel_content_host_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${CMAKE_SOURCE_DIR}/new_editor/src
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
)
target_compile_definitions(editor_ui_panel_content_host_basic_validation PRIVATE

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_panel_frame_basic_validation WIN32
)
target_include_directories(editor_ui_panel_frame_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -4,8 +4,8 @@ add_executable(editor_ui_property_grid_basic_validation WIN32
target_include_directories(editor_ui_property_grid_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_scroll_view_basic_validation WIN32
)
target_include_directories(editor_ui_scroll_view_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_status_bar_basic_validation WIN32
)
target_include_directories(editor_ui_status_bar_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_tab_strip_basic_validation WIN32
)
target_include_directories(editor_ui_tab_strip_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -4,8 +4,8 @@ add_executable(editor_ui_text_field_basic_validation WIN32
target_include_directories(editor_ui_text_field_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_tree_view_basic_validation WIN32
)
target_include_directories(editor_ui_tree_view_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_tree_view_inline_rename_validation WIN32
)
target_include_directories(editor_ui_tree_view_inline_rename_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_tree_view_multiselect_validation WIN32
)
target_include_directories(editor_ui_tree_view_multiselect_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -4,8 +4,8 @@ add_executable(editor_ui_vector2_field_basic_validation WIN32
target_include_directories(editor_ui_vector2_field_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -4,8 +4,8 @@ add_executable(editor_ui_vector3_field_basic_validation WIN32
target_include_directories(editor_ui_vector3_field_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -4,8 +4,8 @@ add_executable(editor_ui_vector4_field_basic_validation WIN32
target_include_directories(editor_ui_vector4_field_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Editor/integration/shared/src
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_viewport_shell_basic_validation WIN32
)
target_include_directories(editor_ui_viewport_shell_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_viewport_slot_basic_validation WIN32
)
target_include_directories(editor_ui_viewport_slot_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_workspace_interaction_basic_validation WIN32
)
target_include_directories(editor_ui_workspace_interaction_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_workspace_shell_compose_validation WIN32
)
target_include_directories(editor_ui_workspace_shell_compose_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_workspace_viewport_compose_validation WIN32
)
target_include_directories(editor_ui_workspace_viewport_compose_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -4,9 +4,8 @@ add_executable(editor_ui_layout_persistence_validation WIN32
target_include_directories(editor_ui_layout_persistence_validation PRIVATE
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${CMAKE_SOURCE_DIR}/new_editor/src
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
)
target_compile_definitions(editor_ui_layout_persistence_validation PRIVATE

View File

@@ -4,9 +4,8 @@ add_executable(editor_ui_panel_host_lifecycle_validation WIN32
target_include_directories(editor_ui_panel_host_lifecycle_validation PRIVATE
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${CMAKE_SOURCE_DIR}/new_editor/src
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
)
target_compile_definitions(editor_ui_panel_host_lifecycle_validation PRIVATE

View File

@@ -4,9 +4,8 @@ add_executable(editor_ui_panel_session_flow_validation WIN32
target_include_directories(editor_ui_panel_session_flow_validation PRIVATE
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${CMAKE_SOURCE_DIR}/new_editor/src
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
)
target_compile_definitions(editor_ui_panel_session_flow_validation PRIVATE

View File

@@ -4,9 +4,8 @@ add_executable(editor_ui_shortcut_dispatch_validation WIN32
target_include_directories(editor_ui_shortcut_dispatch_validation PRIVATE
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${CMAKE_SOURCE_DIR}/new_editor/src
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
)
target_compile_definitions(editor_ui_shortcut_dispatch_validation PRIVATE

View File

@@ -3,8 +3,8 @@ add_executable(editor_ui_viewport_input_bridge_basic_validation WIN32
)
target_include_directories(editor_ui_viewport_input_bridge_basic_validation PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -73,9 +73,8 @@ target_link_libraries(editor_ui_tests
target_include_directories(editor_ui_tests
PRIVATE
${CMAKE_SOURCE_DIR}/new_editor/include
${CMAKE_SOURCE_DIR}/new_editor/src
${CMAKE_SOURCE_DIR}/new_editor/app
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}/include
${XCENGINE_EDITOR_UI_TESTS_EDITOR_ROOT}
${CMAKE_SOURCE_DIR}/engine/include
)

View File

@@ -1,6 +1,6 @@
#include <gtest/gtest.h>
#include "Shell/EditorShellAsset.h"
#include <XCEditor/Shell/UIEditorShellAsset.h>
#include <XCEditor/Shell/UIEditorPanelRegistry.h>

View File

@@ -1,7 +1,7 @@
#include <gtest/gtest.h>
#include "Application.h"
#include <XCEditor/Shell/UIEditorShellAsset.h>
#include <XCEditor/Shell/UIEditorStructuredShell.h>
#include <XCEditor/Shell/UIEditorShellInteraction.h>
#include <XCEditor/Shell/UIEditorWorkspaceModel.h>
#include <XCEditor/Shell/UIEditorWorkspaceSession.h>

View File

@@ -17,6 +17,7 @@ using XCEngine::Editor::ViewportObjectIdReadbackRequest;
using XCEngine::RHI::RHICommandQueue;
using XCEngine::RHI::RHITexture;
using XCEngine::RHI::ResourceStates;
using XCEngine::Rendering::kInvalidRenderObjectId;
using XCEngine::UI::UIPoint;
using XCEngine::UI::UISize;
@@ -85,6 +86,16 @@ TEST(ViewportObjectIdPickerTest, BuildReadbackRequestMapsViewportCoordinatesToTe
TEST(ViewportObjectIdPickerTest, TryPickViewportObjectIdEntityDecodesReadbackColor) {
const ViewportObjectIdPickContext context = CreateValidContext();
const ViewportObjectIdPickResult result = PickViewportObjectIdEntity(
context,
[](const ViewportObjectIdReadbackRequest&, std::array<uint8_t, 4>& outRgba) {
outRgba = { 0x78, 0x56, 0x34, 0x12 };
return true;
});
EXPECT_EQ(result.renderObjectId, 0x12345678u);
EXPECT_EQ(result.entityId, 0x12345678ull);
EXPECT_TRUE(result.HasResolvedSample());
uint64_t entityId = 0;
ViewportObjectIdReadbackRequest capturedRequest = {};
const bool picked = TryPickViewportObjectIdEntity(
@@ -113,6 +124,7 @@ TEST(ViewportObjectIdPickerTest, PickViewportObjectIdEntityReturnsSuccessForZero
});
EXPECT_EQ(result.status, ViewportObjectIdPickStatus::Success);
EXPECT_EQ(result.renderObjectId, kInvalidRenderObjectId);
EXPECT_EQ(result.entityId, 0u);
EXPECT_TRUE(result.HasResolvedSample());
}
@@ -128,6 +140,7 @@ TEST(ViewportObjectIdPickerTest, PickViewportObjectIdEntityReturnsUnavailableWhe
});
EXPECT_EQ(result.status, ViewportObjectIdPickStatus::Unavailable);
EXPECT_EQ(result.renderObjectId, kInvalidRenderObjectId);
EXPECT_EQ(result.entityId, 0u);
EXPECT_FALSE(result.HasResolvedSample());
}
@@ -157,6 +170,7 @@ TEST(ViewportObjectIdPickerTest, PickViewportObjectIdEntityReportsReadbackFailur
});
EXPECT_EQ(result.status, ViewportObjectIdPickStatus::ReadbackFailed);
EXPECT_EQ(result.renderObjectId, kInvalidRenderObjectId);
EXPECT_EQ(result.entityId, 0u);
EXPECT_FALSE(result.HasResolvedSample());
}