23 #include "testdatapaths.h"
24 #include "datapaths.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);
79 while (bEntryDoesExist ==
true);
81 QString randomDirPath = appDataDirPath +
"/" + randomDirName;
83 testLog <<
"Attempting to create directory:";
84 testLog << randomDirPath;
86 if (!appDataDir.mkdir(randomDirName))
92 QString testFilePath = randomDirPath +
"/" +
"tmpfile.tmp";
93 QFile testFile(testFilePath);
95 testLog <<
"Attempting to open following file for writing:";
96 testLog << testFilePath;
98 bool bReturnValue =
true;
100 if (!testFile.open(QIODevice::WriteOnly))
102 testLog <<
"Failed.";
103 bReturnValue =
false;
112 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.