merge from development

Signed-off-by: greerdv <greerdv@amazon.com>
This commit is contained in:
greerdv
2021-07-16 14:47:11 +01:00
130 changed files with 551 additions and 3479 deletions
+10 -1
View File
@@ -868,7 +868,16 @@ void CViewportTitleDlg::OnBnClickedMuteAudio()
void CViewportTitleDlg::UpdateMuteActionText()
{
m_audioMuteAction->setText(gSettings.bMuteAudio ? tr("Un-mute Audio") : tr("Mute Audio"));
if (!Audio::AudioSystemRequestBus::HasHandlers())
{
m_audioMuteAction->setEnabled(false);
m_audioMuteAction->setText(tr("Mute Audio: Enable Audio Gem"));
}
else
{
m_audioMuteAction->setEnabled(true);
m_audioMuteAction->setText(gSettings.bMuteAudio ? tr("Un-mute Audio") : tr("Mute Audio"));
}
}
void CViewportTitleDlg::OnHMDInitialized()
+1 -1
View File
@@ -127,7 +127,7 @@ namespace AZ
#define AZ_TraceFmtCompileTimeCheck(expression, isVaArgs, baseMsg, msg, msgVargs) \
{ \
using namespace AZ::TraceInternal; \
const auto& rTraceFmtCompileTimeCheckExpressionHelper = (expression); /* This is needed for edge cases for expressions containing lambdas, that were unsupported before C++20 */ \
[[maybe_unused]] const auto& rTraceFmtCompileTimeCheckExpressionHelper = (expression); /* This is needed for edge cases for expressions containing lambdas, that were unsupported before C++20 */ \
constexpr ExpressionValidResult isValidTraceFmtResult = ExpressionIsValid<decltype(rTraceFmtCompileTimeCheckExpressionHelper)>::value; \
/* Assert different message depending whether it's const char array or if we have extra arguments */ \
static_assert(!(isVaArgs) ? isValidTraceFmtResult != ExpressionValidResult::Invalid_ConstCharArray : true, baseMsg " " msg); \
@@ -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
{
@@ -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);
+60
View File
@@ -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()
@@ -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>
@@ -9,4 +9,5 @@ set(FILES
Mocks/MockSpawnableEntitiesInterface.h
Utils/Utils.h
Utils/Utils.cpp
FrameworkApplicationFixture.h
)
@@ -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
)
@@ -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);
@@ -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
@@ -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:
@@ -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>();
@@ -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.
@@ -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">
@@ -127,7 +127,6 @@ namespace UnitTest
void SetUpEditorFixtureImpl() override
{
m_editor = new EntityPropertyEditor();
m_editorActions.Connect();
m_entity1 = CreateDefaultEditorEntity("Entity1");
m_entity2 = CreateDefaultEditorEntity("Entity2");
@@ -137,13 +136,11 @@ namespace UnitTest
void TearDownEditorFixtureImpl() override
{
m_editorActions.Disconnect();
delete m_editor;
}
public:
EntityPropertyEditor* m_editor;
TestEditorActions m_editorActions;
EntityIdList m_entityIds;
AZ::EntityId m_entity1;
AZ::EntityId m_entity2;
@@ -234,8 +231,6 @@ namespace UnitTest
entities.insert(m_levelEntity);
m_levelEditor->SetOverrideEntityIds(entities);
m_editorActions.Connect();
// Connect to the EditorRequestBus so that we can intercept calls checking whether or not a level is currently open.
AzToolsFramework::EditorRequestBus::Handler::BusConnect();
}
@@ -244,7 +239,6 @@ namespace UnitTest
{
AzToolsFramework::EditorRequestBus::Handler::BusDisconnect();
m_editorActions.Disconnect();
delete m_levelEditor;
}
@@ -258,7 +252,6 @@ namespace UnitTest
public:
EntityPropertyEditor* m_levelEditor;
TestEditorActions m_editorActions;
AZ::EntityId m_levelEntity;
bool m_levelOpen = false;
};
@@ -85,19 +85,8 @@ namespace UnitTest
}
class ViewportUiWidgetAssertFixture
: public ::testing::Test
, UnitTest::TraceBusRedirector
{
public:
void SetUp() override
{
AZ::Debug::TraceMessageBus::Handler::BusConnect();
}
void TearDown() override
{
AZ::Debug::TraceMessageBus::Handler::BusDisconnect();
}
};
: public ScopedAllocatorSetupFixture
{};
TEST_F(ViewportUiWidgetAssertFixture, RegisterUpdateCallbackDoesNotRegisterFunctionForNotAddedObject)
{
@@ -11,35 +11,37 @@ set(FILES
AssetFileInfoListComparison.cpp
AssetSeedManager.cpp
AssetSystemMocks.h
ComponentModeTests.cpp
ComponentModeTestDoubles.h
ComponentAdapterTests.cpp
ComponentAddRemove.cpp
ComponentModeTestDoubles.cpp
ComponentModeTestFixture.h
ComponentModeTestDoubles.h
ComponentModeTestFixture.cpp
ComponentModeTestFixture.h
ComponentModeTests.cpp
EditorTransformComponentSelectionTests.cpp
EditorVertexSelectionTests.cpp
Entity/EditorEntityContextComponentTests.cpp
Entity/EditorEntityHelpersTests.cpp
Entity/EditorEntitySearchComponentTests.cpp
Entity/EditorEntitySelectionTests.cpp
EntityIdQLabelTests.cpp
EntityInspectorTests.cpp
EntityOwnershipService/EntityOwnershipServiceTestFixture.cpp
EntityOwnershipService/EntityOwnershipServiceTestFixture.h
EntityOwnershipService/SliceEditorEntityOwnershipTests.cpp
EntityOwnershipService/SliceEntityOwnershipTests.cpp
EntityTestbed.h
FileFunc.cpp
FingerprintingTests.cpp
GenericComponentWrapperTest.cpp
InstanceDataHierarchy.cpp
IntegerPrimtitiveTestConfig.h
LogLines.cpp
ManipulatorBoundsTests.cpp
ManipulatorCoreTests.cpp
ManipulatorViewTests.cpp
PlatformAddressedAssetCatalogTests.cpp
PropertyIntCtrlCommonTests.h
IntegerPrimtitiveTestConfig.h
QtWidgetLimitsTests.cpp
PropertyIntSliderCtrlTests.cpp
PropertyIntSpinCtrlTests.cpp
PropertyTreeEditorTests.cpp
PythonBindingTests.cpp
Slice.cpp
SliceUpgradeTestsData.h
SliceUpgradeTests.cpp
SpinBoxTests.cpp
ThumbnailerTests.cpp
UndoStack.cpp
PerforceComponentTests.cpp
PlatformAddressedAssetCatalogTests.cpp
Prefab/Benchmark/PrefabBenchmarkFixture.cpp
Prefab/Benchmark/PrefabBenchmarkFixture.h
Prefab/Benchmark/PrefabCreateBenchmarks.cpp
@@ -47,13 +49,13 @@ set(FILES
Prefab/Benchmark/PrefabLoadBenchmarks.cpp
Prefab/Benchmark/PrefabUpdateInstancesBenchmarks.cpp
Prefab/Benchmark/SpawnableCreateBenchmarks.cpp
Prefab/Spawnable/SpawnableMetaDataTests.cpp
Prefab/MockPrefabFileIOActionValidator.cpp
Prefab/MockPrefabFileIOActionValidator.h
Prefab/PrefabDuplicateTests.cpp
Prefab/PrefabEntityAliasTests.cpp
Prefab/PrefabInstanceToTemplatePropagatorTests.cpp
Prefab/PrefabInstantiateTests.cpp
Prefab/PrefabInstantiateTests.cpp
Prefab/PrefabLoadTemplateTests.cpp
Prefab/PrefabTestComponent.cpp
Prefab/PrefabTestComponent.h
@@ -67,37 +69,50 @@ set(FILES
Prefab/PrefabTestFixture.h
Prefab/PrefabTestUndoFixture.cpp
Prefab/PrefabTestUndoFixture.h
Prefab/PrefabTestUtils.h
Prefab/PrefabUndoLinkTests.cpp
Prefab/PrefabUndoTests.cpp
Prefab/PrefabTestUtils.h
Prefab/PrefabUpdateInstancesTests.cpp
Prefab/PrefabUpdateTemplateTests.cpp
Prefab/PrefabUpdateWithPatchesTests.cpp
Prefab/PrefabInstantiateTests.cpp
Prefab/Spawnable/SpawnableMetaDataTests.cpp
Prefab/SpawnableCreateTests.cpp
Prefab/SpawnableRemoveEditorInfoTests.cpp
Prefab/SpawnableRemoveEditorInfoTestFixture.cpp
Prefab/SpawnableRemoveEditorInfoTestFixture.h
Prefab/SpawnableSortEntitiesTests.cpp
Prefab/SpawnableRemoveEditorInfoTests.cpp
Prefab/SpawnableSortEntitiesTestFixture.cpp
Prefab/SpawnableSortEntitiesTestFixture.h
Entity/EditorEntityContextComponentTests.cpp
Entity/EditorEntityHelpersTests.cpp
Entity/EditorEntitySearchComponentTests.cpp
Entity/EditorEntitySelectionTests.cpp
SliceStabilityTests/SliceStabilityTestFramework.h
SliceStabilityTests/SliceStabilityTestFramework.cpp
Prefab/SpawnableSortEntitiesTests.cpp
PropertyIntCtrlCommonTests.h
PropertyIntSliderCtrlTests.cpp
PropertyIntSpinCtrlTests.cpp
PropertyTreeEditorTests.cpp
PythonBindingTests.cpp
QtWidgetLimitsTests.cpp
Script/ScriptComponentTests.cpp
Script/ScriptEntityTests.cpp
Slice.cpp
Slices.cpp
SliceStabilityTests/SliceStabilityCreateTests.cpp
SliceStabilityTests/SliceStabilityPushTests.cpp
SliceStabilityTests/SliceStabilityReParentTests.cpp
SliceStabilityTests/SliceStabilityTestFramework.cpp
SliceStabilityTests/SliceStabilityTestFramework.h
SliceUpgradeTests.cpp
SliceUpgradeTestsData.h
SpinBoxTests.cpp
SQLiteConnectionTests.cpp
ThumbnailerTests.cpp
ToolsComponents/EditorLayerComponentTests.cpp
ToolsComponents/EditorTransformComponentTests.cpp
TransformComponent.cpp
UI/EntityPropertyEditorTests.cpp
UndoStack.cpp
Viewport/ClusterTests.cpp
Viewport/ViewportScreenTests.cpp
Viewport/ViewportUiClusterTests.cpp
Viewport/ViewportUiDisplayTests.cpp
Viewport/ViewportUiManagerTests.cpp
Viewport/ClusterTests.cpp
Viewport/ViewportUiWidgetManagerTests.cpp
Visibility/EditorVisibilityTests.cpp
)
-1
View File
@@ -18,4 +18,3 @@ add_subdirectory(AzNetworking)
add_subdirectory(Crcfix)
add_subdirectory(GFxFramework)
add_subdirectory(GridMate)
add_subdirectory(Tests)
-64
View File
@@ -1,64 +0,0 @@
#
# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME})
ly_add_target(
NAME AzFrameworkTestShared STATIC
NAMESPACE AZ
FILES_CMAKE
framework_shared_tests_files.cmake
INCLUDE_DIRECTORIES
PUBLIC
.
BUILD_DEPENDENCIES
PRIVATE
AZ::AzCore
AZ::AzFramework
)
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_add_target(
NAME ProcessLaunchTest EXECUTABLE
NAMESPACE AZ
FILES_CMAKE
process_launch_test_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
.
BUILD_DEPENDENCIES
PRIVATE
AZ::AzCore
AZ::AzFramework
)
ly_add_target(
NAME Framework.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
NAMESPACE AZ
FILES_CMAKE
frameworktests_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
.
${pal_dir}
BUILD_DEPENDENCIES
PRIVATE
AZ::AzTest
AZ::AzToolsFramework
AZ::AzTestShared
AZ::AzFrameworkTestShared
RUNTIME_DEPENDENCIES
AZ::ProcessLaunchTest
)
ly_add_googletest(
NAME AZ::Framework.Tests
)
endif()
endif()
-1
View File
@@ -187,7 +187,6 @@ protected:
{
ComponentApplication::SetSettingsRegistrySpecializations(specializations);
specializations.Append("tools");
specializations.Append("editor");
specializations.Append("gridhub");
}