@ -281,6 +281,39 @@ namespace UnitTest
TestFGetCachedFileData ( fileInArchiveFile , dataString . size ( ) , dataString . data ( ) ) ;
}
TEST_F ( ArchiveTestFixture , TestArchiveOpenPacks_FindsMultiplePaks_Works )
{
AZ : : IO : : IArchive * archive = AZ : : Interface < AZ : : IO : : IArchive > : : Get ( ) ;
ASSERT_NE ( nullptr , archive ) ;
AZ : : IO : : FileIOBase * fileIo = AZ : : IO : : FileIOBase : : GetInstance ( ) ;
ASSERT_NE ( nullptr , fileIo ) ;
auto resetArchiveFile = [ archive , fileIo ] ( const AZStd : : string & filePath )
{
archive - > ClosePack ( filePath . c_str ( ) ) ;
fileIo - > Remove ( filePath . c_str ( ) ) ;
auto pArchive = archive - > OpenArchive ( filePath . c_str ( ) , nullptr , AZ : : IO : : INestedArchive : : FLAGS_CREATE_NEW ) ;
EXPECT_NE ( nullptr , pArchive ) ;
pArchive . reset ( ) ;
archive - > ClosePack ( filePath . c_str ( ) ) ;
} ;
AZStd : : string testArchivePath_pakOne = " @usercache@/one.pak " ;
AZStd : : string testArchivePath_pakTwo = " @usercache@/two.pak " ;
// reset test files in case they already exist
resetArchiveFile ( testArchivePath_pakOne ) ;
resetArchiveFile ( testArchivePath_pakTwo ) ;
// open and fetch the opened pak file using a *.pak
AZStd : : vector < AZ : : IO : : FixedMaxPathString > fullPaths ;
archive - > OpenPacks ( " @usercache@/*.pak " , AZ : : IO : : IArchive : : EPathResolutionRules : : FLAGS_PATH_REAL , & fullPaths ) ;
EXPECT_TRUE ( AZStd : : any_of ( fullPaths . cbegin ( ) , fullPaths . cend ( ) , [ ] ( auto & path ) { return path . ends_with ( " one.pak " ) ; } ) ) ;
EXPECT_TRUE ( AZStd : : any_of ( fullPaths . cbegin ( ) , fullPaths . cend ( ) , [ ] ( auto & path ) { return path . ends_with ( " two.pak " ) ; } ) ) ;
}
TEST_F ( ArchiveTestFixture , TestArchiveFGetCachedFileData_LooseFile )
{
// ------setup loose file FGetCachedFileData tests -------------------------