Merge branch 'development' into redcode/driller_removal
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> # Conflicts: # Code/Framework/AzCore/AzCore/azcore_files.cmake # Gems/Atom/Feature/Common/Assets/Materials/Presets/MacBeth/15_red_sRGB.tif
This commit is contained in:
@@ -113,8 +113,15 @@ set(FILES
|
||||
Debug/TraceMessageBus.h
|
||||
Debug/TraceReflection.cpp
|
||||
Debug/TraceReflection.h
|
||||
DOM/DomBackend.cpp
|
||||
DOM/DomBackend.h
|
||||
DOM/DomUtils.cpp
|
||||
DOM/DomUtils.h
|
||||
DOM/DomVisitor.cpp
|
||||
DOM/DomVisitor.h
|
||||
DOM/Backends/JSON/JsonBackend.h
|
||||
DOM/Backends/JSON/JsonSerializationUtils.cpp
|
||||
DOM/Backends/JSON/JsonSerializationUtils.h
|
||||
EBus/BusImpl.h
|
||||
EBus/EBus.h
|
||||
EBus/EBusEnvironment.cpp
|
||||
|
||||
@@ -212,6 +212,8 @@ set(FILES
|
||||
AZStd/Variant.cpp
|
||||
AZStd/VariantSerialization.cpp
|
||||
AZStd/VectorAndArray.cpp
|
||||
DOM/DomJsonTests.cpp
|
||||
DOM/DomJsonBenchmarks.cpp
|
||||
)
|
||||
|
||||
# Prevent the following files from being grouped in UNITY builds
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
#include <AzFramework/Components/TransformComponent.h>
|
||||
|
||||
#include <AzToolsFramework/Application/ToolsApplication.h>
|
||||
#include <AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.h>
|
||||
#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
|
||||
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h>
|
||||
#include <Prefab/PrefabTestFixture.h>
|
||||
|
||||
#include <AZTestShared/Math/MathTestHelpers.h>
|
||||
|
||||
@@ -1062,4 +1065,67 @@ R"DELIMITER(<ObjectStream version="1">
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fixture provides a root prefab with Transform component and listens for TransformNotificationBus.
|
||||
class TransformComponentActivationTest
|
||||
: public PrefabTestFixture
|
||||
, public TransformNotificationBus::Handler
|
||||
{
|
||||
protected:
|
||||
void SetUpEditorFixtureImpl() override
|
||||
{
|
||||
PrefabTestFixture::SetUpEditorFixtureImpl();
|
||||
|
||||
CreateRootPrefab();
|
||||
}
|
||||
|
||||
void TearDownEditorFixtureImpl() override
|
||||
{
|
||||
BusDisconnect();
|
||||
|
||||
PrefabTestFixture::TearDownEditorFixtureImpl();
|
||||
}
|
||||
|
||||
void OnTransformChanged(const Transform& /*local*/, const Transform& /*world*/) override
|
||||
{
|
||||
m_transformUpdated = true;
|
||||
}
|
||||
|
||||
void MoveEntity(AZ::EntityId entityId)
|
||||
{
|
||||
AzToolsFramework::ScopedUndoBatch undoBatch("Move Entity");
|
||||
TransformBus::Event(entityId, &TransformInterface::SetWorldTranslation, Vector3(1.f, 0.f, 0.f));
|
||||
}
|
||||
|
||||
bool m_transformUpdated = false;
|
||||
};
|
||||
|
||||
TEST_F(TransformComponentActivationTest, TransformChangedEventIsSentWhenEntityIsActivatedViaUndoRedo)
|
||||
{
|
||||
AZ::EntityId entityId = CreateEntityUnderRootPrefab("Entity");
|
||||
MoveEntity(entityId);
|
||||
BusConnect(entityId);
|
||||
|
||||
// verify that undoing/redoing move operations fires TransformChanged event
|
||||
Undo();
|
||||
EXPECT_TRUE(m_transformUpdated);
|
||||
m_transformUpdated = false;
|
||||
|
||||
Redo();
|
||||
EXPECT_TRUE(m_transformUpdated);
|
||||
m_transformUpdated = false;
|
||||
}
|
||||
|
||||
TEST_F(TransformComponentActivationTest, TransformChangedEventIsNotSentWhenEntityIsDeactivatedAndActivated)
|
||||
{
|
||||
AZ::EntityId entityId = CreateEntityUnderRootPrefab("Entity");
|
||||
BusConnect(entityId);
|
||||
|
||||
// verify that simply activating/deactivating an entity does not fire TransformChanged event
|
||||
Entity* entity = nullptr;
|
||||
ComponentApplicationBus::BroadcastResult(entity, &AZ::ComponentApplicationRequests::FindEntity, entityId);
|
||||
entity->Deactivate();
|
||||
entity->Activate();
|
||||
EXPECT_FALSE(m_transformUpdated);
|
||||
}
|
||||
} // namespace UnitTest
|
||||
|
||||
Reference in New Issue
Block a user