Prevent approved reference images to be copied to html test report for successful test

#jira UE-176364
#preflight 63e3d66d8374ef68dffe3565
#rb Chris.Constantinescu

[CL 24085750 by jerome delattre in ue5-main branch]
This commit is contained in:
jerome delattre
2023-02-08 18:20:35 -05:00
parent 46c0741f65
commit 80b32adb45
5 changed files with 30 additions and 22 deletions

View File

@@ -482,7 +482,7 @@ FImageComparisonResult FScreenShotManager::CompareScreenshot(const FString& InUn
}
FScreenshotExportResult FScreenShotManager::ExportScreenshotComparisonResult(FString ScreenshotName, FString RootExportFolder)
FScreenshotExportResult FScreenShotManager::ExportScreenshotComparisonResult(FString ScreenshotName, FString RootExportFolder, bool bOnlyIncoming)
{
FPaths::NormalizeDirectoryName(RootExportFolder);
@@ -501,7 +501,9 @@ FScreenshotExportResult FScreenShotManager::ExportScreenshotComparisonResult(FSt
return Results;
}
CopyDirectory(Destination, ScreenshotResultsFolder / ScreenshotName);
FString Pattern = bOnlyIncoming ? TEXT("Incoming.*") : TEXT("*");
CopyDirectory(Destination, ScreenshotResultsFolder / ScreenshotName, Pattern);
Results.Success = true;
return Results;
@@ -556,13 +558,13 @@ FString FScreenShotManager::GetDefaultExportDirectory() const
return FPaths::Combine(FPaths::ProjectSavedDir(),TEXT("Exported/imageCompare"));
}
void FScreenShotManager::CopyDirectory(const FString& DestDir, const FString& SrcDir)
void FScreenShotManager::CopyDirectory(const FString& DestDir, const FString& SrcDir, const FString& Pattern)
{
TArray<FString> FilesToCopy;
FString AbsoluteSrcDir = FPaths::ConvertRelativePathToFull(SrcDir);
IFileManager::Get().FindFilesRecursive(FilesToCopy, *AbsoluteSrcDir, TEXT("*"), /*Files=*/true, /*Directories=*/false);
IFileManager::Get().FindFilesRecursive(FilesToCopy, *AbsoluteSrcDir, *Pattern, /*Files=*/true, /*Directories=*/false);
ParallelFor(FilesToCopy.Num(), [&](int32 Index)
{