{LYN-4996} Asset Processor is not reprocessing STL files after settings are edited/updated (#2095)

* add asset importer file extension

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

* add new test setreg file

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

* removed an unnecessary namespace

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

* addressed feedback

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

* addressed feedback

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

* remove unnecessay method

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

* add file

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

* reduce waiting time in block until idle

Signed-off-by: sharmajs <sharmajs@amazon.com>
This commit is contained in:
sharmajs-amzn
2021-07-20 09:26:11 -07:00
committed by GitHub
parent 00f50f2a90
commit d5431e1c57
10 changed files with 161 additions and 2 deletions
@@ -76,6 +76,7 @@ public:
friend class GTEST_TEST_CLASS_NAME_(ModtimeScanningTest, ModtimeSkipping_ModifyMetadataFile);
friend class GTEST_TEST_CLASS_NAME_(ModtimeScanningTest, ModtimeSkipping_DeleteFile);
friend class GTEST_TEST_CLASS_NAME_(DeleteTest, DeleteFolderSharedAcrossTwoScanFolders_CorrectFileAndFolderAreDeletedFromCache);
friend class GTEST_TEST_CLASS_NAME_(MetadataFileTest, MetadataFile_SourceFileExtensionDifferentCase);
friend class AssetProcessorManagerTest;
friend struct ModtimeScanningTest;
@@ -5241,3 +5242,59 @@ void DuplicateProcessTest::SetUp()
m_sharedConnection = m_assetProcessorManager->m_stateData.get();
ASSERT_TRUE(m_sharedConnection);
}
void MetadataFileTest::SetUp()
{
AssetProcessorManagerTest::SetUp();
m_config->AddMetaDataType("foo", "txt");
}
TEST_F(MetadataFileTest, MetadataFile_SourceFileExtensionDifferentCase)
{
using namespace AzToolsFramework::AssetSystem;
using namespace AssetProcessor;
QDir tempPath(m_tempDir.path());
QString relFileName("Dummy.TXT");
QString absPath(tempPath.absoluteFilePath("subfolder1/Dummy.TXT"));
QString watchFolder = tempPath.absoluteFilePath("subfolder1");
UnitTestUtils::CreateDummyFile(absPath, "dummy");
JobEntry entry;
entry.m_watchFolderPath = watchFolder;
entry.m_databaseSourceName = entry.m_pathRelativeToWatchFolder = relFileName;
entry.m_jobKey = "txt";
entry.m_platformInfo = { "pc", {"host", "renderer", "desktop"} };
entry.m_jobRunKey = 1;
QString productPath(m_normalizedCacheRootDir.absoluteFilePath("outputfile.TXT"));
UnitTestUtils::CreateDummyFile(productPath);
AssetBuilderSDK::ProcessJobResponse jobResponse;
jobResponse.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
jobResponse.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(productPath.toUtf8().data()));
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, entry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, jobResponse));
ASSERT_TRUE(BlockUntilIdle(5000));
// Creating a metadata file for the source assets
// APM should process the source asset if a metadafile is detected
// We are intentionally having a source file with a different file extension casing than the one specified in the metadata rule.
QString metadataFile(tempPath.absoluteFilePath("subfolder1/Dummy.foo"));
UnitTestUtils::CreateDummyFile(metadataFile, "dummy");
// Capture the job details as the APM inspects the file.
JobDetails jobDetails;
auto connection = QObject::connect(m_assetProcessorManager.get(), &AssetProcessorManager::AssetToProcess, [&jobDetails](JobDetails job)
{
jobDetails = job;
});
m_assetProcessorManager->AssessAddedFile(tempPath.absoluteFilePath(metadataFile));
ASSERT_TRUE(BlockUntilIdle(5000));
ASSERT_EQ(jobDetails.m_jobEntry.m_pathRelativeToWatchFolder, relFileName);
}