{LYN-4456} FileIO hooks for LegacyTestAdapter (#1635)

* Could not reproduce the unit test fail for the m_app->BeforeRun() failure,
* so I am adding file IO hooks to listen for errors during the fixture setup

Tests: failed to repro the issue
Signed-off-by: Jackson <23512001+jackalbe@users.noreply.github.com>
This commit is contained in:
jackalbe
2021-06-29 11:59:51 -05:00
committed by GitHub
parent 8fe33c9afc
commit a9227e1962
@@ -9,6 +9,7 @@
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/UserSettings/UserSettingsComponent.h>
#include <AzCore/IO/FileIOEventBus.h>
#include "BaseAssetProcessorTest.h"
#include <native/utilities/BatchApplicationManager.h>
@@ -52,11 +53,13 @@ namespace AssetProcessor
};
class LegacyTestAdapter : public AssetProcessorTest,
public ::testing::WithParamInterface<std::string>
public ::testing::WithParamInterface<std::string>,
public AZ::IO::FileIOEventBus::Handler
{
void SetUp() override
{
AssetProcessorTest::SetUp();
AZ::IO::FileIOEventBus::Handler::BusConnect();
static int numParams = 1;
static char processName[] = {"AssetProcessorBatch"};
@@ -77,9 +80,15 @@ namespace AssetProcessor
void TearDown() override
{
m_application.reset();
AZ::IO::FileIOEventBus::Handler::BusDisconnect();
AssetProcessorTest::TearDown();
}
void OnError([[maybe_unused]] const AZ::IO::SystemFile* file, const char* fileName, int errorCode) override
{
AZ_Error("LegacyTestAdapter", false, "File error detected with %s with code %d", fileName, errorCode);
}
AZStd::unique_ptr<UnitTestAppManager> m_application;
};