diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-04-24 16:32:49 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-29 12:28:16 +0200 |
commit | f3bc9f5c5cee9dac8a7815c2861a9945b5341390 (patch) | |
tree | c7306c4c04013e9290df292cecd5af24c9dcbd90 /tests | |
parent | 32893fa9c45ad1a26a476f43711bdd5e6951e24b (diff) |
Add locations AppDataLocation, AppLocalDataLocation to QStandardPaths.
On Windows, DataLocation currently returns the value obtained by
passing CSIDL_COMMON_APPDATA to SHGetSpecialFolderPath(). This is
the local non-roaming path. For actually storing settings, the roaming
path should be used (CSIDL_APPDATA). Introduce new AppDataLocation to
return that path and AppLocalDataLocation for the local path and deprecate
DataLocation.
[ChangeLog][QtCore][QStandardPaths] QStandardPaths now has new
enumeration values AppDataLocation, AppLocalDataLocation to be able
to differentiate between roaming and local paths on the Windows
operating system. DataLocation is deprecated in favor of AppDataLocation.
Task-number: QTBUG-38483
Change-Id: Ib1de8c7031a863ed5eac10c747de6f7ff1a090c7
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index 7247b02498..c373e80408 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -56,7 +56,7 @@ #define Q_XDG_PLATFORM #endif -static const int MaxStandardLocation = QStandardPaths::GenericConfigLocation; +static const int MaxStandardLocation = QStandardPaths::AppDataLocation; class tst_qstandardpaths : public QObject { @@ -129,7 +129,8 @@ static const char * const enumNames[MaxStandardLocation + 1 - int(QStandardPaths "ConfigLocation", "DownloadLocation", "GenericCacheLocation", - "GenericConfigLocation" + "GenericConfigLocation", + "AppDataLocation" }; void tst_qstandardpaths::dump() @@ -238,7 +239,8 @@ void tst_qstandardpaths::enableTestMode() // Check this for locations where test programs typically write. Not desktop, download, music etc... typedef QHash<QStandardPaths::StandardLocation, QString> LocationHash; LocationHash testLocations; - testLocations.insert(QStandardPaths::DataLocation, QStandardPaths::writableLocation(QStandardPaths::DataLocation)); + testLocations.insert(QStandardPaths::AppDataLocation, QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); + testLocations.insert(QStandardPaths::AppLocalDataLocation, QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)); testLocations.insert(QStandardPaths::GenericDataLocation, QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)); testLocations.insert(QStandardPaths::ConfigLocation, QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)); testLocations.insert(QStandardPaths::GenericConfigLocation, QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation)); @@ -294,18 +296,18 @@ void tst_qstandardpaths::testDataLocation() // applications are sandboxed. #if !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_ANDROID) && !defined(Q_OS_WINRT) const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); - QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/tst_qstandardpaths"); + QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), base + "/tst_qstandardpaths"); QCoreApplication::instance()->setOrganizationName("Qt"); - QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/Qt/tst_qstandardpaths"); + QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), base + "/Qt/tst_qstandardpaths"); QCoreApplication::instance()->setApplicationName("QtTest"); - QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/Qt/QtTest"); + QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), base + "/Qt/QtTest"); #endif #ifdef Q_XDG_PLATFORM setDefaultLocations(); const QString expectedAppDataDir = QDir::homePath() + QString::fromLatin1("/.local/share/Qt/QtTest"); - QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), expectedAppDataDir); - const QStringList appDataDirs = QStandardPaths::standardLocations(QStandardPaths::DataLocation); + QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), expectedAppDataDir); + const QStringList appDataDirs = QStandardPaths::standardLocations(QStandardPaths::AppLocalDataLocation); QCOMPARE(appDataDirs.count(), 3); QCOMPARE(appDataDirs.at(0), expectedAppDataDir); QCOMPARE(appDataDirs.at(1), QString::fromLatin1("/usr/local/share/Qt/QtTest")); @@ -463,7 +465,7 @@ void tst_qstandardpaths::testAllWritableLocations_data() QTest::newRow("PicturesLocation") << QStandardPaths::PicturesLocation; QTest::newRow("TempLocation") << QStandardPaths::TempLocation; QTest::newRow("HomeLocation") << QStandardPaths::HomeLocation; - QTest::newRow("DataLocation") << QStandardPaths::DataLocation; + QTest::newRow("AppLocalDataLocation") << QStandardPaths::AppLocalDataLocation; QTest::newRow("DownloadLocation") << QStandardPaths::DownloadLocation; } |