Fixed AzToolsFramework tests (#2887)

* Fixed AzToolsFramework unit tests.

Signed-off-by: moraaar <moraaar@amazon.com>

* Include missing header.

Signed-off-by: moraaar <moraaar@amazon.com>

* Using util's class to generate temp directory, instead of qt.

Signed-off-by: moraaar <moraaar@amazon.com>

* Added empty line

Signed-off-by: moraaar <moraaar@amazon.com>

* Fixed warning in MessageTest fixture that CacheProjectRootFolder was not set

Signed-off-by: moraaar <moraaar@amazon.com>

* Additional checks in CreateDefaultEditorEntity helper function.

Signed-off-by: moraaar <moraaar@amazon.com>

* Updated the AzToolsFrameworkTest logic to set the project cache path

The Project Cache Path and Project Path is set through the CommandLine functionality of the ComponentApplication.
This allows those Project Cache Path and Project Path to be set within the Settings Registry during the ComponentApplication constructor

Removed the explicitly calls to delete the temporary directory and fixed the ScopedTemporaryDirectory class to recursively delete the temporary directory

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Setup correctly @assets@ alias for PlatformAddressedAssetCatalogManagerTest and AssetSeedManagerTest fixtures.

- These 2 test fixtures need to manually set the @asset@ alias to not include the platform at the end (which it does by default), because they are looping over platforms in their setup.
- Also initializing pointers to nullptr, so if setup fail in the future the teardown doesn't crash trying to delete garbage.

Signed-off-by: moraaar <moraaar@amazon.com>

Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
moraaar
2021-08-06 17:07:15 +01:00
committed by GitHub
parent c2c59eae05
commit 9e0b8c564d
9 changed files with 236 additions and 245 deletions
@@ -1285,7 +1285,7 @@ namespace UnitTest
Crc32 uiHandler = 0;
EXPECT_EQ(it->ReadAttribute(AZ::Edit::UIHandlers::Handler, uiHandler), true);
EXPECT_EQ(uiHandler, AZ_CRC("TestHandler"));
EXPECT_EQ(it->GetElementMetadata()->m_name, "UIElement");
EXPECT_STREQ(it->GetElementMetadata()->m_name, "UIElement");
EXPECT_EQ(it->GetElementMetadata()->m_nameCrc, AZ_CRC("UIElement"));
uiHandler = 0;
@@ -1293,7 +1293,7 @@ namespace UnitTest
++it;
EXPECT_EQ(it->ReadAttribute(AZ::Edit::UIHandlers::Handler, uiHandler), true);
EXPECT_EQ(uiHandler, AZ_CRC("TestHandler2"));
EXPECT_EQ(it->GetElementMetadata()->m_name, "UIElement2");
EXPECT_STREQ(it->GetElementMetadata()->m_name, "UIElement2");
EXPECT_EQ(it->GetElementMetadata()->m_nameCrc, AZ_CRC("UIElement2"));
}
};
@@ -1356,21 +1356,21 @@ namespace UnitTest
auto it = children.begin();
EXPECT_EQ(it->GetElementMetadata()->m_name, "aggregatedDataElement");
EXPECT_STREQ(it->GetElementMetadata()->m_name, "aggregatedDataElement");
++it;
if (i == 0)
{
EXPECT_EQ(it->GetElementMetadata()->m_name, "notAggregatedDataElement");
EXPECT_STREQ(it->GetElementMetadata()->m_name, "notAggregatedDataElement");
++it;
}
EXPECT_EQ(it->GetElementMetadata()->m_name, "aggregatedUIElement");
EXPECT_STREQ(it->GetElementMetadata()->m_name, "aggregatedUIElement");
++it;
if (i == 0)
{
EXPECT_EQ(it->GetElementMetadata()->m_name, "notAggregatedUIElement");
EXPECT_STREQ(it->GetElementMetadata()->m_name, "notAggregatedUIElement");
++it;
}
}
@@ -1505,11 +1505,11 @@ namespace UnitTest
AZStd::string childName(child.GetElementMetadata()->m_name);
if (childName.compare("GroupFloat") == 0)
{
EXPECT_EQ(child.GetGroupElementMetadata()->m_description, "Normal Group");
EXPECT_STREQ(child.GetGroupElementMetadata()->m_description, "Normal Group");
}
if (childName.compare("ToggleGroupInt") == 0)
{
EXPECT_EQ(child.GetGroupElementMetadata()->m_description, "Group Toggle");
EXPECT_STREQ(child.GetGroupElementMetadata()->m_description, "Group Toggle");
}
if ((childName.compare("SubDataNormal") == 0) || (childName.compare("SubDataToggle") == 0))
{
@@ -1518,11 +1518,11 @@ namespace UnitTest
childName = subChild.GetElementMetadata()->m_name;
if (childName.compare("SubInt") == 0)
{
EXPECT_EQ(subChild.GetGroupElementMetadata()->m_description, "Normal SubGroup");
EXPECT_STREQ(subChild.GetGroupElementMetadata()->m_description, "Normal SubGroup");
}
if (childName.compare("SubFloat") == 0)
{
EXPECT_EQ(subChild.GetGroupElementMetadata()->m_description, "SubGroup Toggle");
EXPECT_STREQ(subChild.GetGroupElementMetadata()->m_description, "SubGroup Toggle");
}
}
}
@@ -1552,7 +1552,7 @@ namespace UnitTest
AZStd::string childName(child.GetElementMetadata()->m_name);
if (childName.compare(paramName) == 0)
{
EXPECT_EQ(child.GetParent()->GetClassMetadata()->m_name, "GroupTestComponent");
EXPECT_STREQ(child.GetParent()->GetClassMetadata()->m_name, "GroupTestComponent");
}
if ((childName.compare("SubDataNormal") == 0) || (childName.compare("SubDataToggle") == 0))
{
@@ -1561,7 +1561,7 @@ namespace UnitTest
childName = subChild.GetElementMetadata()->m_name;
if (childName.compare(paramName) == 0)
{
EXPECT_EQ(subChild.GetParent()->GetClassMetadata()->m_name, "SubData");
EXPECT_STREQ(subChild.GetParent()->GetClassMetadata()->m_name, "SubData");
}
}
}