#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2021 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License // If the library is compiled as a DLL, this ensures symbols are exported #define NUCLEX_STORAGE_SOURCE 1 #include "../../../Source/FileSystem/Windows/StandardDirectoryResolver.h" #include #if defined(NUCLEX_STORAGE_WIN32) namespace Nuclex { namespace Storage { namespace FileSystem { namespace Windows { // ------------------------------------------------------------------------------------------- // TEST(StandardDirectoryResolverTest, CanResolveSpecialFolders) { std::string desktopDirectory = StandardDirectoryResolver::GetFolderPath(CSIDL_DESKTOP); EXPECT_GT(desktopDirectory.length(), 3); std::string programFilesDirectory = StandardDirectoryResolver::GetFolderPath( CSIDL_PROGRAM_FILES ); EXPECT_GT(programFilesDirectory.length(), 3); std::string documentsDirectory = StandardDirectoryResolver::GetFolderPath(CSIDL_MYDOCUMENTS); EXPECT_GT(documentsDirectory.length(), 3); std::string localAppDataDirectory = StandardDirectoryResolver::GetFolderPath( CSIDL_LOCAL_APPDATA ); EXPECT_GT(localAppDataDirectory.length(), 3); std::string picturesDirectory = StandardDirectoryResolver::GetFolderPath( CSIDL_MYPICTURES ); EXPECT_GT(picturesDirectory.length(), 3); std::string commonAppDataDirectory = StandardDirectoryResolver::GetFolderPath( CSIDL_COMMON_APPDATA ); EXPECT_GT(commonAppDataDirectory.length(), 3); std::string roamingAppDataDirectory = StandardDirectoryResolver::GetFolderPath( CSIDL_APPDATA ); EXPECT_GT(roamingAppDataDirectory.length(), 3); } // ------------------------------------------------------------------------------------------- // TEST(StandardDirectoryResolverTest, CanResolveKnownFolders) { std::string desktopDirectory = StandardDirectoryResolver::GetKnownFolder(FOLDERID_Desktop); EXPECT_GT(desktopDirectory.length(), 3); std::string documentsDirectory = StandardDirectoryResolver::GetKnownFolder( FOLDERID_Documents ); EXPECT_GT(documentsDirectory.length(), 3); std::string localAppDataDirectory = StandardDirectoryResolver::GetKnownFolder( FOLDERID_LocalAppData ); EXPECT_GT(localAppDataDirectory.length(), 3); std::string picturesDirectory = StandardDirectoryResolver::GetKnownFolder( FOLDERID_Pictures ); EXPECT_GT(picturesDirectory.length(), 3); std::string commonAppDataDirectory = StandardDirectoryResolver::GetKnownFolder( FOLDERID_ProgramData ); EXPECT_GT(commonAppDataDirectory.length(), 3); std::string roamingAppDataDirectory = StandardDirectoryResolver::GetKnownFolder( FOLDERID_RoamingAppData ); EXPECT_GT(roamingAppDataDirectory.length(), 3); #if 0 std::string savedGameDirectory = StandardDirectoryResolver::GetKnownFolder( FOLDERID_SavedGames ); EXPECT_GT(savedGameDirectory.length(), 3); // Windows 8+ std::string screenshotsDirectory = StandardDirectoryResolver::GetKnownFolder( FOLDERID_Screenshots ); EXPECT_GT(screenshotsDirectory.length(), 3); // Windows 8+ #endif } // ------------------------------------------------------------------------------------------- // TEST(StandardDirectoryResolverTest, CanResolveKnownFoldersInBatches) { std::vector requestedFolders; requestedFolders.push_back(FOLDERID_Documents); requestedFolders.push_back(FOLDERID_Pictures); requestedFolders.push_back(FOLDERID_Desktop); std::vector directories = StandardDirectoryResolver::GetMultipleKnownFolders( requestedFolders ); ASSERT_EQ(directories.size(), 3); EXPECT_GT(directories[0].length(), 3); EXPECT_GT(directories[1].length(), 3); EXPECT_GT(directories[2].length(), 3); } // ------------------------------------------------------------------------------------------- // }}}} // namespace Nuclex::Storage::FileSystem::Windows #endif // defined(NUCLEX_STORAGE_WIN32)