summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-02-13 09:35:08 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-13 09:35:08 +0100
commit7ac97d7efb1a1e75633ce31fbb03eb43a9b01670 (patch)
tree4284e5eff68c13cc52be1c658d6c2abffee3ece5 /tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
parent5b14bf342f43bd6cb02ad751db8da851850814bb (diff)
parenta9c88c1f39c41215eb9d7288a1fd02aa865e8a04 (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp')
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index 20a31fc98f..7247b02498 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -77,6 +77,7 @@ private slots:
void testAllWritableLocations_data();
void testAllWritableLocations();
void testCleanPath();
+ void testXdgPathCleanup();
private:
#ifdef Q_XDG_PLATFORM
@@ -477,6 +478,8 @@ void tst_qstandardpaths::testAllWritableLocations()
QString loc = QStandardPaths::writableLocation(location);
if (loc.size() > 1) // workaround for unlikely case of locations that return '/'
QCOMPARE(loc.endsWith(QLatin1Char('/')), false);
+ QVERIFY(loc.contains(QLatin1Char('/')));
+ QVERIFY(!loc.contains(QLatin1Char('\\')));
}
void tst_qstandardpaths::testCleanPath()
@@ -491,6 +494,19 @@ void tst_qstandardpaths::testCleanPath()
}
}
+void tst_qstandardpaths::testXdgPathCleanup()
+{
+#ifdef Q_XDG_PLATFORM
+ setCustomLocations();
+ const QString uncleanGlobalAppDir = "/./" + QFile::encodeName(m_globalAppDir);
+ qputenv("XDG_DATA_DIRS", QFile::encodeName(uncleanGlobalAppDir) + "::relative/path");
+ const QStringList appsDirs = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation);
+ QVERIFY(!appsDirs.contains("/applications"));
+ QVERIFY(!appsDirs.contains(uncleanGlobalAppDir + "/applications"));
+ QVERIFY(!appsDirs.contains("relative/path/applications"));
+#endif
+}
+
QTEST_MAIN(tst_qstandardpaths)
#include "tst_qstandardpaths.moc"