Merge branch 'development' into cmake/SPEC-7179
This commit is contained in:
@@ -116,7 +116,7 @@ namespace AZ
|
||||
{
|
||||
const char* uuidString = nullptr;
|
||||
unsigned int uuidStringLength = 0;
|
||||
if (dc.ReadArg(0, uuidString) && dc.ReadValue(1, uuidStringLength))
|
||||
if (dc.ReadArg(0, uuidString) && dc.ReadArg(1, uuidStringLength))
|
||||
{
|
||||
dc.PushResult(Uuid(uuidString, uuidStringLength));
|
||||
}
|
||||
|
||||
@@ -157,8 +157,11 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
|
||||
lua_pop(l, 2); // pop the Class name and behaviorClass
|
||||
|
||||
lua_pushnil(l);
|
||||
|
||||
// iterate over the key/value pairs
|
||||
while (lua_next(l, -2) != 0)
|
||||
{
|
||||
// if key: string value: function
|
||||
if (lua_isstring(l, -2) && lua_isfunction(l, -1))
|
||||
{
|
||||
const char* name = lua_tostring(l, -2);
|
||||
@@ -167,6 +170,7 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
|
||||
bool isRead = true;
|
||||
bool isWrite = true;
|
||||
|
||||
// check if there is a getter provided
|
||||
lua_getupvalue(l, -1, 1);
|
||||
if (lua_isnil(l, -1))
|
||||
{
|
||||
@@ -174,6 +178,7 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
|
||||
}
|
||||
lua_pop(l, 1);
|
||||
|
||||
// check if there is a setter provided
|
||||
lua_getupvalue(l, -1, 2);
|
||||
if (lua_isnil(l, -1))
|
||||
{
|
||||
@@ -181,6 +186,7 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
|
||||
}
|
||||
lua_pop(l, 1);
|
||||
|
||||
// enumerate the remaining property
|
||||
if (!enumProperty(&behaviorClass->m_typeId, name, isRead, isWrite, userData))
|
||||
{
|
||||
lua_pop(l, 5);
|
||||
@@ -189,21 +195,30 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
|
||||
}
|
||||
else
|
||||
{
|
||||
// for any non-built in methods
|
||||
if (strncmp(name, "__", 2) != 0)
|
||||
{
|
||||
const char* dbgParamInfo = NULL;
|
||||
lua_getupvalue(l, -1, 2);
|
||||
|
||||
// attempt to get the name
|
||||
bool popDebugName = lua_getupvalue(l, -1, 2) != nullptr;
|
||||
if (lua_isstring(l, -1))
|
||||
{
|
||||
dbgParamInfo = lua_tostring(l, -1);
|
||||
}
|
||||
|
||||
// enumerate the method's parameters
|
||||
if (!enumMethod(&behaviorClass->m_typeId, name, dbgParamInfo, userData))
|
||||
{
|
||||
lua_pop(l, 6);
|
||||
return;
|
||||
}
|
||||
lua_pop(l, 1); // pop the DBG name
|
||||
|
||||
// if we were able to get the name, pop it from the stack
|
||||
if (popDebugName)
|
||||
{
|
||||
lua_pop(l, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*/
|
||||
|
||||
#include <AZTestShared/Utils/Utils.h>
|
||||
#include "AzCore/Component/Entity.h"
|
||||
#include "AzCore/Asset/AssetManager.h"
|
||||
#include "AzCore/Slice/SliceComponent.h"
|
||||
#include <AzCore/Component/Entity.h>
|
||||
#include <AzCore/Asset/AssetManager.h>
|
||||
#include <AzCore/Slice/SliceComponent.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/Serialization/Json/JsonSerializationSettings.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
#include <Tests/Serialization/Json/JsonSerializationTests.h>
|
||||
|
||||
@@ -43,7 +44,9 @@ namespace JsonSerializationTests
|
||||
}
|
||||
|
||||
void CheckApplyPatchOutcome(const char* target, const char* patch,
|
||||
AZ::JsonSerializationResult::Outcomes outcome, AZ::JsonSerializationResult::Processing processing)
|
||||
AZ::JsonSerializationResult::Outcomes outcome,
|
||||
AZ::JsonSerializationResult::Processing processing,
|
||||
const AZ::JsonApplyPatchSettings& settings = AZ::JsonApplyPatchSettings{})
|
||||
{
|
||||
m_jsonDocument->Parse(target);
|
||||
ASSERT_FALSE(m_jsonDocument->HasParseError());
|
||||
@@ -53,12 +56,24 @@ namespace JsonSerializationTests
|
||||
ASSERT_FALSE(patchDocument.HasParseError());
|
||||
|
||||
AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::ApplyPatch(*m_jsonDocument,
|
||||
m_jsonDocument->GetAllocator(), patchDocument, AZ::JsonMergeApproach::JsonPatch);
|
||||
m_jsonDocument->GetAllocator(), patchDocument, AZ::JsonMergeApproach::JsonPatch, settings);
|
||||
EXPECT_EQ(result.GetTask(), AZ::JsonSerializationResult::Tasks::Merge);
|
||||
EXPECT_EQ(result.GetOutcome(), outcome);
|
||||
EXPECT_EQ(result.GetProcessing(), processing);
|
||||
}
|
||||
|
||||
void CheckApplyPatchOutcome(
|
||||
const char* target,
|
||||
const char* patch,
|
||||
const char* expectedPatchedResult,
|
||||
AZ::JsonSerializationResult::Outcomes outcome,
|
||||
AZ::JsonSerializationResult::Processing processing,
|
||||
const AZ::JsonApplyPatchSettings& settings = AZ::JsonApplyPatchSettings{})
|
||||
{
|
||||
CheckApplyPatchOutcome(target, patch, outcome, processing, settings);
|
||||
Expect_DocStrEq(expectedPatchedResult);
|
||||
}
|
||||
|
||||
void CheckCreatePatch_Core(const char* source, AZStd::string_view patch, const char* target,
|
||||
AZ::JsonMergeApproach approach)
|
||||
{
|
||||
@@ -262,6 +277,36 @@ namespace JsonSerializationTests
|
||||
Outcomes::TypeMismatch, Processing::Halted);
|
||||
}
|
||||
|
||||
TEST_F(JsonPatchingSerializationTests, ApplyPatch_UseJsonPatchWithCustomReportingCallback_ReportPartialSkip)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
auto issueReportingCallback = [](AZStd::string_view, AZ::JsonSerializationResult::ResultCode result,
|
||||
AZStd::string_view) -> AZ::JsonSerializationResult::ResultCode
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
if (result.GetProcessing() == Processing::Halted)
|
||||
{
|
||||
return ResultCode(result.GetTask(), Outcomes::PartialSkip);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
AZ::JsonApplyPatchSettings applyPatchSettings;
|
||||
applyPatchSettings.m_reporting = AZStd::move(issueReportingCallback);
|
||||
CheckApplyPatchOutcome(
|
||||
R"({})",
|
||||
R"([
|
||||
{ "op": "add", "path": "/nonexistent_key/new_member", "value": "someValue" },
|
||||
{ "op": "add", "path": "/test", "value": "someValue" }
|
||||
])",
|
||||
R"(
|
||||
{ "test": "someValue" }
|
||||
)",
|
||||
Outcomes::PartialSkip,
|
||||
Processing::Completed,
|
||||
AZStd::move(applyPatchSettings));
|
||||
}
|
||||
|
||||
TEST_F(JsonPatchingSerializationTests, ApplyPatch_UseJsonPatchAddUnnamedMember_ReportsSuccess)
|
||||
{
|
||||
CheckApplyPatch(
|
||||
|
||||
@@ -279,14 +279,11 @@ namespace AZ
|
||||
return SystemFile::Exists(resolvedPath);
|
||||
}
|
||||
|
||||
void LocalFileIO::CheckInvalidWrite(const char* path)
|
||||
void LocalFileIO::CheckInvalidWrite([[maybe_unused]] const char* path)
|
||||
{
|
||||
(void)path;
|
||||
|
||||
#if defined(AZ_ENABLE_TRACING)
|
||||
const char* assetsAlias = GetAlias("@assets@");
|
||||
|
||||
if (((path) && (assetsAlias) && (azstrnicmp(path, assetsAlias, strlen(assetsAlias)) == 0)))
|
||||
if (path && assetsAlias && AZ::IO::PathView(path).IsRelativeTo(assetsAlias))
|
||||
{
|
||||
AZ_Error("FileIO", false, "You may not alter data inside the asset cache. Please check the call stack and consider writing into the source asset folder instead.\n"
|
||||
"Attempted write location: %s", path);
|
||||
|
||||
+25
-5
@@ -205,6 +205,25 @@ namespace AzFramework
|
||||
class InputDeviceImplementationRequest : public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! EBus Trait: requests can be addressed to a specific InputDeviceId so that they are only
|
||||
//! handled by one input device that has connected to the bus using that unique id, or they
|
||||
//! can be broadcast to all input devices that have connected to the bus, regardless of id.
|
||||
//! Connected input devices are ordered by their local player index from lowest to highest.
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ByIdAndOrdered;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! EBus Trait: requests should be handled by only one input device connected to each id
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! EBus Trait: requests can be addressed to a specific InputDeviceId
|
||||
using BusIdType = InputDeviceId;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! EBus Trait: requests are handled by connected devices in the order of local player index
|
||||
using BusIdOrderCompare = AZStd::less<BusIdType>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Alias for the EBus implementation of this interface
|
||||
using Bus = AZ::EBus<InputDeviceImplementationRequest<InputDeviceType>>;
|
||||
@@ -214,11 +233,12 @@ namespace AzFramework
|
||||
using CreateFunctionType = typename InputDeviceType::Implementation*(*)(InputDeviceType&);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Create a custom implementation for all the existing instances of this input device type.
|
||||
//! Set a custom implementation for this input device type, either for a specific instance
|
||||
//! by addressing the call to an InputDeviceId, or for all existing instances by broadcast.
|
||||
//! Passing InputDeviceType::Implementation::Create as the argument will create the default
|
||||
//! device implementation, while passing nullptr will delete any existing implementation.
|
||||
//! \param[in] createFunction Pointer to the function that will create the implementation.
|
||||
virtual void CreateCustomImplementation(CreateFunctionType createFunction) = 0;
|
||||
virtual void SetCustomImplementation(CreateFunctionType createFunction) = 0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -238,7 +258,7 @@ namespace AzFramework
|
||||
AZ_INLINE InputDeviceImplementationRequestHandler(InputDeviceType& inputDevice)
|
||||
: m_inputDevice(inputDevice)
|
||||
{
|
||||
InputDeviceImplementationRequest<InputDeviceType>::Bus::Handler::BusConnect();
|
||||
InputDeviceImplementationRequest<InputDeviceType>::Bus::Handler::BusConnect(m_inputDevice.GetInputDeviceId());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -251,8 +271,8 @@ namespace AzFramework
|
||||
using CreateFunctionType = typename InputDeviceType::Implementation*(*)(InputDeviceType&);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! \ref InputDeviceImplementationRequest<InputDeviceType>::CreateCustomImplementation
|
||||
AZ_INLINE void CreateCustomImplementation(CreateFunctionType createFunction) override
|
||||
//! \ref InputDeviceImplementationRequest<InputDeviceType>::SetCustomImplementation
|
||||
AZ_INLINE void SetCustomImplementation(CreateFunctionType createFunction) override
|
||||
{
|
||||
AZStd::unique_ptr<typename InputDeviceType::Implementation> newImplementation;
|
||||
if (createFunction)
|
||||
|
||||
@@ -97,6 +97,9 @@ namespace AzFramework
|
||||
|
||||
//! This is called when the window is deactivated from code or if the user closes the window.
|
||||
virtual void OnWindowClosed() {};
|
||||
|
||||
//! This is called when vsync interval is changed.
|
||||
virtual void OnVsyncIntervalChanged(uint32_t interval) { AZ_UNUSED(interval); };
|
||||
};
|
||||
using WindowNotificationBus = AZ::EBus<WindowNotifications>;
|
||||
|
||||
|
||||
@@ -52,3 +52,63 @@ ly_add_source_properties(
|
||||
PROPERTY COMPILE_DEFINITIONS
|
||||
VALUES TOUCHBENDING_LAYER_BIT=${LY_TOUCHBENDING_LAYER_BIT}
|
||||
)
|
||||
|
||||
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
|
||||
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Tests/Platform/${PAL_PLATFORM_NAME})
|
||||
|
||||
ly_add_target(
|
||||
NAME AzFrameworkTestShared STATIC
|
||||
NAMESPACE AZ
|
||||
FILES_CMAKE
|
||||
Tests/framework_shared_tests_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PUBLIC
|
||||
Tests
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::AzCore
|
||||
AZ::AzFramework
|
||||
)
|
||||
|
||||
if(PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
|
||||
ly_add_target(
|
||||
NAME ProcessLaunchTest EXECUTABLE
|
||||
NAMESPACE AZ
|
||||
FILES_CMAKE
|
||||
Tests/process_launch_test_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PRIVATE
|
||||
Tests
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::AzCore
|
||||
AZ::AzFramework
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
NAME AzFramework.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
|
||||
NAMESPACE AZ
|
||||
FILES_CMAKE
|
||||
Tests/frameworktests_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PRIVATE
|
||||
Tests
|
||||
${pal_dir}
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::AzFramework
|
||||
AZ::AzTest
|
||||
AZ::AzTestShared
|
||||
AZ::AzFrameworkTestShared
|
||||
RUNTIME_DEPENDENCIES
|
||||
AZ::ProcessLaunchTest
|
||||
)
|
||||
ly_add_googletest(
|
||||
NAME AZ::AzFramework.Tests
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
endif()
|
||||
+4
-4
@@ -15,16 +15,16 @@ namespace UnitTest
|
||||
{
|
||||
using namespace AZ;
|
||||
|
||||
class SetRestoreFileIOBaseRAII
|
||||
class FileIOBaseRAII
|
||||
{
|
||||
public:
|
||||
SetRestoreFileIOBaseRAII(AZ::IO::FileIOBase& fileIO)
|
||||
FileIOBaseRAII(AZ::IO::FileIOBase& fileIO)
|
||||
: m_prevFileIO(AZ::IO::FileIOBase::GetInstance())
|
||||
{
|
||||
AZ::IO::FileIOBase::SetInstance(&fileIO);
|
||||
}
|
||||
|
||||
~SetRestoreFileIOBaseRAII()
|
||||
~FileIOBaseRAII()
|
||||
{
|
||||
AZ::IO::FileIOBase::SetInstance(m_prevFileIO);
|
||||
}
|
||||
@@ -102,7 +102,7 @@ namespace UnitTest
|
||||
TEST_F(GenAppDescriptors, Test)
|
||||
{
|
||||
AZ::IO::LocalFileIO fileIO;
|
||||
SetRestoreFileIOBaseRAII restoreFileIOScope(fileIO);
|
||||
FileIOBaseRAII restoreFileIOScope(fileIO);
|
||||
run();
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
AZ_PUSH_DISABLE_WARNING(, "-Wdelete-non-virtual-dtor")
|
||||
|
||||
#include <FrameworkApplicationFixture.h>
|
||||
#include <AzCore/Component/ComponentApplication.h>
|
||||
#include <AzCore/Component/Entity.h>
|
||||
#include <AzCore/Component/Component.h>
|
||||
+1
@@ -9,4 +9,5 @@ set(FILES
|
||||
Mocks/MockSpawnableEntitiesInterface.h
|
||||
Utils/Utils.h
|
||||
Utils/Utils.cpp
|
||||
FrameworkApplicationFixture.h
|
||||
)
|
||||
+1
-17
@@ -6,44 +6,28 @@
|
||||
#
|
||||
|
||||
set(FILES
|
||||
../AzCore/Tests/Main.cpp
|
||||
../../AzCore/Tests/Main.cpp
|
||||
Spawnable/SpawnableEntitiesManagerTests.cpp
|
||||
ArchiveCompressionTests.cpp
|
||||
ArchiveTests.cpp
|
||||
BehaviorEntityTests.cpp
|
||||
BinToTextEncode.cpp
|
||||
ComponentAddRemove.cpp
|
||||
ComponentAdapterTests.cpp
|
||||
CameraInputTests.cpp
|
||||
ClickDetectorTests.cpp
|
||||
CursorStateTests.cpp
|
||||
EntityContext.cpp
|
||||
EntityTestbed.h
|
||||
FileFunc.cpp
|
||||
FileIO.cpp
|
||||
FileTagTests.cpp
|
||||
FrameworkApplicationFixture.h
|
||||
GenAppDescriptors.cpp
|
||||
GenericComponentWrapperTest.cpp
|
||||
InstanceDataHierarchy.cpp
|
||||
OctreePerformanceTests.cpp
|
||||
OctreeTests.cpp
|
||||
Slices.cpp
|
||||
Script/ScriptComponentTests.cpp
|
||||
Script/ScriptEntityTests.cpp
|
||||
AssetCatalog.cpp
|
||||
AssetProcessorConnection.cpp
|
||||
NativeWindow.cpp
|
||||
TransformComponent.cpp
|
||||
SQLiteConnectionTests.cpp
|
||||
ProcessLaunchParseTests.cpp
|
||||
Application.cpp
|
||||
PlatformHelper.cpp
|
||||
Scene.cpp
|
||||
EntityOwnershipService/EntityOwnershipServiceTestFixture.h
|
||||
EntityOwnershipService/EntityOwnershipServiceTestFixture.cpp
|
||||
EntityOwnershipService/SliceEditorEntityOwnershipTests.cpp
|
||||
EntityOwnershipService/SliceEntityOwnershipTests.cpp
|
||||
CameraState.cpp
|
||||
InputTests.cpp
|
||||
)
|
||||
@@ -41,7 +41,7 @@ namespace AzNetworking
|
||||
|
||||
void TcpSocketManager::ProcessEvents(AZ::TimeMs maxBlockMs, const SocketEventCallback& readCallback, const SocketEventCallback& writeCallback)
|
||||
{
|
||||
if(static_cast<int32_t>(m_maxFd) <= 0 && m_socketFds.empty())
|
||||
if(static_cast<int32_t>(m_maxFd) <= 0 || m_socketFds.empty())
|
||||
{
|
||||
// There are no available sockets to process
|
||||
return;
|
||||
|
||||
@@ -63,6 +63,9 @@ namespace AzToolsFramework
|
||||
//! Signal the Python handler to stop
|
||||
virtual bool StopPython(bool silenceWarnings = false) = 0;
|
||||
|
||||
//! Query to determine if the Python VM has been initialized indicating an active state
|
||||
virtual bool IsPythonActive() = 0;
|
||||
|
||||
//! Determines if the caller needs to wait for the Python VM to initialize (non-main thread only)
|
||||
virtual void WaitForInitialization() {}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <AzFramework/Input/Buses/Notifications/InputChannelNotificationBus.h>
|
||||
#include <AzFramework/Input/Buses/Requests/InputChannelRequestBus.h>
|
||||
#include <AzQtComponents/Utilities/QtWindowUtilities.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCursor>
|
||||
@@ -187,12 +188,6 @@ namespace AzToolsFramework
|
||||
|
||||
bool QtEventToAzInputMapper::HandlesInputEvent(const AzFramework::InputChannel& channel) const
|
||||
{
|
||||
const AzFramework::InputChannelId& channelId = channel.GetInputChannelId();
|
||||
if (channelId == AzFramework::InputDeviceMouse::Movement::X || channelId == AzFramework::InputDeviceMouse::Movement::Y)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// We map keyboard and mouse events from Qt, so flag all events coming from those devices
|
||||
// as handled by our synthetic event system.
|
||||
const AzFramework::InputDeviceId& deviceId = channel.GetInputDevice().GetInputDeviceId();
|
||||
@@ -210,6 +205,22 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
void QtEventToAzInputMapper::SetCursorCaptureEnabled(bool enabled)
|
||||
{
|
||||
if (m_capturingCursor != enabled)
|
||||
{
|
||||
m_capturingCursor = enabled;
|
||||
if (m_capturingCursor)
|
||||
{
|
||||
qApp->setOverrideCursor(Qt::BlankCursor);
|
||||
}
|
||||
else
|
||||
{
|
||||
qApp->restoreOverrideCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool QtEventToAzInputMapper::eventFilter(QObject* object, QEvent* event)
|
||||
{
|
||||
// Abort if processing isn't enabled.
|
||||
@@ -284,13 +295,25 @@ namespace AzToolsFramework
|
||||
{
|
||||
auto systemCursorChannel =
|
||||
GetInputChannel<AzFramework::InputChannelDeltaWithSharedPosition2D>(AzFramework::InputDeviceMouse::SystemCursorPosition);
|
||||
auto movementXChannel =
|
||||
GetInputChannel<AzFramework::InputChannelDeltaWithSharedPosition2D>(AzFramework::InputDeviceMouse::Movement::X);
|
||||
auto movementYChannel =
|
||||
GetInputChannel<AzFramework::InputChannelDeltaWithSharedPosition2D>(AzFramework::InputDeviceMouse::Movement::Y);
|
||||
auto mouseWheelChannel =
|
||||
GetInputChannel<AzFramework::InputChannelDeltaWithSharedPosition2D>(AzFramework::InputDeviceMouse::Movement::Z);
|
||||
|
||||
systemCursorChannel->ProcessRawInputEvent(m_cursorPosition->m_normalizedPositionDelta.GetLength());
|
||||
// Generate movement events based on the pixel delta divided by the DPI scaling factor, to calculate a rough approximation
|
||||
// of cursor movement velocity.
|
||||
movementXChannel->ProcessRawInputEvent(
|
||||
m_cursorPosition->m_normalizedPositionDelta.GetX() * aznumeric_cast<float>(m_sourceWidget->width()) / m_sourceWidget->devicePixelRatioF());
|
||||
movementYChannel->ProcessRawInputEvent(
|
||||
m_cursorPosition->m_normalizedPositionDelta.GetY() * aznumeric_cast<float>(m_sourceWidget->height()) / m_sourceWidget->devicePixelRatioF());
|
||||
mouseWheelChannel->ProcessRawInputEvent(0.f);
|
||||
|
||||
NotifyUpdateChannelIfNotIdle(systemCursorChannel, nullptr);
|
||||
NotifyUpdateChannelIfNotIdle(movementXChannel, nullptr);
|
||||
NotifyUpdateChannelIfNotIdle(movementYChannel, nullptr);
|
||||
NotifyUpdateChannelIfNotIdle(mouseWheelChannel, nullptr);
|
||||
}
|
||||
|
||||
@@ -318,16 +341,42 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
AZ::Vector2 QtEventToAzInputMapper::WidgetPositionToNormalizedPosition(QPoint position)
|
||||
{
|
||||
const float normalizedX = aznumeric_cast<float>(position.x()) / aznumeric_cast<float>(m_sourceWidget->width());
|
||||
const float normalizedY = aznumeric_cast<float>(position.y()) / aznumeric_cast<float>(m_sourceWidget->height());
|
||||
return AZ::Vector2{normalizedX, normalizedY};
|
||||
}
|
||||
|
||||
QPoint QtEventToAzInputMapper::NormalizedPositionToWidgetPosition(AZ::Vector2 normalizedPosition)
|
||||
{
|
||||
const int denormalizedX = aznumeric_cast<int>(normalizedPosition.GetX() * m_sourceWidget->width());
|
||||
const int denormalizedY = aznumeric_cast<int>(normalizedPosition.GetY() * m_sourceWidget->height());
|
||||
return QPoint{denormalizedX, denormalizedY};
|
||||
}
|
||||
|
||||
void QtEventToAzInputMapper::HandleMouseMoveEvent(QMouseEvent* mouseEvent)
|
||||
{
|
||||
AZ::Vector2 lastCursorPosition = m_cursorPosition->m_normalizedPosition;
|
||||
|
||||
const QPoint mousePos = mouseEvent->pos();
|
||||
const float normalizedX = aznumeric_cast<float>(mousePos.x()) / aznumeric_cast<float>(m_sourceWidget->width());
|
||||
const float normalizedY = aznumeric_cast<float>(mousePos.y()) / aznumeric_cast<float>(m_sourceWidget->height());
|
||||
const AZ::Vector2 normalizedPosition(normalizedX, normalizedY);
|
||||
const AZ::Vector2 normalizedPosition = WidgetPositionToNormalizedPosition(mousePos);
|
||||
m_cursorPosition->m_normalizedPositionDelta = normalizedPosition - m_cursorPosition->m_normalizedPosition;
|
||||
m_cursorPosition->m_normalizedPosition = normalizedPosition;
|
||||
ProcessPendingMouseEvents();
|
||||
m_mouseChannelsNeedUpdate = true;
|
||||
|
||||
if (m_capturingCursor)
|
||||
{
|
||||
// Reset our cursor position to the previous point.
|
||||
QPoint targetScreenPosition = m_sourceWidget->mapToGlobal(NormalizedPositionToWidgetPosition(lastCursorPosition));
|
||||
AzQtComponents::SetCursorPos(targetScreenPosition);
|
||||
|
||||
// Even though we just set the cursor position, there are edge cases such as remote desktop that will leave
|
||||
// the cursor position unchanged. For safety, we re-cache our last cursor position for delta generation.
|
||||
QPoint actualWidgetPosition = m_sourceWidget->mapFromGlobal(QCursor::pos());
|
||||
m_cursorPosition->m_normalizedPosition = WidgetPositionToNormalizedPosition(actualWidgetPosition);
|
||||
}
|
||||
}
|
||||
|
||||
void QtEventToAzInputMapper::HandleKeyEvent(QKeyEvent* keyEvent)
|
||||
|
||||
@@ -47,6 +47,12 @@ namespace AzToolsFramework
|
||||
//! Sets whether or not this input mapper should be updating its input channels from Qt events.
|
||||
void SetEnabled(bool enabled);
|
||||
|
||||
//! Sets whether or not the cursor should be constrained to the source widget and invisible.
|
||||
//! Internally, this will reset the cursor position after each move event to ensure movement
|
||||
//! events don't allow the cursor to escape. This can be used for typical camera controls
|
||||
//! like a dolly or rotation, where mouse movement is important but cursor location is not.
|
||||
void SetCursorCaptureEnabled(bool enabled);
|
||||
|
||||
// QObject overrides...
|
||||
bool eventFilter(QObject* object, QEvent* event) override;
|
||||
|
||||
@@ -106,6 +112,11 @@ namespace AzToolsFramework
|
||||
// Processes any pending mouse movement events, this allows mouse movement channels to close themselves.
|
||||
void ProcessPendingMouseEvents();
|
||||
|
||||
// Converts a point in logical source widget space [0..m_sourceWidget->size()] to normalized [0..1] space.
|
||||
AZ::Vector2 WidgetPositionToNormalizedPosition(QPoint position);
|
||||
// Converts a point in normalized [0..1] space to logical source widget space [0..m_sourceWidget->size()].
|
||||
QPoint NormalizedPositionToWidgetPosition(AZ::Vector2 normalizedPosition);
|
||||
|
||||
// Handle mouse click events.
|
||||
void HandleMouseButtonEvent(QMouseEvent* mouseEvent);
|
||||
// Handle mouse move events.
|
||||
@@ -144,6 +155,8 @@ namespace AzToolsFramework
|
||||
bool m_mouseChannelsNeedUpdate = false;
|
||||
// Flags whether or not Qt events should currently be processed.
|
||||
bool m_enabled = true;
|
||||
// Flags whether or not the cursor is being constrained to the source widget (for invisible mouse movement).
|
||||
bool m_capturingCursor = false;
|
||||
|
||||
// Our viewport-specific AZ devices. We control their internal input channel states.
|
||||
AZStd::unique_ptr<EditorQtMouseDevice> m_mouseDevice;
|
||||
|
||||
+11
-8
@@ -172,20 +172,23 @@ namespace AzToolsFramework
|
||||
PrefabDom& templateDomReference = m_prefabSystemComponentInterface->FindTemplateDom(templateId);
|
||||
|
||||
//apply patch to template
|
||||
AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::ApplyPatch(templateDomReference,
|
||||
templateDomReference.GetAllocator(), providedPatch, AZ::JsonMergeApproach::JsonPatch);
|
||||
AZ::JsonSerializationResult::ResultCode result =
|
||||
PrefabDomUtils::ApplyPatches(templateDomReference, templateDomReference.GetAllocator(), providedPatch);
|
||||
|
||||
//trigger propagation
|
||||
if (result.GetOutcome() == AZ::JsonSerializationResult::Outcomes::Success)
|
||||
if (result.GetOutcome() != AZ::JsonSerializationResult::Outcomes::Success)
|
||||
{
|
||||
m_prefabSystemComponentInterface->SetTemplateDirtyFlag(templateId, true);
|
||||
m_prefabSystemComponentInterface->PropagateTemplateChanges(templateId, instanceToExclude);
|
||||
return true;
|
||||
AZ_Error("Prefab", false, "Patch was not successfully applied.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Error("Prefab", false, "Patch was not successfully applied");
|
||||
return false;
|
||||
AZ_Error(
|
||||
"Prefab", result.GetOutcome() != AZ::JsonSerializationResult::Outcomes::PartialSkip,
|
||||
"Some of the patches are not successfully applied.");
|
||||
m_prefabSystemComponentInterface->SetTemplateDirtyFlag(templateId, true);
|
||||
m_prefabSystemComponentInterface->PropagateTemplateChanges(templateId, instanceToExclude);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -176,12 +176,17 @@ namespace AzToolsFramework
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ::JsonSerializationResult::ResultCode applyPatchResult = AZ::JsonSerialization::ApplyPatch(
|
||||
sourceTemplateDomCopy,
|
||||
targetTemplatePrefabDom.GetAllocator(),
|
||||
patchesReference->get(),
|
||||
AZ::JsonMergeApproach::JsonPatch);
|
||||
AZ::JsonSerializationResult::ResultCode applyPatchResult =
|
||||
PrefabDomUtils::ApplyPatches(sourceTemplateDomCopy, targetTemplatePrefabDom.GetAllocator(), patchesReference->get());
|
||||
linkedInstanceDom.CopyFrom(sourceTemplateDomCopy, targetTemplatePrefabDom.GetAllocator());
|
||||
|
||||
PrefabDomValueReference sourceTemplateName =
|
||||
PrefabDomUtils::FindPrefabDomValue(sourceTemplateDomCopy, PrefabDomUtils::SourceName);
|
||||
AZ_Assert(sourceTemplateName && sourceTemplateName->get().IsString(), "A valid source template name couldn't be found");
|
||||
PrefabDomValueReference targetTemplateName =
|
||||
PrefabDomUtils::FindPrefabDomValue(targetTemplatePrefabDom, PrefabDomUtils::SourceName);
|
||||
AZ_Assert(targetTemplateName && targetTemplateName->get().IsString(), "A valid target template name couldn't be found");
|
||||
|
||||
if (applyPatchResult.GetProcessing() != AZ::JsonSerializationResult::Processing::Completed)
|
||||
{
|
||||
AZ_Error(
|
||||
@@ -190,6 +195,14 @@ namespace AzToolsFramework
|
||||
m_sourceTemplateId, m_targetTemplateId);
|
||||
return false;
|
||||
}
|
||||
if (applyPatchResult.GetOutcome() == AZ::JsonSerializationResult::Outcomes::PartialSkip)
|
||||
{
|
||||
AZ_Error(
|
||||
"Prefab", false,
|
||||
"Link::UpdateTarget - Some of the patches couldn't be applied on the source template '%s' present under the "
|
||||
"target Template '%s'.",
|
||||
sourceTemplateName->get().GetString(), targetTemplateName->get().GetString());
|
||||
}
|
||||
}
|
||||
|
||||
// This is a guardrail to ensure the linked instance dom always has the LinkId value
|
||||
|
||||
@@ -236,6 +236,26 @@ namespace AzToolsFramework
|
||||
return findInstancesResult->get();
|
||||
}
|
||||
|
||||
AZ::JsonSerializationResult::ResultCode ApplyPatches(
|
||||
PrefabDomValue& prefabDomToApplyPatchesOn, PrefabDom::AllocatorType& allocator, const PrefabDomValue& patches)
|
||||
{
|
||||
auto issueReportingCallback = [](AZStd::string_view, AZ::JsonSerializationResult::ResultCode result,
|
||||
AZStd::string_view) -> AZ::JsonSerializationResult::ResultCode
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
if (result.GetProcessing() == Processing::Halted)
|
||||
{
|
||||
return ResultCode(result.GetTask(), Outcomes::PartialSkip);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
AZ::JsonApplyPatchSettings applyPatchSettings;
|
||||
applyPatchSettings.m_reporting = AZStd::move(issueReportingCallback);
|
||||
return AZ::JsonSerialization::ApplyPatch(
|
||||
prefabDomToApplyPatchesOn, allocator, patches, AZ::JsonMergeApproach::JsonPatch, applyPatchSettings);
|
||||
}
|
||||
|
||||
void PrintPrefabDomValue(
|
||||
[[maybe_unused]] const AZStd::string_view printMessage,
|
||||
[[maybe_unused]] const PrefabDomValue& prefabDomValue)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Serialization/Json/JsonSerializationResult.h>
|
||||
#include <AzCore/std/optional.h>
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzToolsFramework/Prefab/Instance/Instance.h>
|
||||
@@ -122,6 +123,11 @@ namespace AzToolsFramework
|
||||
*/
|
||||
PrefabDomValueConstReference GetInstancesValue(const PrefabDomValue& prefabDom);
|
||||
|
||||
AZ::JsonSerializationResult::ResultCode ApplyPatches(
|
||||
PrefabDomValue& prefabDomToApplyPatchesOn,
|
||||
PrefabDom::AllocatorType& allocator,
|
||||
const PrefabDomValue& patches);
|
||||
|
||||
/**
|
||||
* Prints the contents of the given prefab DOM value to the debug output console in a readable format.
|
||||
* @param printMessage The message that will be printed before printing the PrefabDomValue
|
||||
|
||||
@@ -261,8 +261,13 @@ namespace AzToolsFramework
|
||||
instanceDom.CopyFrom(instanceDomRef->get(), instanceDom.GetAllocator());
|
||||
|
||||
//apply the patch to the template within the target
|
||||
AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::ApplyPatch(instanceDom,
|
||||
instanceDom.GetAllocator(), patch, AZ::JsonMergeApproach::JsonPatch);
|
||||
AZ::JsonSerializationResult::ResultCode result = PrefabDomUtils::ApplyPatches(instanceDom, instanceDom.GetAllocator(), patch);
|
||||
|
||||
AZ_Error(
|
||||
"Prefab",
|
||||
result.GetOutcome() == AZ::JsonSerializationResult::Outcomes::PartialSkip ||
|
||||
result.GetOutcome() == AZ::JsonSerializationResult::Outcomes::Success,
|
||||
"Some of the patches are not successfully applied.");
|
||||
|
||||
//remove the link id placed into the instance
|
||||
auto linkIdIter = instanceDom.FindMember(PrefabDomUtils::LinkIdName);
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace AzToolsFramework
|
||||
/// @name Reverse URLs.
|
||||
/// Used to identify common actions and override them when necessary.
|
||||
//@{
|
||||
static const AZ::Crc32 s_backAction = AZ_CRC("com.amazon.action.common.back", 0xd772a2af);
|
||||
static const AZ::Crc32 s_deleteAction = AZ_CRC("com.amazon.action.common.delete", 0x5731f6cb);
|
||||
static const AZ::Crc32 s_duplicateAction = AZ_CRC("com.amazon.action.common.duplicate", 0x08ccf461);
|
||||
static const AZ::Crc32 s_nextComponentMode = AZ_CRC("com.amazon.action.common.nextComponentMode", 0xcc26094f);
|
||||
static const AZ::Crc32 s_previousComponentMode = AZ_CRC("com.amazon.action.common.previousComponentMode", 0x0d18ff39);
|
||||
static const AZ::Crc32 s_backAction = AZ_CRC("com.o3de.action.common.back", 0xd772a2af);
|
||||
static const AZ::Crc32 s_deleteAction = AZ_CRC("com.o3de.action.common.delete", 0x5731f6cb);
|
||||
static const AZ::Crc32 s_duplicateAction = AZ_CRC("com.o3de.action.common.duplicate", 0x08ccf461);
|
||||
static const AZ::Crc32 s_nextComponentMode = AZ_CRC("com.o3de.action.common.nextComponentMode", 0xcc26094f);
|
||||
static const AZ::Crc32 s_previousComponentMode = AZ_CRC("com.o3de.action.common.previousComponentMode", 0x0d18ff39);
|
||||
//@}
|
||||
|
||||
/// Specific Action properties to be sent to a type implementing
|
||||
|
||||
@@ -276,11 +276,6 @@ namespace AzToolsFramework
|
||||
virtual void EndCursorCapture() = 0;
|
||||
//! Gets the most recent recorded cursor position in the viewport in screen space coordinates.
|
||||
virtual AzFramework::ScreenPoint ViewportCursorScreenPosition() = 0;
|
||||
//! Gets the cursor position recorded prior to the most recent cursor position.
|
||||
//! Note: The cursor may be captured by the viewport, in which case this may not correspond to the last result
|
||||
//! from ViewportCursorScreenPosition. This method will always return the correct position to generate a mouse
|
||||
//! position delta.
|
||||
virtual AZStd::optional<AzFramework::ScreenPoint> PreviousViewportCursorScreenPosition() = 0;
|
||||
//! Is mouse over viewport.
|
||||
virtual bool IsMouseOver() const = 0;
|
||||
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
}
|
||||
|
||||
AZ::Crc32 m_uri; //!< Unique identifier for the Action. (In the form 'com.amazon.action.---").
|
||||
AZ::Crc32 m_uri; //!< Unique identifier for the Action. (In the form 'com.o3de.action.---").
|
||||
AZStd::vector<AZStd::function<void()>> m_callbacks; //!< Callbacks associated with this Action (note: with multi-selections
|
||||
//!< there will be a callback per Entity/Component).
|
||||
AZStd::unique_ptr<QAction> m_action; //!< The QAction associated with the overrideWidget for all ComponentMode actions.
|
||||
|
||||
@@ -76,6 +76,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
PRIVATE
|
||||
AZ::AzTestShared
|
||||
3rdParty::Qt::Test
|
||||
AZ::AzFrameworkTestShared
|
||||
AZ::AzToolsFramework
|
||||
AZ::AzToolsFrameworkTestCommon
|
||||
AZ::AzManipulatorTestFramework.Static
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/std/smart_ptr/unique_ptr.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
#include <Tests/AZTestShared/Utils/Utils.h>
|
||||
#include <AzToolsFramework/Archive/ArchiveAPI.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
@@ -23,6 +24,7 @@
|
||||
#include <QStandardPaths>
|
||||
#include <QTemporaryDir>
|
||||
#include <QTextStream>
|
||||
#include <Utils/Utils.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
@@ -72,7 +74,7 @@ namespace UnitTest
|
||||
|
||||
void CreateArchiveFolder( QString archiveFolderName, QStringList fileList )
|
||||
{
|
||||
QDir tempPath = QDir(m_tempDir.path()).filePath(archiveFolderName);
|
||||
QDir tempPath = QDir(m_tempDir.GetDirectory()).filePath(archiveFolderName);
|
||||
|
||||
for (const auto& thisFile : fileList)
|
||||
{
|
||||
@@ -88,12 +90,12 @@ namespace UnitTest
|
||||
|
||||
QString GetArchivePath()
|
||||
{
|
||||
return QDir(m_tempDir.path()).filePath("TestArchive.pak");
|
||||
return QDir(m_tempDir.GetDirectory()).filePath("TestArchive.pak");
|
||||
}
|
||||
|
||||
QString GetArchiveFolder()
|
||||
{
|
||||
return QDir(m_tempDir.path()).filePath(GetArchiveFolderName());
|
||||
return QDir(m_tempDir.GetDirectory()).filePath(GetArchiveFolderName());
|
||||
}
|
||||
|
||||
bool CreateArchive()
|
||||
@@ -111,6 +113,11 @@ namespace UnitTest
|
||||
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
|
||||
// in the unit tests.
|
||||
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
|
||||
|
||||
if (auto fileIoBase = AZ::IO::FileIOBase::GetInstance(); fileIoBase != nullptr)
|
||||
{
|
||||
fileIoBase->SetAlias("@assets@", m_tempDir.GetDirectory());
|
||||
}
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
@@ -120,7 +127,7 @@ namespace UnitTest
|
||||
}
|
||||
|
||||
AZStd::unique_ptr<ToolsTestApplication> m_app;
|
||||
QTemporaryDir m_tempDir {QDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)).filePath("ArchiveTests-")};
|
||||
UnitTest::ScopedTemporaryDirectory m_tempDir;
|
||||
};
|
||||
|
||||
#if AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
|
||||
@@ -129,7 +136,7 @@ namespace UnitTest
|
||||
TEST_F(ArchiveTest, CreateArchiveBlocking_FilesAtThreeDepths_ArchiveCreated)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
|
||||
{
|
||||
EXPECT_TRUE(m_tempDir.isValid());
|
||||
EXPECT_TRUE(m_tempDir.IsValid());
|
||||
CreateArchiveFolder();
|
||||
|
||||
bool createResult = CreateArchive();
|
||||
@@ -143,7 +150,7 @@ namespace UnitTest
|
||||
TEST_F(ArchiveTest, ListFilesInArchiveBlocking_FilesAtThreeDepths_FilesFound)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
|
||||
{
|
||||
EXPECT_TRUE(m_tempDir.isValid());
|
||||
EXPECT_TRUE(m_tempDir.IsValid());
|
||||
CreateArchiveFolder();
|
||||
|
||||
EXPECT_EQ(CreateArchive(), true);
|
||||
@@ -203,7 +210,9 @@ namespace UnitTest
|
||||
}
|
||||
|
||||
bool catalogCreated{ false };
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
AzToolsFramework::AssetBundleCommandsBus::BroadcastResult(catalogCreated, &AzToolsFramework::AssetBundleCommandsBus::Events::CreateDeltaCatalog, GetArchivePath().toStdString().c_str(), true);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // produces different counts in different platforms
|
||||
EXPECT_EQ(catalogCreated, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <AzToolsFramework/AssetCatalog/PlatformAddressedAssetCatalog.h>
|
||||
#include <AzToolsFramework/UnitTest/ToolsTestApplication.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
#include <Utils/Utils.h>
|
||||
|
||||
namespace // anonymous
|
||||
{
|
||||
@@ -54,9 +55,11 @@ namespace UnitTest
|
||||
m_localFileIO = aznew AZ::IO::LocalFileIO();
|
||||
|
||||
m_priorFileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
AZ::IO::FileIOBase::SetInstance(nullptr);
|
||||
AZ::IO::FileIOBase::SetInstance(m_localFileIO);
|
||||
|
||||
AZ::IO::FileIOBase::GetInstance()->SetAlias("@assets@", GetTestFolderPath().c_str());
|
||||
AZ::IO::FileIOBase::GetInstance()->SetAlias("@assets@", m_tempDir.GetDirectory());
|
||||
|
||||
AZStd::string assetRoot = AzToolsFramework::PlatformAddressedAssetCatalog::GetAssetRootForPlatform(AzFramework::PlatformId::PC);
|
||||
|
||||
for (int idx = 0; idx < TotalAssets; idx++)
|
||||
@@ -68,9 +71,11 @@ namespace UnitTest
|
||||
assetRegistry.RegisterAsset(m_assets[idx], info);
|
||||
|
||||
AzFramework::StringFunc::Path::Join(assetRoot.c_str(), info.m_relativePath.c_str(), m_assetsPath[idx]);
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
if (m_fileStreams[idx].Open(m_assetsPath[idx].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
|
||||
{
|
||||
m_fileStreams[idx].Write(info.m_relativePath.size(), info.m_relativePath.data());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // writing to asset cache folder
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -114,10 +119,12 @@ namespace UnitTest
|
||||
|
||||
// Modify contents of asset2
|
||||
int fileIndex = 2;
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
if (m_fileStreams[fileIndex].Open(m_assetsPath[fileIndex].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
|
||||
{
|
||||
AZStd::string fileContent = AZStd::string::format("new Asset%d.txt", fileIndex);// changing file content
|
||||
m_fileStreams[fileIndex].Write(fileContent.size(), fileContent.c_str());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // writing to asset cache folder
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -126,10 +133,12 @@ namespace UnitTest
|
||||
|
||||
// Modify contents of asset 4
|
||||
fileIndex = 4;
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
if (m_fileStreams[fileIndex].Open(m_assetsPath[fileIndex].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
|
||||
{
|
||||
AZStd::string fileContent = AZStd::string::format("new Asset%d.txt", fileIndex);// changing file content
|
||||
m_fileStreams[fileIndex].Write(fileContent.size(), fileContent.c_str());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // writing to asset cache folder
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -151,7 +160,9 @@ namespace UnitTest
|
||||
{
|
||||
if (fileIO->Exists(TempFiles[idx]))
|
||||
{
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
fileIO->Remove(TempFiles[idx]);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // deleting from asset cache folder
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,19 +173,24 @@ namespace UnitTest
|
||||
m_fileStreams[idx].Close();
|
||||
if (fileIO->Exists(m_assetsPath[idx].c_str()))
|
||||
{
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
fileIO->Remove(m_assetsPath[idx].c_str());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // deleting from asset cache folder
|
||||
}
|
||||
}
|
||||
|
||||
auto pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC);
|
||||
if (fileIO->Exists(pcCatalogFile.c_str()))
|
||||
{
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
fileIO->Remove(pcCatalogFile.c_str());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // deleting from asset cache folder
|
||||
}
|
||||
|
||||
delete m_pcCatalog;
|
||||
delete m_localFileIO;
|
||||
m_localFileIO = nullptr;
|
||||
AZ::IO::FileIOBase::SetInstance(nullptr);
|
||||
AZ::IO::FileIOBase::SetInstance(m_priorFileIO);
|
||||
m_application->Stop();
|
||||
delete m_application;
|
||||
@@ -726,6 +742,7 @@ namespace UnitTest
|
||||
}
|
||||
|
||||
ToolsTestApplication* m_application;
|
||||
UnitTest::ScopedTemporaryDirectory m_tempDir;
|
||||
AzToolsFramework::PlatformAddressedAssetCatalog* m_pcCatalog;
|
||||
AZ::IO::FileIOBase* m_priorFileIO = nullptr;
|
||||
AZ::IO::FileIOBase* m_localFileIO = nullptr;
|
||||
|
||||
@@ -87,10 +87,12 @@ namespace UnitTest
|
||||
for (int idx = 0; idx < s_totalAssets; idx++)
|
||||
{
|
||||
AzFramework::StringFunc::Path::Join(assetRoot.c_str(), m_assetsPath[idx].c_str(), m_assetsPathFull[platformCount][idx]);
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
if (m_fileStreams[platformCount][idx].Open(m_assetsPathFull[platformCount][idx].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
|
||||
{
|
||||
m_fileStreams[platformCount][idx].Write(m_assetsPath[idx].size(), m_assetsPath[idx].data());
|
||||
m_fileStreams[platformCount][idx].Close();
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // writing to asset cache folder, only invalid for PC, not invalid in Jenkins
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -112,7 +114,9 @@ namespace UnitTest
|
||||
m_testDynamicSliceAssetId = testDynamicSliceAsset;
|
||||
m_assetRegistry->RegisterAsset(testDynamicSliceAsset, dynamicSliceAssetInfo);
|
||||
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
AZ::IO::FileIOStream dynamicSliceFileIOStream(TestDynamicSliceAssetPath, AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeText);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // writing to asset cache folder, not invalid in Jenkins
|
||||
|
||||
AZ::Data::AssetInfo sliceAssetInfo;
|
||||
sliceAssetInfo.m_relativePath = TestSliceAssetPath;
|
||||
@@ -124,7 +128,9 @@ namespace UnitTest
|
||||
secondSliceAssetInfo.m_assetId = secondTestSliceAsset;
|
||||
m_assetRegistry->RegisterAsset(secondTestSliceAsset, secondSliceAssetInfo);
|
||||
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
AZ::IO::FileIOStream sliceFileIOStream(TestSliceAssetPath, AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeText);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // writing to asset cache folder, not invalid in Jenkins
|
||||
|
||||
// asset0 -> asset1 -> asset2 -> asset4
|
||||
// --> asset3
|
||||
@@ -186,7 +192,6 @@ namespace UnitTest
|
||||
AZ::IO::Path assetRoot(AZ::Utils::GetProjectPath());
|
||||
assetRoot /= "Cache";
|
||||
AZ::IO::FileIOBase::GetInstance()->SetAlias("@root@", assetRoot.c_str());
|
||||
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
@@ -195,7 +200,9 @@ namespace UnitTest
|
||||
|
||||
if (fileIO->Exists(s_catalogFile))
|
||||
{
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
fileIO->Remove(s_catalogFile);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // deleting from asset cache folder, not invalid in Jenkins
|
||||
}
|
||||
|
||||
for (size_t platformCount = 0; platformCount < s_totalTestPlatforms; ++platformCount)
|
||||
@@ -206,26 +213,34 @@ namespace UnitTest
|
||||
// we need to close the handle before we try to remove the file
|
||||
if (fileIO->Exists(m_assetsPathFull[platformCount][idx].c_str()))
|
||||
{
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
fileIO->Remove(m_assetsPathFull[platformCount][idx].c_str());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // deleting from asset cache folder, not invalid in Jenkins
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fileIO->Exists(TestSliceAssetPath))
|
||||
{
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
fileIO->Remove(TestSliceAssetPath);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // deleting from asset cache folder, not invalid in Jenkins
|
||||
}
|
||||
|
||||
if (fileIO->Exists(TestDynamicSliceAssetPath))
|
||||
{
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
fileIO->Remove(TestDynamicSliceAssetPath);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // deleting from asset cache folder, not invalid in Jenkins
|
||||
}
|
||||
|
||||
auto pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC);
|
||||
auto androidCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ANDROID_ID);
|
||||
if (fileIO->Exists(pcCatalogFile.c_str()))
|
||||
{
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
fileIO->Remove(pcCatalogFile.c_str());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // deleting from asset cache folder, not invalid in Jenkins
|
||||
}
|
||||
|
||||
if (fileIO->Exists(androidCatalogFile.c_str()))
|
||||
@@ -266,7 +281,9 @@ namespace UnitTest
|
||||
AZ::IO::SystemFile::SetWritable(filePath.c_str(), false);
|
||||
|
||||
// Attempt to save to the same file. Should not be allowed.
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
EXPECT_FALSE(m_assetSeedManager->Save(filePath));
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // writing to asset cache folder, not invalid in Jenkins
|
||||
|
||||
// Clean up the test environment
|
||||
AZ::IO::SystemFile::SetWritable(filePath.c_str(), true);
|
||||
@@ -290,7 +307,9 @@ namespace UnitTest
|
||||
AZ::IO::SystemFile::SetWritable(filePath.c_str(), false);
|
||||
|
||||
// Attempt to save to the same file. Should not be allowed.
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
EXPECT_FALSE(m_assetSeedManager->SaveAssetFileInfo(filePath, AzFramework::PlatformFlags::Platform_PC, {}));
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // writing to asset cache folder, not invalid in Jenkins
|
||||
|
||||
// Clean up the test environment
|
||||
AZ::IO::SystemFile::SetWritable(filePath.c_str(), true);
|
||||
@@ -357,7 +376,9 @@ namespace UnitTest
|
||||
m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_PC);
|
||||
|
||||
// Step we are testing
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
m_assetSeedManager->AddPlatformToAllSeeds(AzFramework::PlatformId::ANDROID_ID);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // writing to asset cache folder, not invalid in Jenkins
|
||||
|
||||
// Verification
|
||||
AzFramework::PlatformFlags expectedPlatformFlags = AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID;
|
||||
@@ -623,11 +644,13 @@ namespace UnitTest
|
||||
|
||||
EXPECT_EQ(assetList1.m_fileInfoList.size(), 1);
|
||||
EXPECT_TRUE(Search(assetList1, assets[fileIndex]));
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
if (m_fileStreams[0][fileIndex].Open(m_assetsPathFull[0][fileIndex].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
|
||||
{
|
||||
AZStd::string fileContent = AZStd::string::format("asset%d.txt", fileIndex);
|
||||
m_fileStreams[0][fileIndex].Write(fileContent.size(), fileContent.c_str());
|
||||
m_fileStreams[0][fileIndex].Close();
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // writing to asset cache folder, not invalid in Jenkins
|
||||
}
|
||||
|
||||
AzToolsFramework::AssetFileInfoList assetList2 = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC);
|
||||
@@ -654,11 +677,13 @@ namespace UnitTest
|
||||
|
||||
EXPECT_EQ(assetList1.m_fileInfoList.size(), 1);
|
||||
EXPECT_TRUE(Search(assetList1, assets[fileIndex]));
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
if (m_fileStreams[0][fileIndex].Open(m_assetsPathFull[0][fileIndex].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
|
||||
{
|
||||
AZStd::string fileContent = AZStd::string::format("asset%d.txt", fileIndex + 1);// changing file content
|
||||
m_fileStreams[0][fileIndex].Write(fileContent.size(), fileContent.c_str());
|
||||
m_fileStreams[0][fileIndex].Close();
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // writing to asset cache folder, not invalid in Jenkins
|
||||
}
|
||||
|
||||
AzToolsFramework::AssetFileInfoList assetList2 = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC);
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace AzToolsFramework
|
||||
|
||||
AZStd::vector<AzToolsFramework::ActionOverride> PlaceHolderComponentMode::PopulateActionsImpl()
|
||||
{
|
||||
const AZ::Crc32 placeHolderComponentModeAction = AZ_CRC_CE("com.amazon.action.placeholder.test");
|
||||
const AZ::Crc32 placeHolderComponentModeAction = AZ_CRC_CE("com.o3de.action.placeholder.test");
|
||||
|
||||
return AZStd::vector<AzToolsFramework::ActionOverride>
|
||||
{
|
||||
|
||||
@@ -493,7 +493,10 @@ namespace UnitTest
|
||||
// Add placeholder component which implements component mode.
|
||||
entity->CreateComponent<PlaceHolderComponent>();
|
||||
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
entity->Activate();
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -348,7 +348,6 @@ namespace UnitTest
|
||||
EXPECT_FALSE(AzToolsFramework::ComponentPaletteUtil::ContainsEditableComponents(context, &Filter_IsTestComponent2, AZ::ComponentDescriptor::DependencyArrayType()));
|
||||
|
||||
// Reflect Test Component 2 for subsequent tests
|
||||
Inspector_TestComponent2::Reflect(context);
|
||||
m_application->RegisterComponentDescriptor(Inspector_TestComponent2Descriptor);
|
||||
|
||||
// Verify that there is now a component that satisfies the AppearsInGameComponentMenu filter without service dependency conditions
|
||||
|
||||
+4
-2
@@ -5,8 +5,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "FrameworkApplicationFixture.h"
|
||||
#include "Utils/Utils.h"
|
||||
#include <FrameworkApplicationFixture.h>
|
||||
#include <Utils/Utils.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/Outcome/Outcome.h>
|
||||
#include <AzCore/Serialization/Json/JsonSerialization.h>
|
||||
@@ -47,11 +47,13 @@ namespace UnitTest
|
||||
void SetUp()
|
||||
{
|
||||
m_prevFileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
AZ::IO::FileIOBase::SetInstance(nullptr);
|
||||
AZ::IO::FileIOBase::SetInstance(&m_fileIO);
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
AZ::IO::FileIOBase::SetInstance(nullptr);
|
||||
AZ::IO::FileIOBase::SetInstance(m_prevFileIO);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ AZTEST_EXPORT int AZ_UNIT_TEST_HOOK_NAME(int argc, char** argv)
|
||||
}
|
||||
styleManager->initialize(&app, engineRootPath);
|
||||
AZ::Test::printUnusedParametersWarning(argc, argv);
|
||||
AZ::Test::addTestEnvironments({ new ToolsFrameworkHook });
|
||||
AZ::Test::addTestEnvironments({ DEFAULT_UNIT_TEST_ENV, new ToolsFrameworkHook });
|
||||
int result = RUN_ALL_TESTS();
|
||||
styleManager.release();
|
||||
return result;
|
||||
|
||||
@@ -23,8 +23,7 @@ namespace UnitTest
|
||||
};
|
||||
|
||||
struct PerforceComponentFixture
|
||||
: ::testing::Test
|
||||
, TraceBusRedirector
|
||||
: ScopedAllocatorSetupFixture
|
||||
, SourceControlTest
|
||||
|
||||
{
|
||||
@@ -40,7 +39,6 @@ namespace UnitTest
|
||||
m_jobContext = aznew AZ::JobContext(*m_jobManager);
|
||||
AZ::JobContext::SetGlobalContext(m_jobContext);
|
||||
|
||||
AZ::Debug::TraceMessageBus::Handler::BusConnect();
|
||||
AZ::TickBus::AllowFunctionQueuing(true);
|
||||
|
||||
m_perforceComponent = AZStd::make_unique<MockPerforceComponent>();
|
||||
@@ -52,8 +50,6 @@ namespace UnitTest
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
AZ::Debug::TraceMessageBus::Handler::BusDisconnect();
|
||||
|
||||
AZ::TickBus::AllowFunctionQueuing(false);
|
||||
AZ::TickBus::ClearQueuedEvents();
|
||||
|
||||
|
||||
@@ -83,9 +83,11 @@ namespace UnitTest
|
||||
info.m_assetId = m_assets[platformNum][idx];
|
||||
assetRegistry->RegisterAsset(m_assets[platformNum][idx], info);
|
||||
m_assetsPath[platformNum][idx] = info.m_relativePath;
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
if (m_fileStreams[platformNum][idx].Open(m_assetsPath[platformNum][idx].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
|
||||
{
|
||||
m_fileStreams[platformNum][idx].Write(info.m_relativePath.size(), info.m_relativePath.data());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // writing to asset cache folder
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -131,7 +133,9 @@ namespace UnitTest
|
||||
m_fileStreams[platformNum][idx].Close();
|
||||
if (fileIO->Exists(m_assetsPath[platformNum][idx].c_str()))
|
||||
{
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
fileIO->Remove(m_assetsPath[platformNum][idx].c_str());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // removing from asset cache folder
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -246,7 +250,9 @@ namespace UnitTest
|
||||
AzFramework::AssetSystem::NetworkAssetUpdateInterface* notificationInterface = AZ::Interface<AzFramework::AssetSystem::NetworkAssetUpdateInterface>::Get();
|
||||
EXPECT_NE(notificationInterface, nullptr);
|
||||
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
auto* mockCatalog = new ::testing::NiceMock<PlatformAddressedAssetCatalogMessageTest>(AzFramework::PlatformId::ANDROID_ID);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
AZStd::unique_ptr< ::testing::NiceMock<PlatformAddressedAssetCatalogMessageTest>> catalogHolder;
|
||||
catalogHolder.reset(mockCatalog);
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@ namespace UnitTest
|
||||
|
||||
TEST_F(PrefabInstantiateTest, PrefabInstantiate_InstantiateInvalidTemplate_InstantiateFails)
|
||||
{
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
EXPECT_FALSE(m_prefabSystemComponent->InstantiatePrefab(AzToolsFramework::Prefab::InvalidTemplateId));
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
}
|
||||
|
||||
TEST_F(PrefabInstantiateTest, PrefabInstantiate_NoNestingTemplate_InstantiateSucceeds)
|
||||
|
||||
@@ -68,8 +68,10 @@ namespace UnitTest
|
||||
|
||||
MockPrefabFileIOActionValidator mockIOActionValidator;
|
||||
mockIOActionValidator.ReadPrefabDom(templateData.m_filePath, templatePrefabDom);
|
||||
|
||||
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
templateData.m_id = m_prefabLoaderInterface->LoadTemplateFromFile(templateData.m_filePath);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(3);
|
||||
templateData.m_isLoadedWithErrors = true;
|
||||
|
||||
PrefabTestDataUtils::ValidateTemplateLoad(templateData);
|
||||
@@ -115,7 +117,9 @@ namespace UnitTest
|
||||
targetTemplateData.m_filePath, targetTemplatePrefabDom);
|
||||
|
||||
// Load target and source Templates and get their Ids.
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
targetTemplateData.m_id = m_prefabLoaderInterface->LoadTemplateFromFile(targetTemplateData.m_filePath);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(4);
|
||||
sourceTemplateData.m_id = m_prefabSystemComponent->GetTemplateIdFromFilePath(sourceTemplateData.m_filePath);
|
||||
|
||||
// Because of cyclical dependency, the two Templates should be loaded with errors.
|
||||
@@ -144,7 +148,9 @@ namespace UnitTest
|
||||
MockPrefabFileIOActionValidator mockIOActionValidator;
|
||||
mockIOActionValidator.ReadPrefabDom(templateData.m_filePath, templatePrefabDom);
|
||||
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
templateData.m_id = m_prefabLoaderInterface->LoadTemplateFromFile(templateData.m_filePath);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(2);
|
||||
|
||||
PrefabTestDataUtils::ValidateTemplateLoad(templateData);
|
||||
}
|
||||
@@ -161,7 +167,9 @@ namespace UnitTest
|
||||
MockPrefabFileIOActionValidator mockIOActionValidator;
|
||||
mockIOActionValidator.ReadPrefabDom(templateData.m_filePath, templatePrefabDom);
|
||||
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
templateData.m_id = m_prefabLoaderInterface->LoadTemplateFromFile(templateData.m_filePath);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(2);
|
||||
|
||||
PrefabTestDataUtils::ValidateTemplateLoad(templateData);
|
||||
}
|
||||
@@ -183,7 +191,9 @@ namespace UnitTest
|
||||
templateInstanceData.m_source, PrefabTestDomUtils::CreatePrefabDom(),
|
||||
AZ::IO::ResultCode::Success, AZ::IO::ResultCode::Error);
|
||||
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
templateData.m_id = m_prefabLoaderInterface->LoadTemplateFromFile(templateData.m_filePath);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(3);
|
||||
|
||||
PrefabTestDataUtils::ValidateTemplateLoad(templateData);
|
||||
}
|
||||
@@ -279,8 +289,10 @@ namespace UnitTest
|
||||
|
||||
MockPrefabFileIOActionValidator mockIOActionValidator;
|
||||
mockIOActionValidator.ReadPrefabDom(pathToCorruptedPrefab, corruptedPrefabContent);
|
||||
|
||||
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
TemplateId templateId = m_prefabLoaderInterface->LoadTemplateFromFile(pathToCorruptedPrefab);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
|
||||
EXPECT_EQ(templateId, AzToolsFramework::Prefab::InvalidTemplateId);
|
||||
}
|
||||
@@ -289,8 +301,10 @@ namespace UnitTest
|
||||
{
|
||||
PrefabDom emptyPrefabDom = PrefabTestDomUtils::CreatePrefabDom();
|
||||
AZStd::string emptyPrefabDomStr = PrefabTestDomUtils::DomToString(emptyPrefabDom);
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
EXPECT_EQ(m_prefabLoaderInterface->LoadTemplateFromString(emptyPrefabDomStr, "|?<>"), AzToolsFramework::Prefab::InvalidTemplateId);
|
||||
EXPECT_EQ(m_prefabLoaderInterface->LoadTemplateFromString(emptyPrefabDomStr, "notAFile/"), AzToolsFramework::Prefab::InvalidTemplateId);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(2);
|
||||
}
|
||||
|
||||
TEST_F(PrefabLoadTemplateTest, LoadTemplate_LoadFromString_LoadsEmptyPrefab)
|
||||
@@ -318,9 +332,11 @@ namespace UnitTest
|
||||
);
|
||||
|
||||
AZStd::string selfDependentPrefabStr = PrefabTestDomUtils::DomToString(selfDependentPrefab);
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
templateData.m_id = m_prefabLoaderInterface->LoadTemplateFromString(
|
||||
selfDependentPrefabStr,
|
||||
templateData.m_filePath);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // produces different counts in Jenkins vs local
|
||||
|
||||
templateData.m_isLoadedWithErrors = true;
|
||||
|
||||
@@ -330,7 +346,9 @@ namespace UnitTest
|
||||
TEST_F(PrefabLoadTemplateTest, LoadTemplate_LoadFromString_CorruptedReturnsInvalidTemplateId)
|
||||
{
|
||||
AZStd::string corruptPrefab = "{ Corrupted PrefabDom";
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
TemplateId templateId = m_prefabLoaderInterface->LoadTemplateFromString(corruptPrefab);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
EXPECT_EQ(templateId, AzToolsFramework::Prefab::InvalidTemplateId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,13 +166,25 @@ namespace UnitTest
|
||||
if (expectedNestedInstanceDomInstances.has_value())
|
||||
{
|
||||
ASSERT_TRUE(actualNestedInstanceDomInstances.has_value());
|
||||
for (auto instanceIterator = expectedNestedInstanceDomInstances->get().MemberBegin();
|
||||
instanceIterator != expectedNestedInstanceDomInstances->get().MemberEnd(); ++instanceIterator)
|
||||
if (expectedNestedInstanceDomInstances->get().IsArray())
|
||||
{
|
||||
ComparePrefabDoms(
|
||||
instanceIterator->value,
|
||||
PrefabDomUtils::FindPrefabDomValue(actualNestedInstanceDomInstances->get(), instanceIterator->name.GetString()),
|
||||
shouldCompareLinkIds, shouldCompareContainerEntities);
|
||||
ASSERT_TRUE(actualNestedInstanceDomInstances->get().IsArray());
|
||||
const size_t expectedArraySize = expectedNestedInstanceDomInstances->get().GetArray().Size();
|
||||
EXPECT_EQ(0, expectedArraySize);
|
||||
const size_t actualArraySize = actualNestedInstanceDomInstances->get().GetArray().Size();
|
||||
EXPECT_EQ(0, actualArraySize);
|
||||
}
|
||||
if (expectedNestedInstanceDomInstances->get().IsObject())
|
||||
{
|
||||
ASSERT_TRUE(actualNestedInstanceDomInstances->get().IsObject());
|
||||
for (auto instanceIterator = expectedNestedInstanceDomInstances->get().MemberBegin();
|
||||
instanceIterator != expectedNestedInstanceDomInstances->get().MemberEnd(); ++instanceIterator)
|
||||
{
|
||||
ComparePrefabDoms(
|
||||
instanceIterator->value,
|
||||
PrefabDomUtils::FindPrefabDomValue(actualNestedInstanceDomInstances->get(), instanceIterator->name.GetString()),
|
||||
shouldCompareLinkIds, shouldCompareContainerEntities);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,7 @@ namespace UnitTest
|
||||
};
|
||||
|
||||
class PrefabTestFixture
|
||||
: public ToolsApplicationFixture,
|
||||
public UnitTest::TraceBusRedirector
|
||||
: public ToolsApplicationFixture
|
||||
{
|
||||
protected:
|
||||
|
||||
|
||||
@@ -96,8 +96,8 @@ namespace UnitTest
|
||||
|
||||
//apply the patch
|
||||
PrefabDom& templateDomReference = m_prefabSystemComponent->FindTemplateDom(nestedTemplateId);
|
||||
AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::ApplyPatch(templateDomReference,
|
||||
templateDomReference.GetAllocator(), patch, AZ::JsonMergeApproach::JsonPatch);
|
||||
AZ::JsonSerializationResult::ResultCode result =
|
||||
PrefabDomUtils::ApplyPatches(templateDomReference, templateDomReference.GetAllocator(), patch);
|
||||
|
||||
AZ_Error("Prefab", result.GetOutcome() == AZ::JsonSerializationResult::Outcomes::Success,
|
||||
"Patch was not successfully applied");
|
||||
|
||||
@@ -426,7 +426,9 @@ namespace UnitTest
|
||||
AZStd::any keyString = AZStd::make_any<AZStd::string_view>("0");
|
||||
|
||||
EXPECT_FALSE(propertyTree.GetContainerItem("My New Int", key).IsSuccess());
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
EXPECT_FALSE(propertyTree.GetContainerItem("My New List", keyString).IsSuccess());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
|
||||
PropertyTreeEditor::PropertyAccessOutcome outcome = propertyTree.GetContainerItem("My New List", key);
|
||||
EXPECT_TRUE(outcome.IsSuccess());
|
||||
@@ -446,7 +448,9 @@ namespace UnitTest
|
||||
AZStd::any value = AZStd::make_any<PropertyTreeEditorTester::PropertyTreeEditorNestedTester>(testUpdate);
|
||||
|
||||
EXPECT_FALSE(propertyTree.UpdateContainerItem("My New Int", key, value).IsSuccess());
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
EXPECT_FALSE(propertyTree.UpdateContainerItem("My New List", keyString, value).IsSuccess());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
EXPECT_TRUE(propertyTree.UpdateContainerItem("My New List", key, value).IsSuccess());
|
||||
|
||||
PropertyTreeEditor::PropertyAccessOutcome outcome = propertyTree.GetContainerItem("My New List", key);
|
||||
@@ -464,7 +468,9 @@ namespace UnitTest
|
||||
AZStd::any keyString = AZStd::make_any<AZStd::string_view>("0");
|
||||
|
||||
EXPECT_FALSE(propertyTree.RemoveContainerItem("My New Int", key).IsSuccess());
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
EXPECT_FALSE(propertyTree.RemoveContainerItem("My New List", keyString).IsSuccess());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
|
||||
PropertyTreeEditor::PropertyAccessOutcome outcomeAdd1 = propertyTree.RemoveContainerItem("My New List", key);
|
||||
EXPECT_TRUE(outcomeAdd1.IsSuccess());
|
||||
@@ -755,7 +761,9 @@ namespace UnitTest
|
||||
EXPECT_TRUE(propertyTree.SetProperty("My Int", anEmpty).IsSuccess());
|
||||
EXPECT_TRUE(propertyTree.SetProperty("My Negative Short", anEmpty).IsSuccess());
|
||||
EXPECT_TRUE(propertyTree.SetProperty("My New List", anEmpty).IsSuccess());
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
EXPECT_TRUE(propertyTree.SetProperty("My Asset Data", anEmpty).IsSuccess());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
EXPECT_TRUE(propertyTree.SetProperty("My Test Simple Asset", anEmpty).IsSuccess());
|
||||
}
|
||||
|
||||
|
||||
@@ -275,6 +275,7 @@ namespace UnitTest
|
||||
TEST_F(SliceUpgradeTest, IntermmediateDataTypeChange)
|
||||
{
|
||||
TestDataA::Reflect(m_serializeContext.get());
|
||||
AzToolsFramework::Components::EditorComponentBase::Reflect(m_serializeContext.get());
|
||||
TestComponentA_V0::Reflect(m_serializeContext.get());
|
||||
AZ::Entity* entityA = aznew AZ::Entity();
|
||||
TestComponentA_V0* component = entityA->CreateComponent<TestComponentA_V0>();
|
||||
@@ -320,6 +321,7 @@ namespace UnitTest
|
||||
TEST_F(SliceUpgradeTest, TypeChangeInUnorderedMap)
|
||||
{
|
||||
TestDataB_V0::Reflect(m_serializeContext.get());
|
||||
AzToolsFramework::Components::EditorComponentBase::Reflect(m_serializeContext.get());
|
||||
TestComponentB_V0::Reflect(m_serializeContext.get());
|
||||
AZ::Entity* entityA = aznew AZ::Entity();
|
||||
TestComponentB_V0* componentB = entityA->CreateComponent<TestComponentB_V0>();
|
||||
@@ -395,6 +397,7 @@ namespace UnitTest
|
||||
TEST_F(SliceUpgradeTest, TypeChangeInVector)
|
||||
{
|
||||
TestDataB_V0::Reflect(m_serializeContext.get());
|
||||
AzToolsFramework::Components::EditorComponentBase::Reflect(m_serializeContext.get());
|
||||
TestComponentC_V0::Reflect(m_serializeContext.get());
|
||||
AZ::Entity* entityA = aznew AZ::Entity();
|
||||
TestComponentC_V0* componentC = entityA->CreateComponent<TestComponentC_V0>();
|
||||
@@ -452,6 +455,7 @@ namespace UnitTest
|
||||
TEST_F(SliceUpgradeTest, UpgradeSkipVersion_TypeChange_FloatToDouble)
|
||||
{
|
||||
// 1. Create an entity with a TestComponentE_V4 with the default value for m_data
|
||||
AzToolsFramework::Components::EditorComponentBase::Reflect(m_serializeContext.get());
|
||||
TestComponentE_V4::Reflect(m_serializeContext.get());
|
||||
AZ::Entity* testEntity = aznew AZ::Entity();
|
||||
TestComponentE_V4* componentEV4 = testEntity->CreateComponent<TestComponentE_V4>();
|
||||
@@ -563,6 +567,7 @@ namespace UnitTest
|
||||
SliceUpgradeTestAsset::Reflect(m_serializeContext.get());
|
||||
AzFramework::SimpleAssetReference<SliceUpgradeTestAsset>::Register(*m_serializeContext.get());
|
||||
|
||||
AzToolsFramework::Components::EditorComponentBase::Reflect(m_serializeContext.get());
|
||||
TestComponentD_V1::Reflect(m_serializeContext.get());
|
||||
AZ::Entity* entity = aznew AZ::Entity();
|
||||
entity->CreateComponent<TestComponentD_V1>();
|
||||
|
||||
+19
-19
@@ -972,11 +972,11 @@ namespace UnitTest
|
||||
};
|
||||
|
||||
|
||||
class TestExportEditorComponent
|
||||
class SliceTestExportEditorComponent
|
||||
: public AzToolsFramework::Components::EditorComponentBase
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(TestExportEditorComponent, "{8FA877A2-38E6-49AD-B31E-71B86DC8BB03}", AzToolsFramework::Components::EditorComponentBase);
|
||||
AZ_COMPONENT(SliceTestExportEditorComponent, "{8FA877A2-38E6-49AD-B31E-71B86DC8BB03}", AzToolsFramework::Components::EditorComponentBase);
|
||||
|
||||
enum ExportComponentType
|
||||
{
|
||||
@@ -986,9 +986,9 @@ namespace UnitTest
|
||||
EXPORT_NULL_COMPONENT
|
||||
};
|
||||
|
||||
TestExportEditorComponent() {}
|
||||
SliceTestExportEditorComponent() {}
|
||||
|
||||
TestExportEditorComponent(ExportComponentType exportType, bool exportHandled) :
|
||||
SliceTestExportEditorComponent(ExportComponentType exportType, bool exportHandled) :
|
||||
m_exportType(exportType),
|
||||
m_exportHandled(exportHandled)
|
||||
{}
|
||||
@@ -1000,15 +1000,15 @@ namespace UnitTest
|
||||
{
|
||||
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<TestExportEditorComponent, AzToolsFramework::Components::EditorComponentBase>()
|
||||
serializeContext->Class<SliceTestExportEditorComponent, AzToolsFramework::Components::EditorComponentBase>()
|
||||
;
|
||||
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<TestExportEditorComponent>(
|
||||
editContext->Class<SliceTestExportEditorComponent>(
|
||||
"Test Export Editor Component", "Validate different options for exporting editor components")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::RuntimeExportCallback, &TestExportEditorComponent::ExportComponent)
|
||||
->Attribute(AZ::Edit::Attributes::RuntimeExportCallback, &SliceTestExportEditorComponent::ExportComponent)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -1070,7 +1070,7 @@ namespace UnitTest
|
||||
|
||||
m_app.RegisterComponentDescriptor(TestExportRuntimeComponent::CreateDescriptor());
|
||||
m_app.RegisterComponentDescriptor(TestExportOtherRuntimeComponent::CreateDescriptor());
|
||||
m_app.RegisterComponentDescriptor(TestExportEditorComponent::CreateDescriptor());
|
||||
m_app.RegisterComponentDescriptor(SliceTestExportEditorComponent::CreateDescriptor());
|
||||
|
||||
m_editorSliceAsset = Data::AssetManager::Instance().CreateAsset<SliceAsset>(Data::AssetId(Uuid::CreateRandom()));
|
||||
|
||||
@@ -1125,11 +1125,11 @@ namespace UnitTest
|
||||
}
|
||||
|
||||
// create entity containing the EditorOnly component in the editor slice
|
||||
void CreateTestExportEditorEntity(const char* name, TestExportEditorComponent::ExportComponentType exportType, bool exportHandled)
|
||||
void CreateTestExportEditorEntity(const char* name, SliceTestExportEditorComponent::ExportComponentType exportType, bool exportHandled)
|
||||
{
|
||||
AZ::Entity* entity = aznew AZ::Entity(name);
|
||||
entity->CreateComponent<AzToolsFramework::Components::TransformComponent>();
|
||||
entity->CreateComponent<TestExportEditorComponent>(exportType, exportHandled);
|
||||
entity->CreateComponent<SliceTestExportEditorComponent>(exportType, exportHandled);
|
||||
m_editorSliceComponent->AddEntity(entity);
|
||||
}
|
||||
|
||||
@@ -1314,7 +1314,7 @@ namespace UnitTest
|
||||
TEST_F(SliceCompilerTest, RuntimeExportCallback_EditorComponentExportedSuccessfully)
|
||||
{
|
||||
// Create an editor component that has a RuntimeExportCallback and successfully exports itself
|
||||
CreateTestExportEditorEntity("EntityWithEditorComponent", TestExportEditorComponent::ExportComponentType::EXPORT_OTHER_RUNTIME_COMPONENT, true);
|
||||
CreateTestExportEditorEntity("EntityWithEditorComponent", SliceTestExportEditorComponent::ExportComponentType::EXPORT_OTHER_RUNTIME_COMPONENT, true);
|
||||
|
||||
if (!CompileSlice())
|
||||
{
|
||||
@@ -1325,7 +1325,7 @@ namespace UnitTest
|
||||
// (A result of Runtime component means BuildGameEntity() ran instead)
|
||||
AZ::Entity* entity = GetCompiledEntity("EntityWithEditorComponent");
|
||||
EXPECT_TRUE(entity);
|
||||
EXPECT_FALSE(entity->FindComponent<TestExportEditorComponent>());
|
||||
EXPECT_FALSE(entity->FindComponent<SliceTestExportEditorComponent>());
|
||||
EXPECT_FALSE(entity->FindComponent<TestExportRuntimeComponent>());
|
||||
EXPECT_TRUE(entity->FindComponent<TestExportOtherRuntimeComponent>());
|
||||
}
|
||||
@@ -1333,7 +1333,7 @@ namespace UnitTest
|
||||
TEST_F(SliceCompilerTest, RuntimeExportCallback_EditorComponentExportSuppressed)
|
||||
{
|
||||
// Create an editor component that has a RuntimeExportCallback and successfully suppresses itself from exporting
|
||||
CreateTestExportEditorEntity("EntityWithEditorComponent", TestExportEditorComponent::ExportComponentType::EXPORT_NULL_COMPONENT, true);
|
||||
CreateTestExportEditorEntity("EntityWithEditorComponent", SliceTestExportEditorComponent::ExportComponentType::EXPORT_NULL_COMPONENT, true);
|
||||
|
||||
if (!CompileSlice())
|
||||
{
|
||||
@@ -1343,7 +1343,7 @@ namespace UnitTest
|
||||
// Expected result: exported slice does NOT contain either component.
|
||||
AZ::Entity* entity = GetCompiledEntity("EntityWithEditorComponent");
|
||||
EXPECT_TRUE(entity);
|
||||
EXPECT_FALSE(entity->FindComponent<TestExportEditorComponent>());
|
||||
EXPECT_FALSE(entity->FindComponent<SliceTestExportEditorComponent>());
|
||||
EXPECT_FALSE(entity->FindComponent<TestExportRuntimeComponent>());
|
||||
EXPECT_FALSE(entity->FindComponent<TestExportOtherRuntimeComponent>());
|
||||
}
|
||||
@@ -1351,7 +1351,7 @@ namespace UnitTest
|
||||
TEST_F(SliceCompilerTest, RuntimeExportCallback_EditorComponentExportUnhandledFallbackToBuildGameEntity)
|
||||
{
|
||||
// Create an editor component that has a RuntimeExportCallback, returns a pointer to itself, but says it wasn't handled.
|
||||
CreateTestExportEditorEntity("EntityWithEditorComponent", TestExportEditorComponent::ExportComponentType::EXPORT_EDITOR_COMPONENT, false);
|
||||
CreateTestExportEditorEntity("EntityWithEditorComponent", SliceTestExportEditorComponent::ExportComponentType::EXPORT_EDITOR_COMPONENT, false);
|
||||
|
||||
if (!CompileSlice())
|
||||
{
|
||||
@@ -1362,7 +1362,7 @@ namespace UnitTest
|
||||
// produced a runtime component.
|
||||
AZ::Entity* entity = GetCompiledEntity("EntityWithEditorComponent");
|
||||
EXPECT_TRUE(entity);
|
||||
EXPECT_FALSE(entity->FindComponent<TestExportEditorComponent>());
|
||||
EXPECT_FALSE(entity->FindComponent<SliceTestExportEditorComponent>());
|
||||
EXPECT_TRUE(entity->FindComponent<TestExportRuntimeComponent>());
|
||||
EXPECT_FALSE(entity->FindComponent<TestExportOtherRuntimeComponent>());
|
||||
}
|
||||
@@ -1370,7 +1370,7 @@ namespace UnitTest
|
||||
TEST_F(SliceCompilerTest, RuntimeExportCallback_EditorComponentExportSuppressedAndUnhandledFallbackToBuildGameEntity)
|
||||
{
|
||||
// Create an editor component that has a RuntimeExportCallback and suppresses itself from exporting, but says it wasn't handled
|
||||
CreateTestExportEditorEntity("EntityWithEditorComponent", TestExportEditorComponent::ExportComponentType::EXPORT_NULL_COMPONENT, false);
|
||||
CreateTestExportEditorEntity("EntityWithEditorComponent", SliceTestExportEditorComponent::ExportComponentType::EXPORT_NULL_COMPONENT, false);
|
||||
|
||||
if (!CompileSlice())
|
||||
{
|
||||
@@ -1381,7 +1381,7 @@ namespace UnitTest
|
||||
// produced a runtime component.
|
||||
AZ::Entity* entity = GetCompiledEntity("EntityWithEditorComponent");
|
||||
EXPECT_TRUE(entity);
|
||||
EXPECT_FALSE(entity->FindComponent<TestExportEditorComponent>());
|
||||
EXPECT_FALSE(entity->FindComponent<SliceTestExportEditorComponent>());
|
||||
EXPECT_TRUE(entity->FindComponent<TestExportRuntimeComponent>());
|
||||
EXPECT_FALSE(entity->FindComponent<TestExportOtherRuntimeComponent>());
|
||||
}
|
||||
@@ -1389,7 +1389,7 @@ namespace UnitTest
|
||||
TEST_F(SliceCompilerTest, RuntimeExportCallback_EditorComponentFailsToExportItself)
|
||||
{
|
||||
// Create an editor component that has a RuntimeExportCallback and suppresses itself from exporting, but says it wasn't handled
|
||||
CreateTestExportEditorEntity("EntityWithEditorComponent", TestExportEditorComponent::ExportComponentType::EXPORT_EDITOR_COMPONENT, true);
|
||||
CreateTestExportEditorEntity("EntityWithEditorComponent", SliceTestExportEditorComponent::ExportComponentType::EXPORT_EDITOR_COMPONENT, true);
|
||||
|
||||
// We expect the slice compilation to fail, since an editor component is being exported as a game component
|
||||
CompileSlice(false);
|
||||
@@ -20,7 +20,6 @@ namespace UnitTest
|
||||
|
||||
class ThumbnailerTests
|
||||
: public ::testing::Test
|
||||
, public TraceBusRedirector
|
||||
{
|
||||
protected:
|
||||
void SetUp() override
|
||||
@@ -31,8 +30,6 @@ namespace UnitTest
|
||||
// was running, because the environment wasn't setup for it to save these settings.
|
||||
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
|
||||
|
||||
TraceBusRedirector::BusConnect();
|
||||
|
||||
AZStd::string entityName("test");
|
||||
AZ::EntityId testEntityId;
|
||||
AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
|
||||
@@ -61,8 +58,6 @@ namespace UnitTest
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
TraceBusRedirector::BusDisconnect();
|
||||
|
||||
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
|
||||
&AzToolsFramework::EditorEntityContextRequestBus::Events::DestroyEditorEntity,
|
||||
m_testEntity->GetId());
|
||||
|
||||
@@ -248,8 +248,6 @@ namespace AzToolsFramework
|
||||
|
||||
m_app.Stop();
|
||||
AZ::Debug::TraceMessageBus::Handler::BusDisconnect();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// A few tests save a layer and want to check the state after saving.
|
||||
|
||||
+2
-2
@@ -975,7 +975,7 @@ namespace UnitTest
|
||||
// AzToolsFramework::Components::TransformComponent
|
||||
|
||||
// Fixture base class for AzToolsFramework::Components::TransformComponent tests
|
||||
class EditorTransformComponentTest
|
||||
class OldEditorTransformComponentTest
|
||||
: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
@@ -1000,7 +1000,7 @@ namespace UnitTest
|
||||
// Old TransformComponents used to store "Slice Root" entity Id, which could be its own Id.
|
||||
// The version-converter could end up making an entity into its own transform parent.
|
||||
// The EditorEntityFixupComponent should fix this up during slice instantiation.
|
||||
TEST_F(EditorTransformComponentTest, OldSliceRoots_ShouldHaveNoParent)
|
||||
TEST_F(OldEditorTransformComponentTest, OldSliceRoots_ShouldHaveNoParent)
|
||||
{
|
||||
const char kSliceData[] =
|
||||
R"DELIMITER(<ObjectStream version="1">
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user