QStandardPaths: add a test that just dumps the values
Change-Id: I79bcc1974988b3d712a40e89a3ec4aeb7be1fb5e Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
This commit is contained in:
parent
415f65fbff
commit
131b3e5dca
@ -56,11 +56,14 @@
|
||||
#define Q_XDG_PLATFORM
|
||||
#endif
|
||||
|
||||
const int MaxStandardLocation = QStandardPaths::GenericCacheLocation;
|
||||
|
||||
class tst_qstandardpaths : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void dump();
|
||||
void testDefaultLocations();
|
||||
void testCustomLocations();
|
||||
void enableTestMode();
|
||||
@ -108,6 +111,39 @@ private:
|
||||
QTemporaryDir m_globalAppTempDir;
|
||||
};
|
||||
|
||||
static const char * const enumNames[MaxStandardLocation + 1 - int(QStandardPaths::DesktopLocation)] = {
|
||||
"DesktopLocation",
|
||||
"DocumentsLocation",
|
||||
"FontsLocation",
|
||||
"ApplicationsLocation",
|
||||
"MusicLocation",
|
||||
"MoviesLocation",
|
||||
"PicturesLocation",
|
||||
"TempLocation",
|
||||
"HomeLocation",
|
||||
"DataLocation",
|
||||
"CacheLocation",
|
||||
"GenericDataLocation",
|
||||
"RuntimeLocation",
|
||||
"ConfigLocation",
|
||||
"DownloadLocation",
|
||||
"GenericCacheLocation"
|
||||
};
|
||||
|
||||
void tst_qstandardpaths::dump()
|
||||
{
|
||||
#ifdef Q_XDG_PLATFORM
|
||||
setDefaultLocations();
|
||||
#endif
|
||||
// This is not a test. It merely dumps the output.
|
||||
for (int i = QStandardPaths::DesktopLocation; i <= MaxStandardLocation; ++i) {
|
||||
QStandardPaths::StandardLocation s = QStandardPaths::StandardLocation(i);
|
||||
qDebug() << enumNames[i]
|
||||
<< QStandardPaths::writableLocation(s)
|
||||
<< QStandardPaths::standardLocations(s);
|
||||
}
|
||||
}
|
||||
|
||||
void tst_qstandardpaths::testDefaultLocations()
|
||||
{
|
||||
#ifdef Q_XDG_PLATFORM
|
||||
|
Loading…
Reference in New Issue
Block a user