summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qstandardpaths.cpp
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2012-03-25 13:10:48 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-28 11:22:11 +0200
commita5a80da2238030b5ecbc7c5fba7ecd8cb5f2da1c (patch)
tree4b27a2112ecc4415a222f96807f462bb077bdf0c /src/corelib/io/qstandardpaths.cpp
parent99e7ad660f23dce51ccd68438adae7528013d23c (diff)
Allow auto tests to stay away from the user's configuration.
QStandardPaths now knows a "test mode" which changes writable locations to point to test directories, in order to prevent auto tests from reading from or writing to the current user's configuration. This affects the locations into which test programs might write files: GenericDataLocation, DataLocation, ConfigLocation, GenericCacheLocation, CacheLocation. Other locations are not affected. Change-Id: I29606c2e74714360edd871a8c387a5c1ef7d1f54 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'src/corelib/io/qstandardpaths.cpp')
-rw-r--r--src/corelib/io/qstandardpaths.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index 55f824cdeb..c6103b3f2f 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -309,6 +309,27 @@ QString QStandardPaths::displayName(StandardLocation type)
}
#endif
+/*!
+ \fn void QStandardPaths::enableTestMode(bool testMode)
+
+ Enables "test mode" in QStandardPaths, which changes writable locations
+ to point to test directories, in order to prevent auto tests from reading from
+ or writing to the current user's configuration.
+
+ This affects the locations into which test programs might write files:
+ GenericDataLocation, DataLocation, ConfigLocation,
+ GenericCacheLocation, CacheLocation.
+ Other locations are not affected.
+
+ On Unix, XDG_DATA_HOME is set to ~/.qttest/share, XDG_CONFIG_HOME is
+ set to ~/.qttest/config, and XDG_CACHE_HOME is set to ~/.qttest/cache.
+
+ On Mac, data goes to "~/.qttest/Application Support", cache goes to
+ ~/.qttest/Cache, and config goes to ~/.qttest/Preferences.
+
+ On Windows, everything goes to a "qttest" directory under Application Data.
+*/
+
QT_END_NAMESPACE
#endif // QT_NO_STANDARDPATHS