23 #include "datapaths.h" 24 #include "strings.hpp" 25 #include "testdatapaths.h" 27 TestDataPathsAppDataDirectoryAccess::TestDataPathsAppDataDirectoryAccess(
bool bPortable)
32 _testName +=
" - portable";
35 this->bPortable = bPortable;
38 bool TestDataPathsAppDataDirectoryAccess::executeTest()
42 QString appDataDir = dataPaths.systemAppDataDirectory();
44 testLog << QString(
"App Data directory: %1").arg(appDataDir);
46 return dataPaths.validateAppDataDirectory();
51 TestDataPathsAppDataDirectoryWrite::TestDataPathsAppDataDirectoryWrite(
bool bPortable)
56 _testName +=
" - portable";
59 this->bPortable = bPortable;
62 bool TestDataPathsAppDataDirectoryWrite::executeTest()
66 QString appDataDirPath = dataPaths.systemAppDataDirectory();
67 QDir appDataDir(appDataDirPath);
69 QString randomDirName;
70 bool bEntryDoesExist =
false;
77 bEntryDoesExist = appDataDir.exists(randomDirName);
78 }
while (bEntryDoesExist ==
true);
80 QString randomDirPath = appDataDirPath +
"/" + randomDirName;
82 testLog <<
"Attempting to create directory:";
83 testLog << randomDirPath;
85 if (!appDataDir.mkdir(randomDirName))
91 QString testFilePath = randomDirPath +
"/" +
"tmpfile.tmp";
92 QFile testFile(testFilePath);
94 testLog <<
"Attempting to open following file for writing:";
95 testLog << testFilePath;
97 bool bReturnValue =
true;
99 if (!testFile.open(QIODevice::WriteOnly))
101 testLog <<
"Failed.";
102 bReturnValue =
false;
111 appDataDir.rmdir(randomDirName);
Base class for Test Units.
Represents directories used by Doomseeker to store data.
static QString createRandomAlphaNumericString(unsigned numChars)
Creates a random string with specified length.